void () { SliceTreeStructure treeStructure = configureTree("DupSlice"); SliceNode root = treeStructure.getRootElement(); List<SliceNode> nodes = new ArrayList<>(); expandNodesTo(root, nodes); IntList hasDups = new IntArrayList(); for (SliceNode node : nodes) { if (node.getDuplicate() != null) { PsiElement element = node.getValue().getElement(); hasDups.add(element.getTextRange().getStartOffset()); assertTrue(element instanceof PsiParameter && "i".equals(((PsiParameter)element).getName()) || element instanceof PsiLiteralExpression); } } myFixture.type(" xx"); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); backspace(); backspace(); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); backspace(); backspace(); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); backspace(); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); nodes.clear(); expandNodesTo(root, nodes); for (SliceNode node : nodes) { if (node.getDuplicate() != null) { PsiElement element = node.getValue().getElement(); int offset = element.getTextRange().getStartOffset(); int i = hasDups.indexOf(offset); assertTrue(i != -1); hasDups.removeInt(i); assertTrue(element instanceof PsiParameter && "i".equals(((PsiParameter)element).getName()) || element instanceof PsiLiteralExpression); } } assertTrue(hasDups.isEmpty()); }