コード例 #1
0
 @Before
 public void setup() {
   // Here built mocks to integration test
   iCalculator cal = Mockito.mock(iCalculator.class);
   // Pass parameter of my method and also the result that I expect see
   Mockito.when(cal.add(3, 3)).thenReturn(6);
   CalService = new icalservice();
   CalService.setCalc(cal);
 }
コード例 #2
0
 @SuppressWarnings("deprecation")
 @Test
 public void test() {
   Assert.assertEquals(6, CalService.addTwoNumbers(3, 3));
 }