本文整理匯總了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);
}
示例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);
}