@Test void testUniqueLabelRootPackage() { Package packageA = mock(Package.class); when(packageA.getLabel()).thenReturn("A"); Package packageInRoot = mock(Package.class); when(packageInRoot.getLabel()).thenReturn("A"); when(dataService.query(PACKAGE, Package.class).eq(PackageMetadata.PARENT, null).findAll()) .thenReturn(Stream.of(packageInRoot)); CopyState state = CopyState.create(null, mock(Progress.class)); copier.copy(singletonList(packageA), state); verify(packageA).setLabel("A (Copy)"); }
public void copy(List<Package> packages, CopyState state) { packages.forEach(pack -> copyPackage(pack, state)); }
PackageCopier { public void copy(List<Package> packages, CopyState state) { packages.forEach(pack -> copyPackage(pack, state)); } }
PackageCopier { public void copy(List<Package> packages, CopyState state) { packages.forEach(pack -> copyPackage(pack, state)); } PackageCopier(DataService dataService, IdGenerator idGenerator); }
PackageCopier { public void copy(List<Package> packages, CopyState state) { packages.forEach(pack -> copyPackage(pack, state)); } PackageCopier(DataService dataService, IdGenerator idGenerator); void copy(List<Package> packages, CopyState state); }
PackageCopier { public void copy(List<Package> packages, CopyState state) { packages.forEach(pack -> copyPackage(pack, state)); } PackageCopier(DataService dataService, IdGenerator idGenerator); void copy(List<Package> packages, CopyState state);  }