use of fi.otavanopisto.muikku.atests.CommunicatorMessage in project muikku by otavanopisto.
the class AbstractUITest method createCommunicatorMesssage.
protected void createCommunicatorMesssage(String caption, String content, Long sender, Long recipient) throws JsonParseException, JsonMappingException, IOException {
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Date created = new Date();
Set<String> tags = new HashSet<>();
List<Long> recipientIds = new ArrayList<>();
recipientIds.add(recipient);
CommunicatorMessage payload = new CommunicatorMessage(null, null, sender, "test", caption, content, created, tags, recipientIds, new ArrayList<Long>(), new ArrayList<Long>(), new ArrayList<Long>());
Response response = asAdmin().contentType("application/json").body(payload).post("test/communicator/messages");
response.then().statusCode(200);
CommunicatorMessage result = objectMapper.readValue(response.asString(), CommunicatorMessage.class);
assertNotNull(result);
assertNotNull(result.getId());
}
Aggregations