@Test void testUniqueLabel() { Package packageA = mock(Package.class); when(packageA.getLabel()).thenReturn("A"); Package targetPackage = mock(Package.class); Package packageInTarget = mock(Package.class); when(targetPackage.getChildren()).thenReturn(singletonList(packageInTarget)); when(packageInTarget.getLabel()).thenReturn("A"); CopyState state = CopyState.create(targetPackage, 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);  }