@Test void testNotContains() { Package packageA = mock(Package.class); Package packageAa = mock(Package.class); Package packageAb = mock(Package.class); Package packageAba = mock(Package.class); Package packageC = mock(Package.class); when(packageA.getChildren()).thenReturn(asList(packageAa, packageAb, packageC)); when(packageAb.getChildren()).thenReturn(singletonList(packageAba)); assertFalse(PackageUtils.contains(packageA, mock(Package.class))); }
public static boolean contains(Package pack, Package wantedPackage) { return new PackageTreeTraverser() .postOrderTraversal(pack) .anyMatch(childPackage -> Objects.equals(childPackage, wantedPackage)); }
PackageUtils { public static boolean contains(Package pack, Package wantedPackage) { return new PackageTreeTraverser() .postOrderTraversal(pack) .anyMatch(childPackage -> Objects.equals(childPackage, wantedPackage)); } }
PackageUtils { public static boolean contains(Package pack, Package wantedPackage) { return new PackageTreeTraverser() .postOrderTraversal(pack) .anyMatch(childPackage -> Objects.equals(childPackage, wantedPackage)); } private  PackageUtils(); }
PackageUtils { public static boolean contains(Package pack, Package wantedPackage) { return new PackageTreeTraverser() .postOrderTraversal(pack) .anyMatch(childPackage -> Objects.equals(childPackage, wantedPackage)); } private  PackageUtils(); static boolean isSystemPackage(@Nullable @CheckForNull Package aPackage); static boolean contains(Package pack, Package wantedPackage); }
PackageUtils { public static boolean contains(Package pack, Package wantedPackage) { return new PackageTreeTraverser() .postOrderTraversal(pack) .anyMatch(childPackage -> Objects.equals(childPackage, wantedPackage)); } private  PackageUtils(); static boolean isSystemPackage(@Nullable @CheckForNull Package aPackage); static boolean contains(Package pack, Package wantedPackage);  }