From 4c3aa159c5d9f0ece743ee6a786357cb401f7a21 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 28 Apr 2026 23:03:00 +0200 Subject: [PATCH] test(transcription): add updateBlock 400 test for null personId in mention createBlock has both validation guards (displayName length + personId null). updateBlock had only the displayName test. Add the symmetric null-personId case so a future @Valid drop from updateBlock's @RequestBody would be caught. Co-Authored-By: Claude Sonnet 4.6 --- .../TranscriptionBlockControllerTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backend/src/test/java/org/raddatz/familienarchiv/controller/TranscriptionBlockControllerTest.java b/backend/src/test/java/org/raddatz/familienarchiv/controller/TranscriptionBlockControllerTest.java index 0d39884a..bed7ff8f 100644 --- a/backend/src/test/java/org/raddatz/familienarchiv/controller/TranscriptionBlockControllerTest.java +++ b/backend/src/test/java/org/raddatz/familienarchiv/controller/TranscriptionBlockControllerTest.java @@ -266,6 +266,19 @@ class TranscriptionBlockControllerTest { .andExpect(jsonPath("$.code").value("VALIDATION_ERROR")); } + @Test + @WithMockUser(authorities = "WRITE_ALL") + void updateBlock_returns400_whenMentionedPersonPersonIdIsNull() throws Exception { + when(userService.findByEmail(any())).thenReturn(mockUser()); + String body = "{\"text\":\"x\",\"mentionedPersons\":[{\"personId\":null,\"displayName\":\"Auguste Raddatz\"}]}"; + + mockMvc.perform(put(URL_BLOCK) + .contentType(MediaType.APPLICATION_JSON) + .content(body)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.code").value("VALIDATION_ERROR")); + } + @Test @WithMockUser(authorities = "WRITE_ALL") void updateBlock_returns404_whenBlockDoesNotExist() throws Exception {