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); } }
@Test public void shouldProcessTestFiles() throws Exception { // when SuiteRunner suiteRunner = new SuiteRunner(IntegrationTestSuite.class, new JUnit4Builder()); // then assertEquals(IntegrationTestSuite.class.getName(), suiteRunner.getTestClass().getName()); }
@Override protected JUnit4Builder junit4Builder() { return new FallbackJUnit4Builder(); }
@Test(expected = InitializationError.class) public void shouldFailIfConfigurationIsMissing() throws Exception { new SuiteRunner(IgnoredNotAnnotatedTest.class, new JUnit4Builder()); }
protected JUnit4Builder junit4Builder() { return new FallbackJUnit4Builder(); }