Skip to content

Instantly share code, notes, and snippets.

@pivotaljohn
Created May 19, 2016 17:47
Show Gist options
  • Save pivotaljohn/7619180caa7f495586e5d84c579760ba to your computer and use it in GitHub Desktop.
Save pivotaljohn/7619180caa7f495586e5d84c579760ba to your computer and use it in GitHub Desktop.
Configure Mockito to, by default, throw an exception when un-mocked behavior is invoked.
package org.mockito.configuration;
import org.mockito.Mockito;
import org.mockito.stubbing.Answer;
public class MockitoConfiguration extends DefaultMockitoConfiguration {
@Override
public Answer<Object> getDefaultAnswer() {
return Mockito.RETURNS_SMART_NULLS;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment