本文整理汇总了Java中com.intellij.testFramework.TestRunnerUtil类的典型用法代码示例。如果您正苦于以下问题:Java TestRunnerUtil类的具体用法?Java TestRunnerUtil怎么用?Java TestRunnerUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestRunnerUtil类属于com.intellij.testFramework包,在下文中一共展示了TestRunnerUtil类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldAddTestCase
import com.intellij.testFramework.TestRunnerUtil; //导入依赖的package包/类
private boolean shouldAddTestCase(final Class<?> testCaseClass, String moduleName, boolean testForExcluded) {
if ((testCaseClass.getModifiers() & Modifier.ABSTRACT) != 0) return false;
if (testForExcluded && shouldExcludeTestClass(moduleName, testCaseClass)) return false;
if (TestCase.class.isAssignableFrom(testCaseClass) || TestSuite.class.isAssignableFrom(testCaseClass)) {
return true;
}
try {
final Method suiteMethod = testCaseClass.getMethod("suite");
if (Test.class.isAssignableFrom(suiteMethod.getReturnType()) && (suiteMethod.getModifiers() & Modifier.STATIC) != 0) {
return true;
}
}
catch (NoSuchMethodException ignored) { }
return TestRunnerUtil.isJUnit4TestClass(testCaseClass);
}
示例2: shouldAddTestCase
import com.intellij.testFramework.TestRunnerUtil; //导入依赖的package包/类
/**
* Determine if we should load this test case.
*/
private boolean shouldAddTestCase(final Class<?> testCaseClass, boolean testForExcluded) {
if ((testCaseClass.getModifiers() & Modifier.ABSTRACT) != 0) return false;
if (testForExcluded && shouldExcludeTestClass(testCaseClass)) return false;
if (TestCase.class.isAssignableFrom(testCaseClass) || TestSuite.class.isAssignableFrom(testCaseClass)) {
return true;
}
try {
final Method suiteMethod = testCaseClass.getMethod("suite");
if (Test.class.isAssignableFrom(suiteMethod.getReturnType()) && (suiteMethod.getModifiers() & Modifier.STATIC) != 0) {
//System.out.println("testCaseClass = " + testCaseClass);
return true;
}
}
catch (NoSuchMethodException e) {
// can't be
}
return TestRunnerUtil.isJUnit4TestClass(testCaseClass);
}
示例3: testNothing
import com.intellij.testFramework.TestRunnerUtil; //导入依赖的package包/类
@SuppressWarnings("AssignmentToStaticFieldFromInstanceMethod")
public void testNothing() throws Exception {
if (nothingIsCalled) return;
nothingIsCalled = true;
suiteStarted = System.nanoTime();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
System.out.println("EDT is " + Thread.currentThread());
}
});
// in tests EDT inexplicably shuts down sometimes during the first access,
// which leads to nasty problems in ApplicationImpl which assumes there is only one EDT.
// so we try to forcibly terminate EDT here to urge JVM to re-spawn new shiny permanent EDT-1
TestRunnerUtil.replaceIdeEventQueueSafely();
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
System.out.println("EDT is " + Thread.currentThread());
}
});
// force platform JNA load
Class.forName("com.sun.jna.Native");
}
示例4: apply
import com.intellij.testFramework.TestRunnerUtil; //导入依赖的package包/类
@Override
public Statement apply(Statement base, Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
TestRunnerUtil.replaceIdeEventQueueSafely();
EdtTestUtil.runInEdtAndWait((ThrowableRunnable<Throwable>) base::evaluate);
}
};
}
示例5: setup
import com.intellij.testFramework.TestRunnerUtil; //导入依赖的package包/类
/** Sets up the container. */
@Before
public final void setup() {
// prevent memory leak error
TestRunnerUtil.replaceIdeEventQueueSafely();
Disposable disposableParent = TestUtils.createMockApplication();
applicationContainer =
(MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
project = TestUtils.mockProject(applicationContainer);
Extensions.cleanRootArea(disposableParent);
extensionsArea = (ExtensionsAreaImpl) Extensions.getRootArea();
}
示例6: runSetup
import com.intellij.testFramework.TestRunnerUtil; //导入依赖的package包/类
private void runSetup(ExtensionContext context) throws Exception {
if (runInDispatchThread()) {
TestRunnerUtil.replaceIdeEventQueueSafely();
EdtTestUtil.runInEdtAndWait(this::setUp);
} else {
setUp();
}
Store store = getStore(context);
store.put(Project.class, getProject());
store.put(Module.class, getModule());
}
示例7: isJUnitClass
import com.intellij.testFramework.TestRunnerUtil; //导入依赖的package包/类
private static boolean isJUnitClass(Class<?> clazz) {
return TestCase.class.isAssignableFrom(clazz) || TestRunnerUtil.isJUnit4TestClass(clazz) || com.intellij.testFramework.Parameterized.class.isAssignableFrom(clazz);
}
示例8: isJUnitClass
import com.intellij.testFramework.TestRunnerUtil; //导入依赖的package包/类
private static boolean isJUnitClass(Class<?> clazz) {
return TestCase.class.isAssignableFrom(clazz) || TestRunnerUtil.isJUnit4TestClass(clazz);
}