use of org.robolectric.RobolectricTestRunner.defaultInjector in project robolectric by robolectric.
the class RobolectricTestRunnerTest method shouldReportPerfStats.
@Test
public void shouldReportPerfStats() throws Exception {
List<Metric> metrics = new ArrayList<>();
PerfStatsReporter reporter = (metadata, metrics1) -> metrics.addAll(metrics1);
RobolectricTestRunner runner = new SingleSdkRobolectricTestRunner(TestWithTwoMethods.class, RobolectricTestRunner.defaultInjector().bind(PerfStatsReporter[].class, new PerfStatsReporter[] { reporter }).build());
runner.run(notifier);
Set<String> metricNames = metrics.stream().map(Metric::getName).collect(toSet());
assertThat(metricNames).contains("initialization");
}
Aggregations