use of org.junit.runner.notification.RunNotifier in project robolectric by robolectric.
the class RobolectricTestRunnerMultiApiTest method setUp.
@Before
public void setUp() {
numSupportedApis = APIS_FOR_TEST.length;
runListener = new MyRunListener();
runNotifier = new RunNotifier();
runNotifier.addListener(runListener);
sdkCollection = new SdkCollection(() -> map(APIS_FOR_TEST));
delegateSdkPicker = new DefaultSdkPicker(sdkCollection, null);
priorResourcesMode = System.getProperty("robolectric.resourcesMode");
System.setProperty("robolectric.resourcesMode", "legacy");
priorAlwaysInclude = System.getProperty("robolectric.alwaysIncludeVariantMarkersInTestName");
System.clearProperty("robolectric.alwaysIncludeVariantMarkersInTestName");
}
use of org.junit.runner.notification.RunNotifier in project robolectric by robolectric.
the class RobolectricTestRunnerTest method setUp.
@Before
public void setUp() throws Exception {
notifier = new RunNotifier();
events = new ArrayList<>();
notifier.addListener(new MyRunListener());
priorEnabledSdks = System.getProperty("robolectric.enabledSdks");
System.clearProperty("robolectric.enabledSdks");
priorAlwaysInclude = System.getProperty("robolectric.alwaysIncludeVariantMarkersInTestName");
System.clearProperty("robolectric.alwaysIncludeVariantMarkersInTestName");
sdkCollection = TestUtil.getSdkCollection();
}
use of org.junit.runner.notification.RunNotifier in project robolectric by robolectric.
the class TestRunnerSequenceTest method run.
private Result run(Runner runner) throws InitializationError {
RunNotifier notifier = new RunNotifier();
Result result = new Result();
notifier.addListener(result.createListener());
runner.run(notifier);
return result;
}
use of org.junit.runner.notification.RunNotifier in project robolectric by robolectric.
the class TestRunnerSequenceTest method shouldReleaseAllStateAfterClassSoWeDontLeakMemory.
@Test
public void shouldReleaseAllStateAfterClassSoWeDontLeakMemory() throws Exception {
final List<RobolectricTestRunner.RobolectricFrameworkMethod> methods = new ArrayList<>();
RobolectricTestRunner robolectricTestRunner = new Runner(SimpleTest.class) {
@Override
protected void finallyAfterTest(FrameworkMethod method) {
super.finallyAfterTest(method);
RobolectricFrameworkMethod roboMethod = (RobolectricFrameworkMethod) method;
assertThat(roboMethod.getTestEnvironment()).isNull();
assertThat(roboMethod.testLifecycle).isNull();
methods.add(roboMethod);
}
};
robolectricTestRunner.run(new RunNotifier());
assertThat(methods).isNotEmpty();
}
use of org.junit.runner.notification.RunNotifier in project robolectric by robolectric.
the class FailureListener method runTests.
@Nonnull
public static List<Failure> runTests(Class<?> testClass) throws InitializationError {
RunNotifier notifier = new RunNotifier();
FailureListener failureListener = new FailureListener();
notifier.addListener(failureListener);
new RobolectricTestRunner(testClass).run(notifier);
return failureListener.failures;
}
Aggregations