org.junit.runners.Suite.SuiteClasses Java Examples
The following examples show how to use
org.junit.runners.Suite.SuiteClasses.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SqlIntegrationMembershipTest.java From nomulus with Apache License 2.0 | 5 votes |
@Test @Ignore public void sqlIntegrationMembershipComplete() { ImmutableSet<String> sqlDependentTests; try (ScanResult scanResult = new ClassGraph().enableAnnotationInfo().whitelistPackages("google.registry").scan()) { sqlDependentTests = scanResult.getClassesWithAnnotation(RunWith.class.getName()).stream() .filter(clazz -> clazz.getSimpleName().endsWith("Test")) .map(clazz -> clazz.loadClass()) .filter(SqlIntegrationMembershipTest::isSqlDependent) .map(Class::getName) .collect(ImmutableSet.toImmutableSet()); } ImmutableSet<String> declaredTests = Stream.of(SqlIntegrationTestSuite.class.getAnnotation(SuiteClasses.class).value()) .map(Class::getName) .collect(ImmutableSet.toImmutableSet()); SetView<String> undeclaredTests = Sets.difference(sqlDependentTests, declaredTests); expect .withMessage( "Undeclared sql-dependent tests found. " + "Please add them to SqlIntegrationTestSuite.java.") .that(undeclaredTests) .isEmpty(); SetView<String> unnecessaryDeclarations = Sets.difference(declaredTests, sqlDependentTests); expect .withMessage("Found tests that should not be included in SqlIntegrationTestSuite.java.") .that(unnecessaryDeclarations) .isEmpty(); }
Example #2
Source File: JUnit4SuiteFinder.java From pitest with Apache License 2.0 | 5 votes |
@Override public List<Class<?>> apply(final Class<?> a) { final SuiteClasses annotation = a.getAnnotation(SuiteClasses.class); if ((annotation != null) && hasSuitableRunnner(a)) { return Arrays.asList(annotation.value()); } else { return Collections.emptyList(); } }