### Question:
FlashMessages { void registerFlashMessageCallback(final FlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: case SUCCESS: break; case WARNING: warningSuccessCallback = flashMessage.getOnSuccess(); warningErrorCallback = flashMessage.getOnError(); break; } } @Inject  FlashMessages(final View view); HTMLElement getElement(); void onFlashMessageEvent(final @Observes FlashMessage flashMessage); void hideMessages();  }### Answer:
@Test public void testRegisterFlashMessageCallback() { final FlashMessage flashMessage = mock(FlashMessage.class); final Command onSuccess = mock(Command.class); final Command onError = mock(Command.class); when(flashMessage.getOnSuccess()).thenReturn(onSuccess); when(flashMessage.getOnError()).thenReturn(onError); when(flashMessage.getType()).thenReturn(WARNING); flashMessages.registerFlashMessageCallback(flashMessage); flashMessages.executeSuccessWarningCallback(); flashMessages.executeErrorWarningCallback(); verify(onSuccess).execute(); verify(onError).execute(); }