PackageGraph implements ProgressCheck { public boolean isRoot(final @NotNull PackageId packageId) { return getOrCreateNode(packageId).getParent() == null; }  @Override Collection<Violation> getReportedViolations(); @Override void startedScan(); @Override void identifyPackage(final PackageId packageId, final File file); @Override void identifySubpackage(final PackageId packageId, final PackageId parentId); @Override void identifyEmbeddedPackage(final PackageId packageId, final PackageId parentId,
                                        final EmbeddedPackageInstallable slingInstallable); boolean isIdentified(final @NotNull PackageId packageId); @Nullable PackageId getLastIdentified(); boolean isRoot(final @NotNull PackageId packageId); boolean isLeftDescendantOfRight(final @NotNull PackageId left, final @NotNull PackageId right); Collection<PackageId> getSelfAndAncestors(final @NotNull PackageId self); Collection<PackageId> getSelfAndDescendants(final @NotNull PackageId self);  }
@Test public void testIsRoot() { assertTrue("expect isRoot " + container1, graph.isRoot(container1)); assertFalse("expect not isRoot " + cont1sub1, graph.isRoot(cont1sub1)); assertFalse("expect not isRoot " + cont1emb1, graph.isRoot(cont1emb1)); assertTrue("expect isRoot " + container2, graph.isRoot(container2)); assertFalse("expect not isRoot " + cont2sub1, graph.isRoot(cont2sub1)); assertFalse("expect not isRoot " + cont2emb1, graph.isRoot(cont2emb1)); graph.startedScan(); assertTrue("expect isRoot " + container1, graph.isRoot(container1)); assertTrue("expect isRoot " + cont1sub1, graph.isRoot(cont1sub1)); assertTrue("expect isRoot " + cont1emb1, graph.isRoot(cont1emb1)); assertTrue("expect isRoot " + container2, graph.isRoot(container2)); assertTrue("expect isRoot " + cont2sub1, graph.isRoot(cont2sub1)); assertTrue("expect isRoot " + cont2emb1, graph.isRoot(cont2emb1)); }