test(transcription): mirror displayName length-cap regression on PUT endpoint
Sara #4 (PR #366 review). The 400-on-201-chars regression guard previously only covered POST /api/documents/{id}/transcription-blocks. The same @Valid cascade applies to PUT /api/documents/{id}/transcription-blocks/{blockId} via UpdateTranscriptionBlockDTO, but no test asserted it — meaning a silent removal of @Valid on the PUT @RequestBody parameter would slip past CI. Mirror the test for symmetry. Refs #362 #366 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -251,6 +251,21 @@ class TranscriptionBlockControllerTest {
|
|||||||
.andExpect(jsonPath("$.label").value("Anrede"));
|
.andExpect(jsonPath("$.label").value("Anrede"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@WithMockUser(authorities = "WRITE_ALL")
|
||||||
|
void updateBlock_returns400_whenMentionedPersonDisplayNameExceeds200Chars() throws Exception {
|
||||||
|
when(userService.findByEmail(any())).thenReturn(mockUser());
|
||||||
|
String longName = "A".repeat(201);
|
||||||
|
String body = "{\"text\":\"x\",\"mentionedPersons\":[{\"personId\":\""
|
||||||
|
+ UUID.randomUUID() + "\",\"displayName\":\"" + longName + "\"}]}";
|
||||||
|
|
||||||
|
mockMvc.perform(put(URL_BLOCK)
|
||||||
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
|
.content(body))
|
||||||
|
.andExpect(status().isBadRequest())
|
||||||
|
.andExpect(jsonPath("$.code").value("VALIDATION_ERROR"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@WithMockUser(authorities = "WRITE_ALL")
|
@WithMockUser(authorities = "WRITE_ALL")
|
||||||
void updateBlock_returns404_whenBlockDoesNotExist() throws Exception {
|
void updateBlock_returns404_whenBlockDoesNotExist() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user