czym może być spowodowany błąd w tescie org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException ?? przy kodzie testu
public void test_create_user_success() throws Exception {
User user = new User(1, "Daenerys","Targaryes","emaill","haslo");
when(userService.addWithDefaultRole(user));
mockMvc.perform(
post("/api/register")
.contentType(MediaType.APPLICATION_JSON)
.content(asJsonString(user)))
.andExpect(status().isCreated())
.andExpect(header().string("location", containsString("api/user/1")));
verify(userService, times(1)).addWithDefaultRole(user);
verifyNoMoreInteractions(userService);
} ```
https://github.com/PatrykBrzuchacz/SpringProjekt-master3-master