UserContext implements Context, UserConstants { @Override public boolean definesTree(@NotNull Tree tree) { String ntName = TreeUtil.getPrimaryTypeName(tree); return NT_NAMES.contains(ntName); } private  UserContext(); @Override boolean definesProperty(@NotNull Tree parent, @NotNull PropertyState property); @Override boolean definesContextRoot(@NotNull Tree tree); @Override boolean definesTree(@NotNull Tree tree); @Override boolean definesLocation(@NotNull TreeLocation location); @Override boolean definesInternal(@NotNull Tree tree);  }
@Test public void testDefinesTree() { for (String ntName : NT_NAMES) { assertTrue(ctx.definesTree(mockTree("anyName", ntName))); } }
@Test public void testEmptyNotDefinesTree() { TreeProvider treeProvider = new TreeProviderService(); assertFalse(ctx.definesTree(treeProvider.createReadOnlyTree(EmptyNodeState.EMPTY_NODE))); }
@Test public void testNotDefinesTree() { for (String ntName : new String[] { JcrConstants.NT_UNSTRUCTURED, JcrConstants.NT_BASE, NodeTypeConstants.NT_REP_SYSTEM, NodeTypeConstants.NT_REP_ROOT, NT_REP_AUTHORIZABLE_FOLDER}) { assertFalse(ctx.definesTree(mockTree("anyName", ntName))); } }