CugUtil implements CugConstants { @Nullable static Tree getCug(@NotNull Tree tree) { Tree cugTree = (CugUtil.hasCug(tree)) ? tree.getChild(REP_CUG_POLICY) : null; if (cugTree != null && NT_REP_CUG_POLICY.equals(TreeUtil.getPrimaryTypeName(cugTree))) { return cugTree; } else { return null; } } private  CugUtil();   }
@Test public void testGetCug() throws Exception { assertNotNull(CugUtil.getCug(root.getTree(SUPPORTED_PATH))); for (String path : new String[] {PathUtils.ROOT_PATH, INVALID_PATH, UNSUPPORTED_PATH, SUPPORTED_PATH + "/subtree", SUPPORTED_PATH2, SUPPORTED_PATH3}) { assertNull(CugUtil.getCug(root.getTree(path))); } TreeUtil.addChild(root.getTree(SUPPORTED_PATH2), REP_CUG_POLICY, NodeTypeConstants.NT_OAK_UNSTRUCTURED); assertNull(CugUtil.getCug(root.getTree(SUPPORTED_PATH2))); }