@@ -80,8 +80,12 @@ static void classSetup() {
8080 void setup () {
8181 eventFactory = mock (ModifyAttachmentEventFactory .class );
8282 storageReader = mock (ThreadDataStorageReader .class );
83- cut = new CreateAttachmentsHandler (
84- eventFactory , storageReader , ModifyApplicationHandlerHelper .DEFAULT_SIZE_WITH_SCANNER );
83+ cut =
84+ new CreateAttachmentsHandler (
85+ eventFactory ,
86+ storageReader ,
87+ ModifyApplicationHandlerHelper .DEFAULT_SIZE_WITH_SCANNER ,
88+ runtime );
8589
8690 createContext = mock (CdsCreateEventContext .class );
8791 event = mock (ModifyAttachmentEvent .class );
@@ -335,7 +339,8 @@ void restoreError_proceedsSuccessfully_noException() {
335339 @ Test
336340 void restoreError_contentTooLargeWithMaxSize_throwsWithMaxSize () {
337341 var context = mock (EventContext .class );
338- var originalException = new ServiceException (ExtendedErrorStatuses .CONTENT_TOO_LARGE , "original message" );
342+ var originalException =
343+ new ServiceException (ExtendedErrorStatuses .CONTENT_TOO_LARGE , "original message" );
339344 doThrow (originalException ).when (context ).proceed ();
340345 when (context .get ("attachment.MaxSize" )).thenReturn ("10MB" );
341346
@@ -349,7 +354,8 @@ void restoreError_contentTooLargeWithMaxSize_throwsWithMaxSize() {
349354 @ Test
350355 void restoreError_contentTooLargeWithoutMaxSize_throwsWithoutMaxSize () {
351356 var context = mock (EventContext .class );
352- var originalException = new ServiceException (ExtendedErrorStatuses .CONTENT_TOO_LARGE , "original message" );
357+ var originalException =
358+ new ServiceException (ExtendedErrorStatuses .CONTENT_TOO_LARGE , "original message" );
353359 doThrow (originalException ).when (context ).proceed ();
354360 when (context .get ("attachment.MaxSize" )).thenReturn (null );
355361
@@ -386,14 +392,15 @@ void restoreError_methodHasCorrectAnnotations() throws NoSuchMethodException {
386392
387393 @ Test
388394 void processBeforeForMetadata_methodHasCorrectAnnotations () throws NoSuchMethodException {
389- Method method = cut .getClass ().getDeclaredMethod ("processBeforeForMetadata" , EventContext .class , List .class );
395+ Method method =
396+ cut .getClass ()
397+ .getDeclaredMethod ("processBeforeForMetadata" , EventContext .class , List .class );
390398
391399 Before beforeAnnotation = method .getAnnotation (Before .class );
392400 HandlerOrder handlerOrderAnnotation = method .getAnnotation (HandlerOrder .class );
393401
394402 assertThat (beforeAnnotation .event ())
395- .containsExactlyInAnyOrder (
396- CqnService .EVENT_CREATE , DraftService .EVENT_DRAFT_NEW );
403+ .containsExactlyInAnyOrder (CqnService .EVENT_CREATE , DraftService .EVENT_DRAFT_NEW );
397404 assertThat (handlerOrderAnnotation .value ()).isEqualTo (HandlerOrder .BEFORE );
398405 }
399406
@@ -404,13 +411,17 @@ void processBeforeForMetadata_executesValidation() {
404411 List <CdsData > data = List .of (mock (CdsData .class ));
405412 when (context .getTarget ()).thenReturn (entity );
406413
407- try (MockedStatic <ApplicationHandlerHelper > helper = mockStatic (ApplicationHandlerHelper .class )) {
408- helper .when (() -> ApplicationHandlerHelper .validateAcceptableMediaTypes (entity , data ))
414+ try (MockedStatic <ApplicationHandlerHelper > helper =
415+ mockStatic (ApplicationHandlerHelper .class )) {
416+ helper
417+ .when (() -> ApplicationHandlerHelper .validateAcceptableMediaTypes (entity , data , runtime ))
409418 .thenAnswer (invocation -> null );
410419 // when
411- new CreateAttachmentsHandler (eventFactory , storageReader , "400MB" ).processBeforeForMetadata (context , data );
420+ new CreateAttachmentsHandler (eventFactory , storageReader , "400MB" , runtime )
421+ .processBeforeForMetadata (context , data );
412422 // then
413- helper .verify (() -> ApplicationHandlerHelper .validateAcceptableMediaTypes (entity , data ));
423+ helper .verify (
424+ () -> ApplicationHandlerHelper .validateAcceptableMediaTypes (entity , data , runtime ));
414425 }
415426 }
416427
0 commit comments