CugUtil implements CugConstants { static boolean hasCug(@NotNull Tree tree) { return tree.exists() && tree.hasChild(REP_CUG_POLICY); } private  CugUtil();   }
@Test public void testHasCug() throws Exception { assertTrue(CugUtil.hasCug(root.getTree(SUPPORTED_PATH))); for (String path : new String[] {PathUtils.ROOT_PATH, INVALID_PATH, UNSUPPORTED_PATH, SUPPORTED_PATH + "/subtree", SUPPORTED_PATH2, SUPPORTED_PATH3}) { assertFalse(CugUtil.hasCug(root.getTree(path))); } Tree t = root.getTree(SUPPORTED_PATH2); TreeUtil.addChild(t, REP_CUG_POLICY, NodeTypeConstants.NT_OAK_UNSTRUCTURED); assertTrue(CugUtil.hasCug(t)); }
@Test public void testHasCugNodeState() throws Exception { assertTrue(CugUtil.hasCug(getNodeState(root.getTree(SUPPORTED_PATH)))); assertFalse(CugUtil.hasCug((NodeState) null)); for (String path : new String[] {PathUtils.ROOT_PATH, INVALID_PATH, UNSUPPORTED_PATH, SUPPORTED_PATH + "/subtree", SUPPORTED_PATH2, SUPPORTED_PATH3}) { assertFalse(CugUtil.hasCug(getNodeState(root.getTree(path)))); } TreeUtil.addChild(root.getTree(SUPPORTED_PATH2), REP_CUG_POLICY, NodeTypeConstants.NT_OAK_UNSTRUCTURED); assertTrue(CugUtil.hasCug(getNodeState(root.getTree(SUPPORTED_PATH2)))); }
@Test public void testHasCugNodeBuilder() throws Exception { assertTrue(CugUtil.hasCug(getNodeState(root.getTree(SUPPORTED_PATH)).builder())); assertFalse(CugUtil.hasCug((NodeBuilder) null)); for (String path : new String[] {PathUtils.ROOT_PATH, INVALID_PATH, UNSUPPORTED_PATH, SUPPORTED_PATH + "/subtree", SUPPORTED_PATH2, SUPPORTED_PATH3}) { assertFalse(CugUtil.hasCug(getNodeState(root.getTree(path)).builder())); } TreeUtil.addChild(root.getTree(SUPPORTED_PATH2), REP_CUG_POLICY, NodeTypeConstants.NT_OAK_UNSTRUCTURED); assertTrue(CugUtil.hasCug(getNodeState(root.getTree(SUPPORTED_PATH2)).builder())); }