use of org.robolectric.android.FailureListener 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());
}
Aggregations