Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- public void chooseActivity() throws Exception {
- Matching savedMatching = new Matching("Niq", 2L, "side", true);
- when(activityPublisher.check(any(Matching.class))).thenReturn(true);
- when(matchingServiceImpl.findMatchingWithPendingFalse(anyString(), anyLong())).thenReturn(Optional.empty());
- lenient().when(matchingServiceImpl.save(any(Matching.class))).thenReturn(savedMatching);
- when(activityPublisher.getOwnerId(anyLong())).thenReturn("dummyString");
- doNothing().when(notificationPublisher).notifyUser(anyString(), anyString(), anyLong(), anyString(), anyString());
- MvcResult mvcResult = mockMvc
- .perform(post("/chooseActivity")
- .contentType(MediaType.APPLICATION_JSON)
- .content(objectMapper.writeValueAsString(matching))
- )
- .andDo(MockMvcResultHandlers.print())
- .andExpect(status().isOk())
- .andReturn();
- String contentAsString = mvcResult.getResponse().getContentAsString();
- Matching obtained = objectMapper.readValue(contentAsString, Matching.class);
- assertThat(savedMatching).isEqualTo(obtained);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement