pedrosans commented on code in PR #1581:
URL: https://github.com/apache/wicket/pull/1581#discussion_r3960542884


##########
wicket-core-tests/src/test/java/org/apache/wicket/csp/CSPHeaderWriterTest.java:
##########
@@ -115,6 +123,53 @@ void addCspDirectiveToStatelessPageAfterNoRedirect()
                        STYLE_SRC.getValue());
        }
 
+       @Test
+       void 
addCspDirectiveToStatelessPageEvenIfWrappedInMultipleIRequestHandlerDelegates()
+       {
+               tester.getApplication().mount(new 
MountedMapper("withdelegate/page", NoopMockPage.class)
+               {
+                       @Override
+                       public IRequestHandler mapRequest(final Request request)
+                       {
+                               final IRequestHandler requestHandler = 
super.mapRequest(request);
+                               final IRequestHandler result;
+                               if (requestHandler instanceof 
RenderPageRequestHandler renderPageRequestHandler && 
NoopMockPage.class.equals(renderPageRequestHandler.getPageClass()))

Review Comment:
   Hi, thank you for the PR. I think the test could be simplified by:
   - just testing if requestHandler is != null. if so, it's ok to add wrap it 
two time.
   - if null, it's ok to just return
   - Page can be used instead of NoopMockPage



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to