enapps-enorman opened a new pull request, #16:
URL: https://github.com/apache/sling-org-apache-sling-testing-jcr-mock/pull/16
The old MockNodeTypeManager implementation was mostly stubs and getNodeType
accepted all node types and return a partial mock. Any test code that was
exercising these mock node types would get an UnsupportedOperationException for
many of the apis which makes testing those code paths difficult.
Expected:
Provide a MockNodeTypeManager mode that (optionally) reads and registers the
node types from provided content in the compact node type definition format.
Doing this call would also change the mode of the MockNodeTypeManager to
consider only the registered node types. Tests for code paths that interact
with the node types can return more real details about the node type
definitions.
For example, the setup for test could do something like below to load the
nodetype definitions to use during the test run:
try (Reader reader = new
InputStreamReader(getClass().getResourceAsStream("test_nodetypes.cnd"))) {
MockJcr.loadNodeTypeDefs(this.session, reader);
}
NOTE: for backward compatibility, if no loadNodeTypeDefs call happens for
the session, then it will remain using the default permissive MOCK_ALL mode as
before.
--
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]