Ejemplo n.º 1
0
  @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)));
  }
Ejemplo n.º 2
0
  @Test
  public void theAvailableThemesShouldContainAtListAristoTheme() {

    Map<String, String> themes = controller.getThemes();

    assertThat(themes.entrySet(), is(not(empty())));
    assertThat(themes.values(), hasItem("aristo"));
  }
Ejemplo n.º 3
0
  @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)));
  }