@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(); }
void registerFlashMessageCallback(final FlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: case SUCCESS: break; case WARNING: warningSuccessCallback = flashMessage.getOnSuccess(); warningErrorCallback = flashMessage.getOnError(); break; } }
FlashMessages { void registerFlashMessageCallback(final FlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: case SUCCESS: break; case WARNING: warningSuccessCallback = flashMessage.getOnSuccess(); warningErrorCallback = flashMessage.getOnError(); break; } } }
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); }
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(); }
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();  }