akankshajain18 commented on a change in pull request #24:
URL:
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/24#discussion_r519573665
##########
File path:
src/test/java/org/apache/sling/resourceresolver/impl/mapping/MapEntriesTest.java
##########
@@ -2074,4 +2102,28 @@ public void run() {
}
}
}
+
+ @Test
+ public void testIsValidAliasPath() throws Exception {
+ Method method = MapEntries.class.getDeclaredMethod("isValidAliasPath",
String.class);
+ method.setAccessible(true);
+
+ // ignore system tree - path should not start with /jcr:system -
+ assertFalse((Boolean)method.invoke(mapEntries, "/jcr:system/node"));
+ //valid alias path
+ assertTrue((Boolean)method.invoke(mapEntries, "/parent"));
+ // notallowedparent is not valid configured alias path
+ assertFalse((Boolean)method.invoke(mapEntries, "/notallowedparent"));
+ }
+
+ @Test
+ public void testNullAliasPath() throws NoSuchMethodException,
IllegalAccessException {
Review comment:
isValidAliasPath() is private method. That' why reflection is used in
this test case.
The expected exception will be "InvocationTargetException", Inside catch
assert statement has been written
`catch (InvocationTargetException e){
assertEquals("Unexpected null path",
e.getTargetException().getMessage());
}`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]