Java Code Examples for org.junit.runners.Suite

The following are top voted examples for showing how to use org.junit.runners.Suite. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: willtest   File: SuiteGeneratingRunListener.java   View source code 6 votes vote down vote up
@Override
public void testRunFinished(Result result) throws Exception {
    super.testRunFinished(result);
    JCodeModel codeModel = new JCodeModel();
    JDefinedClass resultClass = codeModel._class(getSuiteClassName());
    JClass suiteClazz = codeModel.ref(Suite.class);
    resultClass.annotate(RunWith.class).param(VALUE_PARAM, suiteClazz);

    JClass suiteClasses = codeModel.ref(Suite.SuiteClasses.class);

    JAnnotationArrayMember testClassArray = resultClass.annotate(suiteClasses).paramArray(VALUE_PARAM);

    testClassesAndTheirTests.keySet().forEach(className -> addClassToSuite(codeModel, testClassArray, className));

    resultClass.javadoc().add(getJavaDocComment());

    File file = new File(getTargetDirectory());
    if ( !file.exists() && !file.mkdirs() ) {
        throw new RuntimeException("Cannot create folder " + file.getAbsolutePath());
    }
    codeModel.build(file);
}
 
Example 2
Project: ditb   File: ClassTestFinder.java   View source code 6 votes vote down vote up
private boolean isTestClass(Class<?> c) {
  if (Modifier.isAbstract(c.getModifiers())) {
    return false;
  }

  if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
    return true;
  }

  for (Method met : c.getMethods()) {
    if (met.getAnnotation(Test.class) != null) {
      return true;
    }
  }

  return false;
}
 
Example 3
Project: core-doppl   File: DopplJunitTestHelper.java   View source code 6 votes vote down vote up
/**
 * @return true if {@param cls} is {@link JUnit4} annotated.
 */
protected boolean isJUnit4TestClass(Class cls) {
    // Need to find test classes, otherwise crashes with b/11790448.
    if (!cls.getName().endsWith("Test")) {
        return false;
    }
    // Check the annotations.
    Annotation annotation = cls.getAnnotation(RunWith.class);
    if (annotation != null) {
        RunWith runWith = (RunWith) annotation;
        Object value = runWith.value();
        if (value.equals(JUnit4.class) || value.equals(Suite.class)) {
            return true;
        }
    }
    return false;
}
 
Example 4
Project: LCIndex-HBase-0.94.16   File: ClassTestFinder.java   View source code 6 votes vote down vote up
private boolean isTestClass(Class<?> c) {
  if (Modifier.isAbstract(c.getModifiers())) {
    return false;
  }

  if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
    return true;
  }

  for (Method met : c.getMethods()) {
    if (met.getAnnotation(Test.class) != null) {
      return true;
    }
  }

  return false;
}
 
Example 5
Project: pbase   File: ClassTestFinder.java   View source code 6 votes vote down vote up
private boolean isTestClass(Class<?> c) {
  if (Modifier.isAbstract(c.getModifiers())) {
    return false;
  }

  if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
    return true;
  }

  for (Method met : c.getMethods()) {
    if (met.getAnnotation(Test.class) != null) {
      return true;
    }
  }

  return false;
}
 
Example 6
Project: cloudera-framework   File: CdhServer.java   View source code 6 votes vote down vote up
@SuppressWarnings({"rawtypes", "LoopStatementThatDoesntLoop"})
private boolean assertTestRunner(String testClass) {
  try {
    RunWith runWith = Class.forName(testClass).getAnnotation(RunWith.class);
    if (runWith == null) {
      throw new RuntimeException("Missing [@" + RunWith.class.getCanonicalName() + "(" + TestRunner.class.getCanonicalName()
        + ".class)] on class [" + testClass + "]");
    }
    if (runWith.value().equals(Suite.class)) {
      SuiteClasses suiteClasses = Class.forName(testClass).getAnnotation(SuiteClasses.class);
      for (Class suiteTestClass : suiteClasses.value()) {
        return assertTestRunner(suiteTestClass.getCanonicalName());
      }
    } else if (!runWith.value().equals(TestRunner.class)) {
      throw new RuntimeException("Unsupported run with [" + runWith.value().getCanonicalName() + "] on class [" + testClass + "]");
    }
  } catch (Exception exception) {
    String message = "The test [" + testClass + "] included a rule [" + getClass().getCanonicalName() + "] but did not include a [@"
      + RunWith.class.getCanonicalName() + "(" + TestRunner.class.getCanonicalName() + ".class)] class annotation";
    if (LOG.isErrorEnabled()) {
      LOG.error(message, exception);
    }
    throw new RuntimeException(message, exception);
  }
  return true;
}
 
Example 7
Project: squidb   File: SquidbTestRunner.java   View source code 6 votes vote down vote up
/**
 * @return true if {@param cls} is {@link JUnit4} annotated.
 */
protected boolean isJUnit4TestClass(Class cls) {
    // Need to find test classes, otherwise crashes with b/11790448.
    if (!cls.getName().endsWith("Test")) {
        return false;
    }
    // Check the annotations.
    Annotation annotation = cls.getAnnotation(RunWith.class);
    if (annotation != null) {
        RunWith runWith = (RunWith) annotation;
        Object value = runWith.value();
        if (value.equals(JUnit4.class) || value.equals(Suite.class)) {
            return true;
        }
    }
    return false;
}
 
Example 8
Project: HIndex   File: ClassTestFinder.java   View source code 6 votes vote down vote up
private boolean isTestClass(Class<?> c) {
  if (Modifier.isAbstract(c.getModifiers())) {
    return false;
  }

  if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
    return true;
  }

  for (Method met : c.getMethods()) {
    if (met.getAnnotation(Test.class) != null) {
      return true;
    }
  }

  return false;
}
 
Example 9
Project: effektif   File: TestSuiteHelper.java   View source code 6 votes vote down vote up
public static void run(Configuration configuration, Class<?> clazz, String methodName) {
  try {
    Request request = null;
    if (clazz!=null && methodName!=null) {
      request = Request.method(clazz, methodName);
    } else {
      Suite suite = new Suite(new JUnit4Builder(), API_TEST_CLASSES);
      request = Request.runner(suite);
    }
    
    Configuration originalConfiguration = WorkflowTest.cachedConfiguration;
    WorkflowTest.cachedConfiguration = configuration;

    JUnitCore junitCore = new JUnitCore();
    Result result = junitCore.run(request);

    WorkflowTest.cachedConfiguration = originalConfiguration;
    
    checkResult(result);

  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
 
Example 10
Project: IRIndex   File: ClassTestFinder.java   View source code 6 votes vote down vote up
private boolean isTestClass(Class<?> c) {
  if (Modifier.isAbstract(c.getModifiers())) {
    return false;
  }

  if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
    return true;
  }

  for (Method met : c.getMethods()) {
    if (met.getAnnotation(Test.class) != null) {
      return true;
    }
  }

  return false;
}
 
Example 11
Project: sosiefier   File: MaxCore.java   View source code 6 votes vote down vote up
private Request constructLeafRequest(List<Description> leaves) {
    final List<Runner> runners = new ArrayList<Runner>();
    for (Description each : leaves) {
        runners.add(buildRunner(each));
    }
    return new Request() {
        @Override
        public Runner getRunner() {
            try {
                return new Suite((Class<?>) null, runners) {
                };
            } catch (InitializationError e) {
                return new ErrorReportingRunner(null, e);
            }
        }
    };
}
 
Example 12
Project: sosiefier   File: MaxCore.java   View source code 6 votes vote down vote up
private Runner buildRunner(Description each) {
    if (each.toString().equals("TestSuite with 0 tests")) {
        return Suite.emptySuite();
    }
    if (each.toString().startsWith(MALFORMED_JUNIT_3_TEST_CLASS_PREFIX)) {
        // This is cheating, because it runs the whole class
        // to get the warning for this method, but we can't do better,
        // because JUnit 3.8's
        // thrown away which method the warning is for.
        return new JUnit38ClassRunner(new TestSuite(getMalformedTestClass(each)));
    }
    Class<?> type = each.getTestClass();
    if (type == null) {
        throw new RuntimeException("Can't locate a runner from description [" + each + "]");
    }
    String methodName = each.getMethodName();
    if (methodName == null) {
        return Request.aClass(type).getRunner();
    }
    return Request.method(type, methodName).getRunner();
}
 
Example 13
Project: hbase   File: ClassTestFinder.java   View source code 6 votes vote down vote up
private boolean isTestClass(Class<?> c) {
  if (Modifier.isAbstract(c.getModifiers())) {
    return false;
  }

  if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
    return true;
  }

  for (Method met : c.getMethods()) {
    if (met.getAnnotation(Test.class) != null) {
      return true;
    }
  }

  return false;
}
 
