PackageGraph implements ProgressCheck { @Override public void identifyPackage(final PackageId packageId, final File file) { if (packageId != null) { identified.add(packageId); getOrCreateNode(packageId).setParent(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 testIdentifyPackage() { graph.startedScan(); assertNull("expect last identified is null", graph.getLastIdentified()); assertFalse("expect not identified " + container2, graph.isIdentified(container2)); graph.identifyPackage(container2, null); assertTrue("expect identified " + container2, graph.isIdentified(container2)); assertEquals("expect container2 is last identified", container2, graph.getLastIdentified()); assertFalse("expect not identified " + container1, graph.isIdentified(container1)); graph.identifyPackage(container1, null); assertTrue("expect identified " + container1, graph.isIdentified(container1)); assertEquals("expect container1 is last identified", container1, graph.getLastIdentified()); }