Search in sources :

Example 1 with Announcement

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

the class AbstractUITest method createAnnouncement.

protected Long createAnnouncement(Long publisherUserEntityId, String caption, String content, Date startDate, Date endDate, Boolean archived, Boolean publiclyVisible, List<Long> userGroupIds) throws Exception {
    ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
    Announcement payload = new Announcement(null, publisherUserEntityId, userGroupIds, caption, content, new Date(), startDate, endDate, archived, publiclyVisible);
    Response response = asAdmin().contentType("application/json").body(payload).post("/test/announcements");
    response.then().statusCode(200);
    Long result = objectMapper.readValue(response.asString(), Long.class);
    return result;
}
Also used : Response(com.jayway.restassured.response.Response) Announcement(fi.otavanopisto.muikku.atests.Announcement) JSR310Module(com.fasterxml.jackson.datatype.jsr310.JSR310Module) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Date(java.util.Date)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JSR310Module (com.fasterxml.jackson.datatype.jsr310.JSR310Module)1 Response (com.jayway.restassured.response.Response)1 Announcement (fi.otavanopisto.muikku.atests.Announcement)1 Date (java.util.Date)1