public static List<Failure> runTestWithExpectedFailureTypes(Class<?> test,
      List<Class<? extends Throwable>> expectedThrowables) {
    List<FailureTypeInfo> expectedFailures = Streams.stream(expectedThrowables)
        .map(FailureTypeInfo::new)
        .collect(Collectors.toList());

    JUnitCore junitCore = new JUnitCore();
    Result result = junitCore.run(Request.aClass(test).getRunner());

    List<Failure> failures = result.getFailures();
    assertThat(failures)
        .as("Actual failures")
        .hasSameSizeAs(expectedFailures);

    List<FailureTypeInfo> actualFailures = Streams.stream(failures)
        .map(t -> new FailureTypeInfo(t.getException().getClass()))
        .collect(Collectors.toList());

    assertThat(actualFailures)
        .as("Actual failures info (Throwable and message)")
        .hasSameElementsAs(expectedFailures);

    return failures;
  }
Used by JUnit rule unit tests to execute inner test cases.
geode-junit/src/main/java/org/apache/geode/test/junit/runners/TestRunner.java