nazerke
4/11/2019 - 5:46 AM

Stubbing private methods

OrderServiceImpl mockOrderService = Mockito.mock(OrderServiceImpl.class)
Mockito.when(mockOrderService.calculateTotal()).thenCallRealMethod();
BigDecimal discountResult = new BigDecimal("1.50");
WithOrWithoutExpectedArguments args = Mockito.when(mockOrderService, calculateDiscount);
args.withArguments(item1, order).thenReturn(discountResult);