Search in sources :

Example 1 with SingleSdkRobolectricTestRunner

use of org.robolectric.SingleSdkRobolectricTestRunner in project robolectric by robolectric.

the class CustomConfigurerTest method runAndGetFailures.

private List<String> runAndGetFailures(Class<TestWithConfig> testClass) throws InitializationError {
    RunNotifier notifier = new RunNotifier();
    FailureListener failureListener = new FailureListener();
    notifier.addListener(failureListener);
    HierarchicalConfigurationStrategy configurationStrategy = new HierarchicalConfigurationStrategy(new ConfigConfigurer(new PackagePropertiesLoader()), new LooperModeConfigurer(new Properties()), new SomeConfigConfigurer());
    SingleSdkRobolectricTestRunner testRunner = new SingleSdkRobolectricTestRunner(testClass, SingleSdkRobolectricTestRunner.defaultInjector().bind(ConfigurationStrategy.class, configurationStrategy).build());
    testRunner.run(notifier);
    return failureListener.failures.stream().map(Failure::getMessage).collect(toList());
}
Also used : RunNotifier(org.junit.runner.notification.RunNotifier) FailureListener(org.robolectric.android.FailureListener) SingleSdkRobolectricTestRunner(org.robolectric.SingleSdkRobolectricTestRunner) Properties(java.util.Properties)

Aggregations

Properties (java.util.Properties)1 RunNotifier (org.junit.runner.notification.RunNotifier)1 SingleSdkRobolectricTestRunner (org.robolectric.SingleSdkRobolectricTestRunner)1 FailureListener (org.robolectric.android.FailureListener)1