### Question:
AssetValidatedCallback implements RemoteCallback<List<ValidationMessage>> { @Override public void callback(final List<ValidationMessage> validationMessages) { if (validationMessages == null || validationMessages.isEmpty()) { notifyValidationSuccess(); } else { validationPopup.showMessages(validationMessages); } if (validationFinishedCommand != null) { validationFinishedCommand.execute(); } } AssetValidatedCallback(final Command validationFinishedCommand,
                                  final Event<NotificationEvent> notificationEvent,
                                  final ValidationPopup validationPopup); @Override void callback(final List<ValidationMessage> validationMessages);  }### Answer:
@Test public void success() throws Exception { assetValidatedCallback.callback(new ArrayList<>()); Mockito.verify(notificationEvent).fire(notificationEventArgumentCaptor.capture()); assertEquals("ItemValidatedSuccessfully", notificationEventArgumentCaptor.getValue().getNotification()); assertEquals(NotificationEvent.NotificationType.SUCCESS, notificationEventArgumentCaptor.getValue().getType()); verify(validationPopup, never()).showMessages(anyList()); verify(validationFinishedCommand).execute(); }
@Test public void failure() throws Exception { final ArrayList<ValidationMessage> validationMessages = new ArrayList<>(); validationMessages.add(mock(ValidationMessage.class)); assetValidatedCallback.callback(validationMessages); Mockito.verify(notificationEvent, never()).fire(notificationEventArgumentCaptor.capture()); verify(validationPopup).showMessages(validationMessages); verify(validationFinishedCommand).execute(); }