@Test public void testHighlightElementWhenItsAnErrorMessage() { final FlashMessage flashMessage = mock(FlashMessage.class); final String elementSelector = "elementSelector"; when(flashMessage.getType()).thenReturn(ERROR); when(flashMessage.getElementSelector()).thenReturn(elementSelector); flashMessages.highlighElement(flashMessage); verify(view).showErrorHighlight(elementSelector); verify(view, never()).showWarningHighlight(anyString()); }
void highlighElement(final FlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: view.showErrorHighlight(flashMessage.getElementSelector()); break; case WARNING: view.showWarningHighlight(flashMessage.getElementSelector()); break; case SUCCESS: break; } }
FlashMessages { void highlighElement(final FlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: view.showErrorHighlight(flashMessage.getElementSelector()); break; case WARNING: view.showWarningHighlight(flashMessage.getElementSelector()); break; case SUCCESS: break; } } }
FlashMessages { void highlighElement(final FlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: view.showErrorHighlight(flashMessage.getElementSelector()); break; case WARNING: view.showWarningHighlight(flashMessage.getElementSelector()); break; case SUCCESS: break; } } @Inject  FlashMessages(final View view); }
FlashMessages { void highlighElement(final FlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: view.showErrorHighlight(flashMessage.getElementSelector()); break; case WARNING: view.showWarningHighlight(flashMessage.getElementSelector()); break; case SUCCESS: break; } } @Inject  FlashMessages(final View view); HTMLElement getElement(); void onFlashMessageEvent(final @Observes FlashMessage flashMessage); void hideMessages(); }
FlashMessages { void highlighElement(final FlashMessage flashMessage) { switch (flashMessage.getType()) { case ERROR: view.showErrorHighlight(flashMessage.getElementSelector()); break; case WARNING: view.showWarningHighlight(flashMessage.getElementSelector()); break; case SUCCESS: break; } } @Inject  FlashMessages(final View view); HTMLElement getElement(); void onFlashMessageEvent(final @Observes FlashMessage flashMessage); void hideMessages();  }