test++
authorDmitry Jemerov <yole@intellij.com>
Fri, 11 Sep 2009 17:11:12 +0000 (21:11 +0400)
committerDmitry Jemerov <yole@intellij.com>
Fri, 11 Sep 2009 17:11:12 +0000 (21:11 +0400)
31 files changed:
java/java-tests/testData/dependencies/cycle/noCycle/com/a/A.java [moved from testData/dependencies/cycle/noCycle/com/a/A.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/noCycle/com/b/B.java [moved from testData/dependencies/cycle/noCycle/com/b/B.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/packageScope1/com/a/A.java [moved from testData/dependencies/cycle/packageScope1/com/a/A.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/packageScope1/com/b/B.java [moved from testData/dependencies/cycle/packageScope1/com/b/B.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/packageScope2/com/subscope1/a/A.java [moved from testData/dependencies/cycle/packageScope2/com/subscope1/a/A.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/packageScope2/com/subscope1/b/B.java [moved from testData/dependencies/cycle/packageScope2/com/subscope1/b/B.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/packageScope2/com/subscope2/c/C.java [moved from testData/dependencies/cycle/packageScope2/com/subscope2/c/C.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/packageScope2/com/subscope2/d/D.java [moved from testData/dependencies/cycle/packageScope2/com/subscope2/d/D.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t1/com/a/A.java [moved from testData/dependencies/cycle/t1/com/a/A.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t1/com/b/B.java [moved from testData/dependencies/cycle/t1/com/b/B.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t2/com/a/A.java [moved from testData/dependencies/cycle/t2/com/a/A.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t2/com/b/B.java [moved from testData/dependencies/cycle/t2/com/b/B.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t2/com/c/C.java [moved from testData/dependencies/cycle/t2/com/c/C.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t2/com/d/D.java [moved from testData/dependencies/cycle/t2/com/d/D.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t3/com/a/A.java [moved from testData/dependencies/cycle/t3/com/a/A.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t3/com/b/B.java [moved from testData/dependencies/cycle/t3/com/b/B.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t3/com/c/C.java [moved from testData/dependencies/cycle/t3/com/c/C.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t3/com/d/D.java [moved from testData/dependencies/cycle/t3/com/d/D.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t4/com/a/A.java [moved from testData/dependencies/cycle/t4/com/a/A.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t4/com/b/B.java [moved from testData/dependencies/cycle/t4/com/b/B.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t4/com/c/C.java [moved from testData/dependencies/cycle/t4/com/c/C.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t4/com/d/D.java [moved from testData/dependencies/cycle/t4/com/d/D.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t5/com/a/A.java [moved from testData/dependencies/cycle/t5/com/a/A.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t5/com/b/B.java [moved from testData/dependencies/cycle/t5/com/b/B.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t5/com/c/C.java [moved from testData/dependencies/cycle/t5/com/c/C.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t5/com/d/D.java [moved from testData/dependencies/cycle/t5/com/d/D.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t6/com/a/A.java [moved from testData/dependencies/cycle/t6/com/a/A.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t6/com/b/B1.java [moved from testData/dependencies/cycle/t6/com/b/B1.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t6/com/b/B2.java [moved from testData/dependencies/cycle/t6/com/b/B2.java with 100% similarity]
java/java-tests/testData/dependencies/cycle/t6/com/c/C.java [moved from testData/dependencies/cycle/t6/com/c/C.java with 100% similarity]
java/java-tests/testSrc/com/intellij/dependencies/CyclicDependenciesTest.java [moved from idea-tests/src/com/intellij/dependencies/CyclicDependenciesTest.java with 89% similarity]

similarity index 89%
rename from idea-tests/src/com/intellij/dependencies/CyclicDependenciesTest.java
rename to java/java-tests/testSrc/com/intellij/dependencies/CyclicDependenciesTest.java
index c21af8201238c37f4bb594a7d717fa35aa7481e7..17b27fabe46a8f2393a8b6f64f80400e260d3c1e 100644 (file)
@@ -1,10 +1,10 @@
 package com.intellij.dependencies;
 
+import com.intellij.JavaTestUtil;
 import com.intellij.analysis.AnalysisScope;
 import com.intellij.analysis.JavaAnalysisScope;
 import com.intellij.cyclicDependencies.CyclicDependenciesBuilder;
 import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.ex.PathManagerEx;
 import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
 import com.intellij.psi.JavaPsiFacade;
 import com.intellij.psi.PsiPackage;
@@ -24,7 +24,7 @@ public class CyclicDependenciesTest extends PsiTestCase {
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
       public void run() {
         try {
-          String root = PathManagerEx.getTestDataPath() + "/dependencies/cycle/" + getTestName(true);
+          String root = JavaTestUtil.getJavaTestDataPath() + "/dependencies/cycle/" + getTestName(true);
           PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk("java 1.4"));
           PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
         }
@@ -162,11 +162,10 @@ public class CyclicDependenciesTest extends PsiTestCase {
     checkResult(expected, cyclicDependencies, true);
   }
 
-  private void checkResult(HashMap<String, String[][]> expected, HashMap<PsiPackage, Set<List<PsiPackage>>> cycles) {
+  private static void checkResult(HashMap<String, String[][]> expected, HashMap<PsiPackage, Set<List<PsiPackage>>> cycles) {
     assertEquals(expected.size(), cycles.size());
     Iterator<PsiPackage> it = cycles.keySet().iterator();
-    for (Iterator<String> iterator = expected.keySet().iterator(); iterator.hasNext();) {
-      final String packs = iterator.next();
+    for (final String packs : expected.keySet()) {
       final PsiPackage psiPackage = it.next();
       assertEquals(packs, psiPackage.getQualifiedName());
       assertEquals(expected.get(packs).length, cycles.get(psiPackage).size());
@@ -176,8 +175,7 @@ public class CyclicDependenciesTest extends PsiTestCase {
         final List<PsiPackage> cycle = iC.next();
         assertEquals(expectedCycle.length, cycle.size());
         Iterator<PsiPackage> iCycle = cycle.iterator();
-        for (int j = 0; j < expectedCycle.length; j++) {
-          final String expectedInCycle = expectedCycle[j];
+        for (final String expectedInCycle : expectedCycle) {
           final PsiPackage packageInCycle = iCycle.next();
           assertEquals(expectedInCycle, packageInCycle.getQualifiedName());
         }
@@ -185,22 +183,19 @@ public class CyclicDependenciesTest extends PsiTestCase {
     }
   }
 
-  private void checkResult(HashMap<String, String[][]> expected, HashMap<PsiPackage, Set<List<PsiPackage>>> cycles, boolean forceContains){
+  private static void checkResult(HashMap<String, String[][]> expected, HashMap<PsiPackage, Set<List<PsiPackage>>> cycles, boolean forceContains){
     assertEquals(expected.size(), cycles.size());
-    for (Iterator<PsiPackage> iterator = cycles.keySet().iterator(); iterator.hasNext();) {
-      final PsiPackage psiPackage = iterator.next();
+    for (final PsiPackage psiPackage : cycles.keySet()) {
       assertTrue(expected.containsKey(psiPackage.getQualifiedName()));
       final String packs = psiPackage.getQualifiedName();
-      if (forceContains){
+      if (forceContains) {
         assertEquals(expected.get(packs).length, cycles.get(psiPackage).size());
       }
-      for (Iterator<List<PsiPackage>> iC = cycles.get(psiPackage).iterator(); iC.hasNext();) {
-        final List<PsiPackage> cycle = iC.next();
+      for (final List<PsiPackage> cycle : cycles.get(psiPackage)) {
         final String[][] expectedCycles = expected.get(packs);
-        final String [] string = new String[cycle.size()];
+        final String[] string = new String[cycle.size()];
         int i = 0;
-        for (Iterator<PsiPackage> iCycle = cycle.iterator(); iCycle.hasNext();) {
-          final PsiPackage packageInCycle = iCycle.next();
+        for (final PsiPackage packageInCycle : cycle) {
           string[i++] = packageInCycle.getQualifiedName();
         }
         assertTrue(findInMatrix(expectedCycles, string) > -1);