use of io.gravitee.rest.api.model.PictureEntity in project gravitee-management-rest-api by gravitee-io.
the class ThemeServiceTest method shouldGetBackgroundImageUrl.
@Test
public void shouldGetBackgroundImageUrl() throws TechnicalException {
final Theme theme = mock(Theme.class);
when(theme.getBackgroundImage()).thenReturn("http://localhost/image");
when(theme.getId()).thenReturn(THEME_ID);
when(theme.getName()).thenReturn("NAME");
when(theme.isEnabled()).thenReturn(true);
when(theme.getDefinition()).thenReturn(themeServiceImpl.getDefaultDefinition());
when(themeRepository.findByReferenceIdAndReferenceType(GraviteeContext.getCurrentEnvironment(), ENVIRONMENT.name())).thenReturn(singleton(theme));
PictureEntity backgroundImage = themeService.getBackgroundImage(THEME_ID);
assertNotNull(backgroundImage);
assertTrue(backgroundImage instanceof UrlPictureEntity);
}
use of io.gravitee.rest.api.model.PictureEntity in project gravitee-management-rest-api by gravitee-io.
the class ThemeServiceTest method shouldGetBackgroundImage.
@Test
public void shouldGetBackgroundImage() throws TechnicalException {
final Theme theme = mock(Theme.class);
Mockito.lenient().when(theme.getReferenceType()).thenReturn(ENVIRONMENT.name());
PictureEntity backgroundImage = themeService.getBackgroundImage(THEME_ID);
assertNull(backgroundImage);
}
use of io.gravitee.rest.api.model.PictureEntity in project gravitee-management-rest-api by gravitee-io.
the class ThemeServiceTest method shouldGetLogo.
@Test
public void shouldGetLogo() throws TechnicalException {
final Theme theme = mock(Theme.class, withSettings().lenient());
Mockito.lenient().when(theme.getReferenceType()).thenReturn(ENVIRONMENT.name());
when(theme.getReferenceId()).thenReturn("DEFAULT");
when(theme.getLogo()).thenReturn(themeServiceImpl.getDefaultLogo());
PictureEntity logo = themeService.getLogo(THEME_ID);
assertNotNull(logo);
assertTrue(logo instanceof InlinePictureEntity);
}
Aggregations