protected void initRestAssured() { // port RestAssured.port = pippo.getServer().getPort(); // objectMapper RestAssured.objectMapper(new ObjectMapper() { @Override public Object deserialize(ObjectMapperDeserializationContext context) { ContentTypeEngine engine = pippo.getApplication().getContentTypeEngine(context.getContentType()); if (engine == null) { throw new PippoRuntimeException("No ContentTypeEngine registered for {}", context.getContentType()); } return engine.fromString(context.getDataToDeserialize().asString(), context.getType()); } @Override public Object serialize(ObjectMapperSerializationContext context) { ContentTypeEngine engine = pippo.getApplication().getContentTypeEngine(context.getContentType()); if (engine == null) { throw new PippoRuntimeException("No ContentTypeEngine registered for {}", context.getContentType()); } return engine.toString(context.getObjectToSerialize()); } }); }
@Before public void setupObjectMapper() { RestAssured.objectMapper(getObjectMapper()); }
@Before public void setupObjectMapper() { RestAssured.objectMapper(getObjectMapper()); }
protected void initRestAssured() { // port RestAssured.port = pippo.getServer().getPort(); // objectMapper RestAssured.objectMapper(new ObjectMapper() { @Override public Object deserialize(ObjectMapperDeserializationContext context) { ContentTypeEngine engine = pippo.getApplication().getContentTypeEngine(context.getContentType()); if (engine == null) { throw new PippoRuntimeException("No ContentTypeEngine registered for {}", context.getContentType()); } return engine.fromString(context.getDataToDeserialize().asString(), context.getType()); } @Override public Object serialize(ObjectMapperSerializationContext context) { ContentTypeEngine engine = pippo.getApplication().getContentTypeEngine(context.getContentType()); if (engine == null) { throw new PippoRuntimeException("No ContentTypeEngine registered for {}", context.getContentType()); } return engine.toString(context.getObjectToSerialize()); } }); }