當前位置: 首頁>>代碼示例>>Java>>正文


Java Assertion類代碼示例

本文整理匯總了Java中com.intellij.util.Assertion的典型用法代碼示例。如果您正苦於以下問題:Java Assertion類的具體用法?Java Assertion怎麽用?Java Assertion使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Assertion類屬於com.intellij.util包,在下文中一共展示了Assertion類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testRunningAllInPackage

import com.intellij.util.Assertion; //導入依賴的package包/類
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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:ConfigurationsTest.java

示例2: testCreateConfiguration

import com.intellij.util.Assertion; //導入依賴的package包/類
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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:ConfigurationsTest.java


注:本文中的com.intellij.util.Assertion類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。