SuitesPlugin extends CompositeAggregator { @SuppressWarnings("PMD.DefaultPackage") static Tree<TestResult> getData(final List<LaunchResults> launchResults) { final Tree<TestResult> xunit = new TestResultTree( SUITES, testResult -> groupByLabels(testResult, PARENT_SUITE, SUITE, SUB_SUITE) ); launchResults.stream() .map(LaunchResults::getResults) .flatMap(Collection::stream) .sorted(comparingByTimeAsc()) .forEach(xunit::add); return xunit; } SuitesPlugin();   }
@Test void shouldCreateTree() { final Tree<TestResult> tree = SuitesPlugin.getData(getSimpleLaunchResults()); assertThat(tree.getChildren()) .hasSize(2) .extracting(TreeNode::getName) .containsExactlyInAnyOrder("s1", "s2"); }
@Issue("587") @Issue("572") @Test void shouldSortByStartTimeAsc() { final TestResult first = new TestResult() .setName("first") .setTime(new Time().setStart(10L)); final TestResult second = new TestResult() .setName("second") .setTime(new Time().setStart(12L)); final TestResult timeless = new TestResult() .setName("timeless"); final Tree<TestResult> tree = SuitesPlugin.getData( createSingleLaunchResults(second, first, timeless) ); assertThat(tree.getChildren()) .extracting(TreeNode::getName) .containsExactly("timeless", "first", "second"); }