kwin closed pull request #2: SLING-7744: Allow Setting Suffix Resource
URL: https://github.com/apache/sling-org-apache-sling-servlet-helpers/pull/2
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/src/main/java/org/apache/sling/servlethelpers/MockRequestPathInfo.java 
b/src/main/java/org/apache/sling/servlethelpers/MockRequestPathInfo.java
index d14034c..9179b94 100644
--- a/src/main/java/org/apache/sling/servlethelpers/MockRequestPathInfo.java
+++ b/src/main/java/org/apache/sling/servlethelpers/MockRequestPathInfo.java
@@ -33,6 +33,7 @@
     private String resourcePath;
     private String selectorString;
     private String suffix;
+    private Resource suffixResource;
 
     @Override
     public String getExtension() {
@@ -79,10 +80,13 @@ public void setSuffix(final String suffix) {
         this.suffix = suffix;
     }
 
-    // --- unsupported operations ---
+    public void setSuffixResource(final Resource suffixResource) {
+        this.suffixResource = suffixResource;
+    }
+
     @Override
     public Resource getSuffixResource() {
-        throw new UnsupportedOperationException();
+        return this.suffixResource;
     }
 
 }
diff --git 
a/src/test/java/org/apache/sling/servlethelpers/MockRequestPathInfoTest.java 
b/src/test/java/org/apache/sling/servlethelpers/MockRequestPathInfoTest.java
index 4a6b15b..15737a3 100644
--- a/src/test/java/org/apache/sling/servlethelpers/MockRequestPathInfoTest.java
+++ b/src/test/java/org/apache/sling/servlethelpers/MockRequestPathInfoTest.java
@@ -21,7 +21,10 @@
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.mockito.Mockito.mock;
 
+import org.apache.sling.api.resource.Resource;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -65,4 +68,12 @@ public void testSuffix() {
         assertEquals("/suffix", this.requestPathInfo.getSuffix());
     }
 
+    @Test
+    public void testSuffixResource() {
+        assertNull(this.requestPathInfo.getSuffixResource());
+        Resource mockResource = mock(Resource.class);
+        this.requestPathInfo.setSuffixResource(mockResource);
+        assertSame(mockResource, this.requestPathInfo.getSuffixResource());
+    }
+
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to