Example 14
Project: PyroDB   File: ClassTestFinder.java   View source code 6 votes vote down vote up
private boolean isTestClass(Class<?> c) {
  if (Modifier.isAbstract(c.getModifiers())) {
    return false;
  }

  if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
    return true;
  }

  for (Method met : c.getMethods()) {
    if (met.getAnnotation(Test.class) != null) {
      return true;
    }
  }

  return false;
}
 
Example 15
Project: c5   File: ClassTestFinder.java   View source code 6 votes vote down vote up
private boolean isTestClass(Class<?> c) {
  if (Modifier.isAbstract(c.getModifiers())) {
    return false;
  }

  if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
    return true;
  }

  for (Method met : c.getMethods()) {
    if (met.getAnnotation(Test.class) != null) {
      return true;
    }
  }

  return false;
}
 
Example 16
Project: lcm   File: MaxCore.java   View source code 6 votes vote down vote up
private Request constructLeafRequest(List<Description> leaves) {
    final List<Runner> runners = new ArrayList<Runner>();
    for (Description each : leaves) {
        runners.add(buildRunner(each));
    }
    return new Request() {
        @Override
        public Runner getRunner() {
            try {
                return new Suite((Class<?>) null, runners) {
                };
            } catch (InitializationError e) {
                return new ErrorReportingRunner(null, e);
            }
        }
    };
}
 
Example 17
Project: lcm   File: MaxCore.java   View source code 6 votes vote down vote up
private Runner buildRunner(Description each) {
    if (each.toString().equals("TestSuite with 0 tests")) {
        return Suite.emptySuite();
    }
    if (each.toString().startsWith(MALFORMED_JUNIT_3_TEST_CLASS_PREFIX)) {
        // This is cheating, because it runs the whole class
        // to get the warning for this method, but we can't do better,
        // because JUnit 3.8's
        // thrown away which method the warning is for.
        return new JUnit38ClassRunner(new TestSuite(getMalformedTestClass(each)));
    }
    Class<?> type = each.getTestClass();
    if (type == null) {
        throw new RuntimeException("Can't build a runner from description [" + each + "]");
    }
    String methodName = each.getMethodName();
    if (methodName == null) {
        return Request.aClass(type).getRunner();
    }
    return Request.method(type, methodName).getRunner();
}
 
Example 18
Project: effektif   File: TestSuiteHelper.java   View source code 6 votes vote down vote up
public static void run(Configuration configuration, Class<?> clazz, String methodName) {
  try {
    Request request = null;
    if (clazz!=null && methodName!=null) {
      request = Request.method(clazz, methodName);
    } else {
      Suite suite = new Suite(new JUnit4Builder(), API_TEST_CLASSES);
      request = Request.runner(suite);
    }
    
    Configuration originalConfiguration = WorkflowTest.cachedConfiguration;
    WorkflowTest.cachedConfiguration = configuration;

    JUnitCore junitCore = new JUnitCore();
    Result result = junitCore.run(request);

    WorkflowTest.cachedConfiguration = originalConfiguration;
    
    checkResult(result);

  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
 
Example 19
Project: HBase-Research   File: ClassTestFinder.java   View source code 6 votes vote down vote up
private boolean isTestClass(Class<?> c) {
  if (Modifier.isAbstract(c.getModifiers())) {
    return false;
  }

  if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
    return true;
  }

  for (Method met : c.getMethods()) {
    if (met.getAnnotation(Test.class) != null) {
      return true;
    }
  }

  return false;
}
 
Example 20
Project: hbase-0.94.8-qod   File: ClassTestFinder.java   View source code 6 votes vote down vote up
private boolean isTestClass(Class<?> c) {
  if (Modifier.isAbstract(c.getModifiers())) {
    return false;
  }

  if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
    return true;
  }

  for (Method met : c.getMethods()) {
    if (met.getAnnotation(Test.class) != null) {
      return true;
    }
  }

  return false;
}
 
