Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- void validationTest() throws Exception {
- Notification notification = new Notification("", "", null, "", "");
- MvcResult mvcResult = mockMvc
- .perform(post("/notifyUser")
- .contentType(MediaType.APPLICATION_JSON)
- .content(objectMapper.writeValueAsString(notification))
- )
- .andExpect(status().isBadRequest())
- .andReturn();
- String contentAsString = mvcResult.getResponse().getContentAsString();
- assertThat(contentAsString).contains("activityId is mandatory and cannot be null");
- assertThat(contentAsString).contains("targetId is mandatory and cannot be blank");
- assertThat(contentAsString).contains("userId is mandatory and cannot be blank");
- assertThat(contentAsString).contains("type is mandatory and cannot be blank");
- assertThat(contentAsString).contains("userId is mandatory and cannot be blank");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement