RemoLiechti commented on code in PR #57:
URL: 
https://github.com/apache/sling-org-apache-sling-engine/pull/57#discussion_r1990849497


##########
src/test/java/org/apache/sling/engine/impl/SlingHttpServletResponseImplTest.java:
##########
@@ -86,6 +88,24 @@ public class SlingHttpServletResponseImplTest {
         "4749 LOG Adding bindings took 4 microseconds"
     };
 
+    @Test
+    public void testNoViolationChecksOnCommitedResponse() throws IOException {
+        final SlingHttpServletResponse orig = 
Mockito.mock(SlingHttpServletResponse.class);
+        Mockito.when(orig.isCommitted()).thenReturn(true);
+
+        final RequestData requestData = mock(RequestData.class);
+        final DispatchingInfo info = new 
DispatchingInfo(DispatcherType.INCLUDE);
+        when(requestData.getDispatchingInfo()).thenReturn(info);
+        info.setProtectHeadersOnInclude(true);
+
+        final SlingHttpServletResponseImpl include = new 
SlingHttpServletResponseImpl(requestData, orig);
+        SlingHttpServletResponseImpl spyInclude = spy(include);
+
+        spyInclude.setContentType("someOtherType");
+        Mockito.verify(orig, atLeastOnce()).setContentType(Mockito.any());

Review Comment:
   thanks for spotting, I thought I put in once() but seems like VSCode then 
put the atLeastOnce instead, since Mockito uses times() for that...



-- 
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: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to