@Test public void ifTheUserPrefferedThemeIsNotInTheListOfPredefinedThemesThentheFirstEntryOfTheMapShouldReturned() { when(userSession.getUserPrefferedTheme()) .thenReturn(Optional.of(controller.getThemes().keySet().iterator().next() + "XXX")); String expected = controller.getThemes().values().iterator().next(); String currentTheme = controller.getCurrentThemeOrElse("aristo"); assertThat(currentTheme, is(equalTo(expected))); }
@Test public void theAvailableThemesShouldContainAtListAristoTheme() { Map<String, String> themes = controller.getThemes(); assertThat(themes.entrySet(), is(not(empty()))); assertThat(themes.values(), hasItem("aristo")); }
@Test public void ifTheUsersPrefferedThemeIsNotDefinedThenThenTheFirstAvailableThemeIsChoosenAsThePrefferedTheme() { when(userSession.getUserPrefferedTheme()).thenReturn(Optional.empty()); String expected = controller.getThemes().values().iterator().next(); String currentTheme = controller.getCurrentThemeOrElse("aristo"); assertThat(currentTheme, is(equalTo(expected))); }