use of org.mockito.MockitoSession in project dexmaker by linkedin.
the class MockStatic method doReturnMockWithTwoClasses.
@Test
public void doReturnMockWithTwoClasses() throws Exception {
MockitoSession session = mockitoSession().mockStatic(SuperClass.class).mockStatic(SubClass.class).startMocking();
try {
doReturn("fakeB").when(SuperClass::returnB);
assertEquals("fakeB", SuperClass.returnB());
doReturn("fakeD").when(() -> SubClass.record("test"));
assertEquals("fakeD", SubClass.record("test"));
} finally {
session.finishMocking();
}
}
Aggregations