catalinadumitruu commented on code in PR #10:
URL:
https://github.com/apache/sling-org-apache-sling-testing-jcr-mock/pull/10#discussion_r1113484408
##########
src/main/java/org/apache/sling/testing/mock/jcr/MockNode.java:
##########
@@ -368,8 +372,26 @@ public boolean equals(Object obj) {
@Override
public NodeType[] getMixinNodeTypes() throws RepositoryException {
- // we have no real mixin support - just assume no mixin nodetypes are
set
- return new NodeType[0];
+ Value[] mixinNames =
getProperty(JcrConstants.JCR_MIXINTYPES).getValues();
+
+ return Arrays.stream(mixinNames)
+ .map(value -> {
+ try {
+ return value.getString();
+ } catch (RepositoryException e) {
+ return new NodeType[0];
+ }
+ })
+ .filter(Objects::nonNull)
+ .map(name -> {
+ try {
+ return
getSession().getWorkspace().getNodeTypeManager().getNodeType(name.toString());
+ } catch (RepositoryException e) {
+ return new NodeType[0];
Review Comment:
I more inclined to return an empty array because it is a mock implementation
and it is safer to not return null and cause errors, but it is your call :)
--
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]