Exemplo n.º 1
0
  @Test
  public void testEquals() throws Exception {
    Page page1 = context.pageManager().getPage("/content/sample/en");
    Page page2 = context.pageManager().getPage("/content/sample/en");
    Page page3 = context.pageManager().getPage("/content/sample/en/toolbar/profiles");

    assertTrue(page1.equals(page2));
    assertFalse(page1.equals(page3));
  }
Exemplo n.º 2
0
  @Test
  public void testGetLanguage() {
    Page profilesPage = context.pageManager().getPage("/content/sample/en/toolbar/profiles");

    // set language in site root
    ModifiableValueMap props = this.page.getContentResource().adaptTo(ModifiableValueMap.class);
    props.put(JcrConstants.JCR_LANGUAGE, "fr_FR");

    // test get language from content
    Locale locale = profilesPage.getLanguage(false);
    assertEquals(Locale.forLanguageTag("fr-FR"), locale);

    // test get language from path
    locale = profilesPage.getLanguage(true);
    assertEquals(Locale.forLanguageTag("en"), locale);
  }