void () { SliceTreeStructure treeStructure = configureTree("DuplicateLeaves"); SliceRootNode root = treeStructure.getRootElement(); SliceLeafAnalyzer analyzer = JavaSlicerAnalysisUtil.createLeafAnalyzer(); Map<SliceNode, Collection<PsiElement>> map = analyzer.createMap(); Collection<PsiElement> leaves = analyzer.calcLeafExpressions(root, treeStructure, map); assertNotNull(leaves); assertEquals(1, leaves.size()); PsiElement leaf = leaves.iterator().next(); assertTrue(leaf instanceof PsiLiteralExpression); assertEquals("\"oo\"", leaf.getText()); SliceRootNode newRoot = analyzer.createTreeGroupedByValues(leaves, root, map); Collection<SliceNode> children = newRoot.getChildren(); assertEquals(1, children.size()); SliceNode child = children.iterator().next(); assertTrue(child instanceof SliceLeafValueRootNode); children = child.getChildren(); assertEquals(1, children.size()); child = children.iterator().next(); assertTrue(child.getValue().getElement() instanceof PsiField); children = child.getChildren(); child = assertOneElement(children); assertTrue(child.getValue().getElement() instanceof PsiReferenceExpression); children = child.getChildren(); child = assertOneElement(children); assertTrue(child.getValue().getElement() instanceof PsiParameter); children = child.getChildren(); child = assertOneElement(children); assertTrue(child.getValue().getElement() instanceof PsiReferenceExpression); children = child.getChildren(); child = assertOneElement(children); assertTrue(child.getValue().getElement() instanceof PsiParameter); children = child.getChildren(); child = assertOneElement(children); assertTrue(child.getValue().getElement() instanceof PsiLiteralExpression); assertEquals(child.getValue().getElement(), leaf); }