Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -423,4 +423,18 @@ void shouldRequireAdminLeaderOrMentorshipAdminRoleOnGetAllMentors() throws NoSuc
assertThat(annotation.value())
.containsExactlyInAnyOrder(RoleType.ADMIN, RoleType.LEADER, RoleType.MENTORSHIP_ADMIN);
}

@Test
@DisplayName("Given POST request with id in body, when creating mentor, then id in body is ignored")
void shouldIgnoreIdInRequestBodyWhenCreatingMentor() throws Exception {
var requestWithId = createMentorDtoTest(999L, MemberType.MENTOR);
var savedMentor = createMentorTest("Jane");

Comment thread
dricazenck marked this conversation as resolved.
when(mentorshipService.create(any())).thenReturn(savedMentor);

Comment thread
dricazenck marked this conversation as resolved.
mockMvc
.perform(postRequest(API_MENTORS, requestWithId))
.andExpect(status().isCreated())
.andExpect(jsonPath("$.id").value(is(1)));
}
Comment thread
dricazenck marked this conversation as resolved.
}
Loading