Example 21
Project: hbase-0.94.8-qod   File: ClassTestFinder.java   View source code 6 votes vote down vote up
private boolean isTestClass(Class<?> c) {
  if (Modifier.isAbstract(c.getModifiers())) {
    return false;
  }

  if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
    return true;
  }

  for (Method met : c.getMethods()) {
    if (met.getAnnotation(Test.class) != null) {
      return true;
    }
  }

  return false;
}
 
Example 22
Project: DominoHBase   File: ClassTestFinder.java   View source code 6 votes vote down vote up
private boolean isTestClass(Class<?> c) {
  if (Modifier.isAbstract(c.getModifiers())) {
    return false;
  }

  if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
    return true;
  }

  for (Method met : c.getMethods()) {
    if (met.getAnnotation(Test.class) != null) {
      return true;
    }
  }

  return false;
}
 
Example 23
Project: junit   File: MaxCore.java   View source code 6 votes vote down vote up
private Request constructLeafRequest(List<Description> leaves) {
    final List<Runner> runners = new ArrayList<Runner>();
    for (Description each : leaves) {
        runners.add(buildRunner(each));
    }
    return new Request() {
        @Override
        public Runner getRunner() {
            try {
                return new Suite((Class<?>) null, runners) {
                };
            } catch (InitializationError e) {
                return new ErrorReportingRunner(null, e);
            }
        }
    };
}
 
Example 24
Project: junit   File: MaxCore.java   View source code 6 votes vote down vote up
private Runner buildRunner(Description each) {
    if (each.toString().equals("TestSuite with 0 tests")) {
        return Suite.emptySuite();
    }
    if (each.toString().startsWith(MALFORMED_JUNIT_3_TEST_CLASS_PREFIX)) {
        // This is cheating, because it runs the whole class
        // to get the warning for this method, but we can't do better,
        // because JUnit 3.8's
        // thrown away which method the warning is for.
        return new JUnit38ClassRunner(new TestSuite(getMalformedTestClass(each)));
    }
    Class<?> type = each.getTestClass();
    if (type == null) {
        throw new RuntimeException("Can't build a runner from description [" + each + "]");
    }
    String methodName = each.getMethodName();
    if (methodName == null) {
        return Request.aClass(type).getRunner();
    }
    return Request.method(type, methodName).getRunner();
}
 
Example 25
Project: org.openntf.domino   File: MaxCore.java   View source code 6 votes vote down vote up
private Request constructLeafRequest(List<Description> leaves) {
    final List<Runner> runners = new ArrayList<Runner>();
    for (Description each : leaves) {
        runners.add(buildRunner(each));
    }
    return new Request() {
        @Override
        public Runner getRunner() {
            try {
                return new Suite((Class<?>) null, runners) {
                };
            } catch (InitializationError e) {
                return new ErrorReportingRunner(null, e);
            }
        }
    };
}
 
Example 26
Project: org.openntf.domino   File: MaxCore.java   View source code 6 votes vote down vote up
private Runner buildRunner(Description each) {
    if (each.toString().equals("TestSuite with 0 tests")) {
        return Suite.emptySuite();
    }
    if (each.toString().startsWith(MALFORMED_JUNIT_3_TEST_CLASS_PREFIX)) {
        // This is cheating, because it runs the whole class
        // to get the warning for this method, but we can't do better,
        // because JUnit 3.8's
        // thrown away which method the warning is for.
        return new JUnit38ClassRunner(new TestSuite(getMalformedTestClass(each)));
    }
    Class<?> type = each.getTestClass();
    if (type == null) {
        throw new RuntimeException("Can't build a runner from description [" + each + "]");
    }
    String methodName = each.getMethodName();
    if (methodName == null) {
        return Request.aClass(type).getRunner();
    }
    return Request.method(type, methodName).getRunner();
}
 
Example 27
Project: hindex   File: ClassTestFinder.java   View source code 6 votes vote down vote up
private boolean isTestClass(Class<?> c) {
  if (Modifier.isAbstract(c.getModifiers())) {
    return false;
  }

  if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
    return true;
  }

  for (Method met : c.getMethods()) {
    if (met.getAnnotation(Test.class) != null) {
      return true;
    }
  }

  return false;
}
 
