use of io.gravitee.rest.api.portal.rest.model.ConfigurationResponse in project gravitee-management-rest-api by gravitee-io.
the class ConfigurationMapperTest method testConvert.
@Test
public void testConvert() throws IOException {
ObjectMapper mapper = new ObjectMapper();
PortalSettingsEntity portalSettingsEntity = mapper.readValue(this.getClass().getResourceAsStream("portalSettingsEntity.json"), PortalSettingsEntity.class);
ConsoleSettingsEntity consoleSettingsEntity = mapper.readValue(this.getClass().getResourceAsStream("consoleSettingsEntity.json"), ConsoleSettingsEntity.class);
String expected = IOUtils.toString(this.getClass().getResourceAsStream("expectedPortalConfiguration.json"), "UTF-8");
ConfigurationMapper configurationMapper = new ConfigurationMapper();
ConfigurationResponse configuration = configurationMapper.convert(portalSettingsEntity, consoleSettingsEntity);
mapper.setSerializationInclusion(Include.NON_NULL);
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
String configurationAsJSON = mapper.writeValueAsString(configuration);
assertEquals(expected.trim(), configurationAsJSON.trim());
}
Aggregations