Search in sources :

Example 1 with BrandingRegistry

use of org.codice.ddf.branding.BrandingRegistry in project ddf by codice.

the class TestLandingPage method setupLandingPage.

@BeforeClass
public static void setupLandingPage() throws IOException {
    BrandingPlugin brandingPlugin = mock(BrandingPlugin.class);
    when(brandingPlugin.getBase64FavIcon()).thenReturn("");
    when(brandingPlugin.getBase64ProductImage()).thenReturn(Base64.getEncoder().encodeToString(fakeImg.getBytes()));
    landingPage = new LandingPage();
    BrandingRegistry branding = mock(BrandingRegistryImpl.class);
    when(branding.getProductName()).thenReturn(productName);
    when(branding.getProductVersion()).thenReturn(version);
    when(branding.getBrandingPlugins()).thenReturn(Collections.singletonList(brandingPlugin));
    when(branding.getAttributeFromBranding(any())).thenCallRealMethod();
    landingPage.setBranding(branding);
    String firstDateLeadingZeroes = "05/07/20 stuff happened";
    String secondDateNoLeadingZeroes = "4/3/20 old stuff happened";
    String noDate = "something happened";
    List<String> unsorted = Arrays.asList(secondDateNoLeadingZeroes, noDate, firstDateLeadingZeroes);
    sorted = Arrays.asList(firstDateLeadingZeroes, secondDateNoLeadingZeroes, noDate);
    landingPage.setAnnouncements(unsorted);
}
Also used : BrandingPlugin(org.codice.ddf.branding.BrandingPlugin) Matchers.containsString(org.hamcrest.Matchers.containsString) BrandingRegistry(org.codice.ddf.branding.BrandingRegistry) BeforeClass(org.junit.BeforeClass)

Example 2 with BrandingRegistry

use of org.codice.ddf.branding.BrandingRegistry in project ddf by codice.

the class TestLandingPage method testDefaultTitle.

@Test
public void testDefaultTitle() {
    BrandingRegistry brandingPlugin = mock(BrandingRegistry.class);
    when(brandingPlugin.getProductName()).thenReturn("DDF");
    LandingPage landingPage = new LandingPage();
    landingPage.setBranding(brandingPlugin);
    assertThat(landingPage.getTitle(), is(equalTo("DDF")));
}
Also used : BrandingRegistry(org.codice.ddf.branding.BrandingRegistry) Test(org.junit.Test)

Aggregations

BrandingRegistry (org.codice.ddf.branding.BrandingRegistry)2 BrandingPlugin (org.codice.ddf.branding.BrandingPlugin)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1