Here is my endpoint :
@PostMapping("/email/registration")
public Data registration(@RequestBody Data data, HttpServletRequest
httpServletRequest) throws Exception {
emailSenderService.pushEmail(httpServletRequest.getRequestURI(),
emailSenderService.sendConfirmationEmail(httpServletRequest.getRequestURI(), data));
emailSenderService.consumeEmail(httpServletRequest.getRequestURI());
return data;
}
And here is my test(of course it's not working) :
@Test
public void testRegistrationConfirmation() throws Exception {
Data testData = new Data();
when(testData).thenReturn(testData);
mockMvc.perform(
post("/email/registration")
.contentType(MediaType.APPLICATION_JSON)
.content(asJsonString(testData)))
.andExpect(status().isOk())
.andExpect(testData);
}
I would like to see if the give object is the same as the return object, preferably without filling all the fields with values.
Thank you for the answers!