@@ -163,7 +163,7 @@ void downloadTranscript_shouldReturn401Error_whenUserNotFound() throws Exception
163163 }
164164
165165 @ Test
166- void downloadTranscriptShouldReturnNotFoundError () throws Exception {
166+ void downloadTranscript_ShouldReturnNotFoundError () throws Exception {
167167 MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders .get (URL_TEMPLATE , transcriptionId )
168168 .header (
169169 "accept" ,
@@ -185,7 +185,7 @@ void downloadTranscriptShouldReturnNotFoundError() throws Exception {
185185 }
186186
187187 @ Test
188- void downloadTranscriptShouldReturnOkWithMicrosoftWordNew () throws Exception {
188+ void downloadTranscript_ShouldReturnOk_WithMicrosoftWordNew () throws Exception {
189189 final String fileName = "Test Document.docx" ;
190190 final String fileType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ;
191191 final int fileSize = 11_937 ;
@@ -257,7 +257,7 @@ void downloadTranscriptShouldReturnOkWithMicrosoftWordNew() throws Exception {
257257
258258 @ Test
259259 @ SuppressWarnings ("PMD.CloseResource" )
260- void downloadTranscriptShouldReturnOkWithMicrosoftWordOld () throws Exception {
260+ void downloadTranscript_ShouldReturnOk_WithMicrosoftWordOld () throws Exception {
261261 final String fileName = "Test Document.doc" ;
262262 final String fileType = "application/msword" ;
263263 final int fileSize = 22_528 ;
@@ -319,4 +319,25 @@ void downloadTranscriptShouldReturnOkWithMicrosoftWordOld() throws Exception {
319319 verifyNoMoreInteractions (mockAuditApi , mockDataManagementFacade , mockFileBasedDownloadResponseMetaData );
320320 }
321321
322+ @ Test
323+ void downloadTranscript_ShouldReturnError_WhenNegativeTranscriptionIdUsed () throws Exception {
324+ MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders .get ("/transcriptions/-123/document" )
325+ .header (
326+ "accept" ,
327+ "application/msword" ,
328+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
329+ );
330+ MvcResult mvcResult = mockMvc .perform (requestBuilder )
331+ .andExpect (status ().isNotFound ())
332+ .andReturn ();
333+
334+ String actualResponse = mvcResult .getResponse ().getContentAsString ();
335+
336+ String expectedResponse = """
337+ {"type":"TRANSCRIPTION_101","title":"The requested transcription cannot be found","status":404}
338+ """ ;
339+ JSONAssert .assertEquals (expectedResponse , actualResponse , JSONCompareMode .NON_EXTENSIBLE );
340+
341+ verifyNoInteractions (mockAuditApi );
342+ }
322343}
0 commit comments