Top "Stubbing" questions

Stubbing is modifying an instance method or property of an object at runtime to extend its functionality.

Mockito - NullpointerException when stubbing Method

So I started writing tests for our Java-Spring-project. What I use is JUnit and Mockito. It's said, that when I …

java testing junit mockito stubbing
Cleaning up sinon stubs easily

Is there a way to easily reset all sinon spys mocks and stubs that will work cleanly with mocha's beforeEach …

javascript testing mocha stubbing sinon
Mockito: How to easily stub a method without mocking all parameters

I have a method i'd like to stub but it has a lot of parameters. How can i avoid mocking …

java unit-testing mocking mockito stubbing
RSpec: how to test Rails logger message expectations?

I am trying to test that the Rails logger receives messages in some of my specs. I am using the …

logging rspec mocking stubbing
Mockito when/then not returning expected value

I'm trying to stub this getKeyFromStream method, using the 'any' matchers. I've tried being more explicit and less explicit (anyObject()), …

java unit-testing mockito stubbing
Stubbing authentication in request spec

When writing a request spec, how do you set sessions and/or stub controller methods? I'm trying to stub out …

ruby-on-rails-3 rspec integration-testing stubbing
Stubbing window.location.href with Sinon

I am trying to test some client-side code and for that I need to stub the value of window.location.…

javascript mocha sinon stubbing
How to stub a Typescript-Interface / Type-definition?

I work with Typescript on an AngularJS 1.X project. I use different Javascript libraries for different purposes. To unit-test my …

javascript angularjs typescript sinon stubbing
Is there a way to stub a method of an included module with Rspec?

I have a module that is included in another module, and they both implement the same method. I would like …

ruby rspec mixins stubbing
Mockito - Stubbing a method of an object that was returned by a mock object method

Let's say I have an mock object, and I don't want to stub any of it's methods, but I want …

java mockito method-chaining stubbing