use of com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory in project kylo by Teradata.
the class IntegrationTestBase method setupRestAssured.
@Before
public void setupRestAssured() throws URISyntaxException {
UserContext.setUser(UserContext.User.ADMIN);
RestAssured.baseURI = kyloConfig.getProtocol() + kyloConfig.getHost();
RestAssured.port = kyloConfig.getPort();
RestAssured.basePath = kyloConfig.getBasePath();
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
Jackson2ObjectMapperFactory factory = (aClass, s) -> {
ObjectMapper om = new ObjectMapper();
om.registerModule(new JodaModule());
om.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
om.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
configureObjectMapper(om);
return om;
};
com.jayway.restassured.mapper.ObjectMapper objectMapper = new Jackson2Mapper(factory);
RestAssured.objectMapper(objectMapper);
startClean();
}
use of com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory in project muikku by otavanopisto.
the class AbstractUITest method setupRestAssured.
@Before
public void setupRestAssured() {
RestAssured.baseURI = getAppUrl(true) + "/rest";
RestAssured.port = getPortHttps();
RestAssured.authentication = certificate(getKeystoreFile(), getKeystorePass());
RestAssured.config = RestAssuredConfig.config().objectMapperConfig(ObjectMapperConfig.objectMapperConfig().jackson2ObjectMapperFactory(new Jackson2ObjectMapperFactory() {
@SuppressWarnings("rawtypes")
@Override
public com.fasterxml.jackson.databind.ObjectMapper create(Class cls, String charset) {
com.fasterxml.jackson.databind.ObjectMapper objectMapper = new com.fasterxml.jackson.databind.ObjectMapper();
objectMapper.registerModule(new JSR310Module());
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
return objectMapper;
}
}));
}
use of com.jayway.restassured.mapper.factory.Jackson2ObjectMapperFactory in project muikku by otavanopisto.
the class AbstractRESTTest method setupRestAssured.
@Before
public void setupRestAssured() throws JsonProcessingException {
RestAssured.baseURI = getAppUrl(true) + "/rest";
RestAssured.port = getPortHttps();
RestAssured.authentication = certificate(getKeystoreFile(), getKeystorePass());
RestAssured.config = RestAssuredConfig.config().objectMapperConfig(ObjectMapperConfig.objectMapperConfig().jackson2ObjectMapperFactory(new Jackson2ObjectMapperFactory() {
@SuppressWarnings("rawtypes")
@Override
public com.fasterxml.jackson.databind.ObjectMapper create(Class cls, String charset) {
com.fasterxml.jackson.databind.ObjectMapper objectMapper = new com.fasterxml.jackson.databind.ObjectMapper();
objectMapper.registerModule(new JSR310Module());
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
return objectMapper;
}
}));
}
Aggregations