Java 类com.intellij.util.Assertion 实例源码

项目:intellij-ce-playground    文件:ConfigurationsTest.java   
public void testRunningAllInPackage() throws IOException, ExecutionException {
  Module module1 = getModule1();
  GlobalSearchScope module1AndLibraries = GlobalSearchScope.moduleWithLibrariesScope(module1);
  PsiClass testCase = findClass(TestCase.class.getName(), module1AndLibraries);
  PsiClass psiClass = findTestA(module1);
  PsiClass psiClass2 = findTestA(getModule2());
  PsiClass derivedTest = findClass(module1, "test1.DerivedTest");
  PsiClass baseTestCase = findClass("junit.framework.ThirdPartyClass", module1AndLibraries);
  PsiClass testB = findClass(getModule3(), "test1.TestB");
  assertNotNull(testCase);
  assertNotNull(derivedTest);
  assertNotNull(psiClass);
  assertTrue(psiClass.isInheritor(testCase, false));
  assertEquals(baseTestCase, derivedTest.getSuperClass());
  assertTrue(baseTestCase.isInheritor(testCase, true));
  assertTrue(derivedTest.isInheritor(testCase, true));
  PsiPackage psiPackage = JUnitUtil.getContainingPackage(psiClass);
  JUnitConfiguration configuration = createConfiguration(psiPackage, module1);
  JavaParameters parameters = checkCanRun(configuration);
  List<String> lines = extractAllInPackageTests(parameters, psiPackage);
  Assertion.compareUnordered(
    new Object[]{"", psiClass.getQualifiedName(), psiClass2.getQualifiedName(), derivedTest.getQualifiedName(), RT_INNER_TEST_NAME,
      testB.getQualifiedName()},
    lines);
}
项目:intellij-ce-playground    文件:ConfigurationsTest.java   
public void testCreateConfiguration() throws IOException, ExecutionException {
  Module module1 = getModule1();
  PsiClass psiClass = findTestA(module1);
  JUnitConfiguration configuration = createConfiguration(psiClass);
  assertEquals(Collections.singleton(module1), ContainerUtilRt.newHashSet(configuration.getModules()));
  checkClassName(psiClass.getQualifiedName(), configuration);
  assertEquals(psiClass.getName(), configuration.getName());
  checkTestObject(JUnitConfiguration.TEST_CLASS, configuration);
  Module module2 = getModule2();
  Assertion.compareUnordered(new Module[]{module1, module2}, configuration.getValidModules());

  PsiClass innerTest = findClass(module1, INNER_TEST_NAME);
  configuration = createJUnitConfiguration(innerTest, TestClassConfigurationProducer.class, new MapDataContext());
  checkClassName(RT_INNER_TEST_NAME, configuration);
  checkCanRun(configuration);

  PsiMethod[] testMethod = innerTest.findMethodsByName("test", false);
  assertEquals(1, testMethod.length);
  configuration = createConfiguration(testMethod[0]);
  checkClassName(RT_INNER_TEST_NAME, configuration);
  checkMethodName("test", configuration);
  checkTestObject(JUnitConfiguration.TEST_METHOD, configuration);
  checkCanRun(configuration);

  PsiMethod mainMethod = innerTest.findMethodsByName("main", false)[0];
  ApplicationConfiguration appConfiguration = createConfiguration(mainMethod);
  assertEquals(RT_INNER_TEST_NAME, appConfiguration.MAIN_CLASS_NAME);
  checkCanRun(configuration);
}