Cleanup FileStructureTestBase

This commit is contained in:
Alexander Zolotov
2014-12-01 19:58:03 +03:00
parent 8eee5b6333
commit 7b19d367a5
6 changed files with 38 additions and 43 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,20 +24,20 @@ public class JavaFileStructureFilteringTest extends JavaFileStructureTestCase {
return "filtering";
}
public void testSimple() throws Exception {checkTree("f");}
public void testReturnValue() throws Exception {checkTree("point");}
public void testAnonymousType() throws Exception {checkTree("point");}
public void testCamel() throws Exception {checkTree("sohe");}
public void testCamel2() throws Exception {checkTree("soHe");}
public void testSelectLeafFirst() throws Exception {checkTree("clear");}
public void testSelectLeafFirst2() throws Exception {checkTree("clear");}
public void testSelectLeafFirst3() throws Exception {checkTree("clear");}
public void testSelectLeafFirst4() throws Exception {checkTree("clear");}
public void testSimple() {checkTree("f");}
public void testReturnValue() {checkTree("point");}
public void testAnonymousType() {checkTree("point");}
public void testCamel() {checkTree("sohe");}
public void testCamel2() {checkTree("soHe");}
public void testSelectLeafFirst() {checkTree("clear");}
public void testSelectLeafFirst2() {checkTree("clear");}
public void testSelectLeafFirst3() {checkTree("clear");}
public void testSelectLeafFirst4() {checkTree("clear");}
public void testMatcher() throws Exception {checkTree("dis");}
public void testMatcher() {checkTree("dis");}
public void testMatcher1() throws Exception {checkTree("ico");}
public void testMatcher2() throws Exception {checkTree("ico");}
public void testMatcher1() {checkTree("ico");}
public void testMatcher2() {checkTree("ico");}
public void _testAnonymousMatcher2() throws Exception {checkTree("ico");} //http://youtrack.jetbrains.com/issue/IDEABKL-6906
public void _testAnonymousMatcher2() {checkTree("ico");} //http://youtrack.jetbrains.com/issue/IDEABKL-6906
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ public class JavaFileStructureHierarchyTest extends JavaFileStructureTestCase {
setShowParents(true);
}
public void testSimple() throws Exception {checkTree();}
public void testAnonymousAsConstantInInterface() throws Exception {checkTree("getA");}
public void testAnonymousHashCode() throws Exception {checkTree("hash");}
public void testSimple() {checkTree();}
public void testAnonymousAsConstantInInterface() {checkTree("getA");}
public void testAnonymousHashCode() {checkTree("hash");}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,10 +24,10 @@ public class JavaFileStructureSelectionTest extends JavaFileStructureTestCase {
return "selection";
}
public void testField() throws Exception {checkTree();}
public void testMethod() throws Exception {checkTree();}
public void testConstructor() throws Exception {checkTree();}
public void testInsideClass() throws Exception {checkTree();}
public void testAnonymous() throws Exception {checkTree();}
public void testAnonymousInAnonymous() throws Exception {checkTree();}
public void testField() {checkTree();}
public void testMethod() {checkTree();}
public void testConstructor() {checkTree();}
public void testInsideClass() {checkTree();}
public void testAnonymous() {checkTree();}
public void testAnonymousInAnonymous() {checkTree();}
}
@@ -28,7 +28,7 @@ import com.intellij.testFramework.IdeaTestCase;
*/
public abstract class JavaFileStructureTestCase extends FileStructureTestBase {
private boolean myShowAnonymousByDefault;
protected JavaFileStructureTestCase() {
IdeaTestCase.initPlatformPrefix();
}
@@ -49,12 +49,12 @@ public abstract class JavaFileStructureTestCase extends FileStructureTestBase {
return "java";
}
public void setShowAnonymous(boolean show) throws Exception {
public void setShowAnonymous(boolean show) {
myPopup.setTreeActionState(JavaAnonymousClassesNodeProvider.class, show);
update();
}
public void setShowParents(boolean show) throws Exception {
public void setShowParents(boolean show) {
myPopup.setTreeActionState(JavaInheritedMembersNodeProvider.class, show);
update();
}
@@ -19,18 +19,15 @@ import com.intellij.ide.actions.ViewStructureAction;
import com.intellij.ide.util.FileStructurePopup;
import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.ui.treeStructure.filtered.FilteringTreeBuilder;
import com.intellij.ui.treeStructure.filtered.FilteringTreeStructure;
import com.intellij.util.ui.tree.TreeUtil;
import org.junit.Assert;
import org.junit.Before;
import javax.swing.tree.TreePath;
import java.io.File;
/**
* @author Konstantin Bulenkov
@@ -67,7 +64,7 @@ public abstract class FileStructureTestBase extends CodeInsightFixtureTestCase {
return getFileName("tree");
}
protected void checkTree(String filter) throws Exception {
protected void checkTree(String filter) {
myPopup.setSearchFilterForTests(filter);
getBuilder().refilter(null, false, true);
getBuilder().queueUpdate();
@@ -75,17 +72,15 @@ public abstract class FileStructureTestBase extends CodeInsightFixtureTestCase {
checkTree();
}
protected void checkTree() throws Exception {
final String expected = FileUtil.loadFile(new File(getTestDataPath() + "/" + getTreeFileName()), true);
Assert.assertEquals(expected.trim(), PlatformTestUtil.print(getTree(), true).trim());
protected void checkTree() {
assertSameLinesWithFile(getTestDataPath() + "/" + getTreeFileName(), PlatformTestUtil.print(getTree(), true).trim());
}
public void update() throws InterruptedException {
public void update() {
myPopup.getTreeBuilder().refilter().doWhenProcessed(new Runnable() {
@Override
public void run() {
getStructure().rebuild();
updateTree();
getBuilder().updateFromRoot();
@@ -55,14 +55,14 @@ public class HtmlFileStructureTest extends FileStructureTestBase {
return true;
}
public void setHtml5OutlineMode(boolean enabled) throws Exception {
public void setHtml5OutlineMode(boolean enabled) {
myPopup.setTreeActionState(Html5SectionsNodeProvider.class, enabled);
update();
}
public void testEmpty() throws Exception {checkTree();}
public void testSimple() throws Exception {checkTree();}
public void testNoSectioningRoot() throws Exception {checkTree();}
public void testImplicitSections() throws Exception {checkTree();}
public void testMultipleRootTags() throws Exception {checkTree();}
public void testEmpty() {checkTree();}
public void testSimple() {checkTree();}
public void testNoSectioningRoot() {checkTree();}
public void testImplicitSections() {checkTree();}
public void testMultipleRootTags() {checkTree();}
}