Example 28
Project: sam   File: TestCommand.java   View source code 5 votes vote down vote up
private static Result runTests(Injector injector, Class<?>[] testClasses, Optional<Description> testFilter) throws InitializationError {

    final JUnitCore junit = new JUnitCore();
    junit.addListener(new JUnitRunListener(LOGGER));

    final Request testRequest = Request.runner(new Suite(new GuiceInjectionJUnitRunner(injector), testClasses));
    if (testFilter.isPresent()) {
      return junit.run(testRequest.filterWith(testFilter.get()));
    } else {
      return junit.run(testRequest);
    }
  }
 
Example 29
Project: evosuite   File: TestClusterUtils.java   View source code 5 votes vote down vote up
/**
 * Determine if this class contains JUnit tests
 * @deprecated use {@code org.evosuite.junit.CoverageAnalysis.isTest(Class<?> cls)}
 *
 * @param className
 * @return
 */
@Deprecated
public static boolean isTest(String className) {
	// TODO-JRO Identifying tests should be done differently:
	// If the class either contains methods
	// annotated with @Test (> JUnit 4.0)
	// or contains Test or Suite in it's inheritance structure
	try {
		Class<?> clazz = TestGenerationContext.getInstance().getClassLoaderForSUT().loadClass(className);
		Class<?> superClazz = clazz.getSuperclass();
		while (!superClazz.equals(Object.class)) {
			if (superClazz.equals(Suite.class))
				return true;
			if (superClazz.equals(Test.class))
				return true;

			superClazz = clazz.getSuperclass();
		}
		for (Method method : clazz.getMethods()) {
			if (method.isAnnotationPresent(Test.class)) {
				return true;
			}
		}
	} catch (ClassNotFoundException e) {
		logger.info("Could not load class: ", className);
	}
	return false;
}
 
Example 30
Project: OpenSPIFe   File: EnsembleJUnit4Suite.java   View source code 5 votes vote down vote up
@Override
public void addTests(TestSuite suite) {
	//$JUnit-BEGIN$
	Suite.SuiteClasses suiteClasses = getClass().getAnnotation(Suite.SuiteClasses.class);
	if (suiteClasses == null) {
		Logger.getLogger(getClass()).warn("No @SuiteClasses annotation found");
		return;
	}
	for (Class testClass : suiteClasses.value())
		suite.addTest(new JUnit4TestAdapter(testClass));
	//$JUnit-END$
}
 
Example 31
Project: sosiefier   File: Computer.java   View source code 5 votes vote down vote up
/**
 * Create a suite for {@code classes}, building Runners with {@code builder}.
 * Throws an InitializationError if Runner construction fails
 */
public Runner getSuite(final RunnerBuilder builder,
        Class<?>[] classes) throws InitializationError {
    return new Suite(new RunnerBuilder() {
        @Override
        public Runner runnerForClass(Class<?> testClass) throws Throwable {
            return getRunner(builder, testClass);
        }
    }, classes);
}
 
Example 32
Project: pitest   File: JUnit4SuiteFinder.java   View source code 5 votes vote down vote up
private boolean hasSuitableRunnner(final Class<?> clazz) {

    final RunWith runWith = clazz.getAnnotation(RunWith.class);
    if (runWith != null) {
      return (runWith.value().equals(Suite.class));
    }
    return false;
  }
 
Example 33
Project: lcm   File: Computer.java   View source code 5 votes vote down vote up
/**
 * Create a suite for {@code classes}, building Runners with {@code builder}.
 * Throws an InitializationError if Runner construction fails
 */
public Runner getSuite(final RunnerBuilder builder,
        Class<?>[] classes) throws InitializationError {
    return new Suite(new RunnerBuilder() {
        @Override
        public Runner runnerForClass(Class<?> testClass) throws Throwable {
            return getRunner(builder, testClass);
        }
    }, classes);
}
 
Example 34
Project: junit-converter   File: SuiteAnnotationsImportingStage.java   View source code 5 votes vote down vote up
/**
 * @see junitconverter.stages.TestConversionStage#convertClass(junitconverter.testcase.TestCaseClass)
 */
public void convertClass(TestCaseClass testCase)
{
	codeEditor.importClass(testCase, Suite.class);
	codeEditor.importClass(testCase, RunWith.class);
	codeEditor.importClass(testCase, SuiteClasses.class); // FIXME Doesn't import it properly. Adds a $ instead of . between SUite and SuiteClasses
}
 
