@Test
void shouldCollapseNodesWithOneChild() {

    final Set<TestResult> testResults = new HashSet<>();
    final TestResult first = new TestResult()
            .setName("first")
            .setLabels(singletonList(PACKAGE.label("a.b.c")));
    final TestResult second = new TestResult()
            .setName("second")
            .setLabels(singletonList(PACKAGE.label("a.d.e")));
    testResults.add(first);
    testResults.add(second);
    final LaunchResults results = new DefaultLaunchResults(
            testResults,
            Collections.emptyMap(),
            Collections.emptyMap()
    );
    final PackagesPlugin packagesPlugin = new PackagesPlugin();
    final Tree<TestResult> tree = packagesPlugin.getData(singletonList(results));
    assertThat(tree.getChildren())
            .hasSize(1)
            .extracting("name")
            .containsExactlyInAnyOrder("a");
    assertThat(tree.getChildren())
            .flatExtracting("children")
            .extracting("name")
            .containsExactlyInAnyOrder("b.c", "d.e");
    assertThat(tree.getChildren())
            .flatExtracting("children")
            .flatExtracting("children")
            .extracting("name")
            .containsExactlyInAnyOrder("first", "second");
}