Example #1
0
 @Test
 public void testGetValue() {
   int param = 10;
   int mockedValue = 25;
   // mock void method
   Mockito.doNothing().when(valueRepository).reset();
   // mock method with returning value
   Mockito.when(valueRepository.get(param)).thenReturn(mockedValue);
   int result = showcase.getValue(param);
   assertEquals(mockedValue + 10, result);
   Mockito.verify(valueRepository);
 }
Example #2
0
 @Before
 public void setUp() throws Exception {
   showcase = new MockitoShowcase();
   valueRepository = Mockito.mock(ValueRepository.class);
   showcase.setRepository(valueRepository);
 }