@Test void should_handle_parameterized_tests() throws URISyntaxException { SensorContextTester context = mockContext(); when(javaResourceLocator.findResourceByClassName(anyString())) .thenAnswer(invocation -> { String className = (String) invocation.getArguments()[0]; if (className.equals("org.foo.Junit4ParameterizedTest") || className.startsWith("org.foo.Junit5_0ParameterizedTest") || className.startsWith("org.foo.Junit5_1ParameterizedTest")) { return new TestInputFileBuilder("", className).build(); } return null; }); parser.collect(context, getDirs("junitParameterizedTests"), true); assertThat(context.measure(":org.foo.Junit4ParameterizedTest", CoreMetrics.TESTS).value()).isEqualTo(7); assertThat(context.measure(":org.foo.Junit4ParameterizedTest", CoreMetrics.TEST_EXECUTION_TIME).value()).isEqualTo(1); assertThat(context.measure(":org.foo.Junit5_0ParameterizedTest", CoreMetrics.TESTS).value()).isEqualTo(13); assertThat(context.measure(":org.foo.Junit5_0ParameterizedTest", CoreMetrics.TEST_EXECUTION_TIME).value()).isEqualTo(48); assertThat(context.measure(":org.foo.Junit5_1ParameterizedTest", CoreMetrics.TESTS).value()).isEqualTo(13); assertThat(context.measure(":org.foo.Junit5_1ParameterizedTest", CoreMetrics.TEST_EXECUTION_TIME).value()).isEqualTo(48); }
public void collect(SensorContext context, List<File> reportsDirs, boolean reportDirSetByUser) { List<File> xmlFiles = getReports(reportsDirs, reportDirSetByUser); if (!xmlFiles.isEmpty()) { parseFiles(context, xmlFiles); } }
SurefireJavaParser { public void collect(SensorContext context, List<File> reportsDirs, boolean reportDirSetByUser) { List<File> xmlFiles = getReports(reportsDirs, reportDirSetByUser); if (!xmlFiles.isEmpty()) { parseFiles(context, xmlFiles); } } }
SurefireJavaParser { public void collect(SensorContext context, List<File> reportsDirs, boolean reportDirSetByUser) { List<File> xmlFiles = getReports(reportsDirs, reportDirSetByUser); if (!xmlFiles.isEmpty()) { parseFiles(context, xmlFiles); } } SurefireJavaParser(JavaResourceLocator javaResourceLocator); }
SurefireJavaParser { public void collect(SensorContext context, List<File> reportsDirs, boolean reportDirSetByUser) { List<File> xmlFiles = getReports(reportsDirs, reportDirSetByUser); if (!xmlFiles.isEmpty()) { parseFiles(context, xmlFiles); } } SurefireJavaParser(JavaResourceLocator javaResourceLocator); void collect(SensorContext context, List<File> reportsDirs, boolean reportDirSetByUser); }
SurefireJavaParser { public void collect(SensorContext context, List<File> reportsDirs, boolean reportDirSetByUser) { List<File> xmlFiles = getReports(reportsDirs, reportDirSetByUser); if (!xmlFiles.isEmpty()) { parseFiles(context, xmlFiles); } } SurefireJavaParser(JavaResourceLocator javaResourceLocator); void collect(SensorContext context, List<File> reportsDirs, boolean reportDirSetByUser);  }