Reputation: 13
@Override public void storeInfoInStaging(StagingInfo stagingInfo) throws BusinessException {
INotificaDao iNotificaDao = NotificaDaoFactory.getInstance().getNotificaDao();
try {
iNotificaDao.storeInfoInStaging(stagingInfo);
} catch (DataException e) {
LOGGER.error(e.getMessage(), e);
throw new BusinessException(NotificaConstants.DB_ERROR_CODE, NotificaConstants.DB_ERROR_MESSAGE);
}
}
Upvotes: 0
Views: 162
Reputation: 944
I do not know your className, you need to replace your className your own className. Maybe, you can do something like that just check for the method really invoke method.
@Mock
private INotificationDao iNotificationDao;
private ClassName className;
@Before
public void init() {
className = spy(new ClassName());
}
@Test
public void storeInfoInStagingGivenStaginInfoValid() {
Mockito.doNothing().when(className).storeInfoStaging(stagingInfo);
className.storeInfoStaging(storeInfo);
Mockito.verify(iNotificaDao, atLeastOnce()).storeInfoStaging(staginInfo);
}
Upvotes: 1