@Test public void testShowFlashMessageWhenItsASuccessMessage() { final FlashMessage flashMessage = mock(FlashMessage.class); final String strongMessage = "*message*"; final String regularMessage = "message"; when(flashMessage.getType()).thenReturn(SUCCESS); when(flashMessage.getStrongMessage()).thenReturn(strongMessage); when(flashMessage.getRegularMessage()).thenReturn(regularMessage); flashMessages.showFlashMessage(flashMessage); verify(view).showSuccessMessage(strongMessage, regularMessage); verify(view, never()).showWarningMessage(anyString(), anyString()); verify(view, never()).showErrorMessage(anyString(), anyString()); }
void showFlashMessage(final FlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: view.showErrorMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; case WARNING: view.showWarningMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; case SUCCESS: view.showSuccessMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; } }
FlashMessages { void showFlashMessage(final FlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: view.showErrorMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; case WARNING: view.showWarningMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; case SUCCESS: view.showSuccessMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; } } }
FlashMessages { void showFlashMessage(final FlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: view.showErrorMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; case WARNING: view.showWarningMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; case SUCCESS: view.showSuccessMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; } } @Inject  FlashMessages(final View view); }
FlashMessages { void showFlashMessage(final FlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: view.showErrorMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; case WARNING: view.showWarningMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; case SUCCESS: view.showSuccessMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; } } @Inject  FlashMessages(final View view); HTMLElement getElement(); void onFlashMessageEvent(final @Observes FlashMessage flashMessage); void hideMessages(); }
FlashMessages { void showFlashMessage(final FlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: view.showErrorMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; case WARNING: view.showWarningMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; case SUCCESS: view.showSuccessMessage(flashMessage.getStrongMessage(), flashMessage.getRegularMessage()); break; } } @Inject  FlashMessages(final View view); HTMLElement getElement(); void onFlashMessageEvent(final @Observes FlashMessage flashMessage); void hideMessages();  }