Search in sources :

Example 1 with Flag

use of fi.otavanopisto.muikku.atests.Flag in project muikku by otavanopisto.

the class AbstractUITest method createFlag.

protected Long createFlag(String name, String color, String description) throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
    Flag flag = new Flag(null, name, color, description, "STAFF-1/PYRAMUS");
    Response response = asAdmin().contentType("application/json").body(flag).post("/test/flags");
    response.then().statusCode(200);
    Flag result = objectMapper.readValue(response.asString(), Flag.class);
    return result.getId();
}
Also used : Response(com.jayway.restassured.response.Response) JSR310Module(com.fasterxml.jackson.datatype.jsr310.JSR310Module) StudentFlag(fi.otavanopisto.muikku.atests.StudentFlag) Flag(fi.otavanopisto.muikku.atests.Flag) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JSR310Module (com.fasterxml.jackson.datatype.jsr310.JSR310Module)1 Response (com.jayway.restassured.response.Response)1 Flag (fi.otavanopisto.muikku.atests.Flag)1 StudentFlag (fi.otavanopisto.muikku.atests.StudentFlag)1