package lesson3;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
public class _4_DeepMockTest {
@Before
public void init() {
MockitoAnnotations.initMocks(this);
}
/**
* without "answer = Answers.RETURNS_DEEP_STUBS", lesson3.foo() will throw NullPointException
*/
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
Lesson3Service lesson3Service;
@Test
public void testDeepMock() {
lesson3Service.getLesson3().foo();
Lesson3 lesson3 = lesson3Service.getLesson3();
String foo = lesson3.foo();
Assert.assertEquals(true, lesson3 != null);
Assert.assertEquals(true, foo == null);
}
}