Details
-
Improvement
-
Status: Closed
-
Low
-
Resolution: Fixed
-
None
-
None
Description
Currently, MockNode#fromXml(String resourceName) is only supported with absolute resource name which should be starting with leading slash and fully qualified names.
However, in real unit tests, I think it would be more helpful if we support URL argument as well.
For example, a unit test can be written like this:
MockNode folderNode = MockNodeFactory.fromXml(getClass().getResource("testcontent1.xml"));
Node handleNode = folderNode.getNode("myarticle1");
As you can see, getClass().getResource(resourceName) seems very useful in many cases because you don't have to create the absolute resource name, but you can simply use the class context relative resource name there.