### Question:
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();  }### Answer:
@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()); }
@Test public void testHighlightElementWhenItsAWarningMessage() { final FlashMessage flashMessage = mock(FlashMessage.class); final String elementSelector = "elementSelector"; when(flashMessage.getType()).thenReturn(WARNING); when(flashMessage.getElementSelector()).thenReturn(elementSelector); flashMessages.highlighElement(flashMessage); verify(view).showWarningHighlight(elementSelector); verify(view, never()).showErrorHighlight(anyString()); }