Example 35
Project: junit   File: Computer.java   View source code 5 votes vote down vote up
/**
 * Create a suite for {@code classes}, building Runners with {@code builder}.
 * Throws an InitializationError if Runner construction fails
 */
public Runner getSuite(final RunnerBuilder builder,
        Class<?>[] classes) throws InitializationError {
    return new Suite(new RunnerBuilder() {
        @Override
        public Runner runnerForClass(Class<?> testClass) throws Throwable {
            return getRunner(builder, testClass);
        }
    }, classes);
}
 
Example 36
Project: org.openntf.domino   File: Computer.java   View source code 5 votes vote down vote up
/**
 * Create a suite for {@code classes}, building Runners with {@code builder}.
 * Throws an InitializationError if Runner construction fails
 */
public Runner getSuite(final RunnerBuilder builder,
        Class<?>[] classes) throws InitializationError {
    return new Suite(new RunnerBuilder() {
        @Override
        public Runner runnerForClass(Class<?> testClass) throws Throwable {
            return getRunner(builder, testClass);
        }
    }, classes);
}
 
Example 37
Project: intellij-ce-playground   File: IdeaSuite.java   View source code 4 votes vote down vote up
private static boolean isSuite(Object child) {
  return child instanceof Suite && !(child instanceof Parameterized) || child instanceof SuiteMethod;
}
 
Example 38
Project: jicunit   File: JicUnitRunner.java   View source code 4 votes vote down vote up
public JicUnitRunner(Class<?> testClass) throws Throwable {
  Class<? extends Runner> runnerClass;
  RunInContainerWith runInContainerWith = findAnnotation(testClass, RunInContainerWith.class);
  // figure out if this is happening locally or in the JEE container
  String containerUrl = getContainerUrl();
  if (containerUrl == null) {
    // this code is executed in the JEE container
    if (runInContainerWith != null) {
      runnerClass = runInContainerWith.value();
    } else {
      runnerClass = JUnit4.class;
    }
    try {
      Constructor<? extends Runner> constructor = runnerClass
          .getDeclaredConstructor(Class.class);
      mRunner = constructor.newInstance(testClass);
    } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
        | InvocationTargetException | NoSuchMethodException | SecurityException e) {
      Throwable cause = (e.getCause() != null ? e.getCause() : e);
      String msg = "Unable to create instance of " + runnerClass + " using test class " + testClass.getName() + " Reason: " + cause;
      if (cause instanceof InitializationError) {
        InitializationError initializationError = (InitializationError) cause;
        msg = msg + " " + initializationError.getCauses();
      }
      sLog.log(Level.SEVERE, msg);
      throw new RuntimeException(msg, cause);
    }
  } else {
    // this code is executed locally so create a ProxyRunner which will
    // forward the execution to the container
    if (runInContainerWith != null) {
      runnerClass = runInContainerWith.value();
      if (Parameterized.class.isAssignableFrom(runnerClass)) {
        mRunner = new ParameterizedProxyRunner(testClass, containerUrl);
      } else if (Suite.class.isAssignableFrom(runnerClass)) {
        throw new IllegalArgumentException(
            RunInContainerWith.class.getSimpleName()
                + " annotation does not support Suite runner or any subclass of Suite except Parameterized");
      } else {
        Runner runInContainerRunner = runnerClass.getDeclaredConstructor(Class.class)
            .newInstance(testClass);
        Description desc = runInContainerRunner.getDescription();
        mRunner = new BasicProxyRunner(testClass, containerUrl, desc);
      }
    } else {
      mRunner = new BasicProxyRunner(testClass, containerUrl);
    }
  }

}
 
Example 39
Project: tools-idea   File: IdeaSuite.java   View source code 4 votes vote down vote up
private static boolean isSuite(Object child) {
  return child instanceof Suite || child instanceof SuiteMethod;
}
 
Example 40
Project: dsl-devkit   File: FilterRegistry.java   View source code 2 votes vote down vote up
/**
 * Determines if the given {@link Description} is describing a {@link Suite}.
 *
 * @param description
 *          the {@link Description} to check, must not be {@code null}
 * @return whether the description is describing a Suite
 */
public static boolean isSuite(final Description description) {
  final RunWith runWithAnnotation = description.getAnnotation(RunWith.class);
  return runWithAnnotation != null && Suite.class.isAssignableFrom(runWithAnnotation.value());
}