Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import org.junit.Before;
import org.junit.Test;
import static junit.framework.TestCase.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
public class MockitoTest {
interface StringProvider {
String getString();
private StringProvider provider;
public void setUp() {
provider = mock(StringProvider.class);
public void mokitoSample() {
String result = provider.getString();
assertEquals("mocked", result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.