@Test public void copy() throws IOException { File file = new File(filename); Assert.assertTrue(file.exists()); File copy = new File(copyFilename); FileUtils.copyFile(file, copy); PalsFile palsFile = fileService.createFile(copy); palsFile.setName("name"); palsFile.setContentType("ct"); PalsFile palsFileCopy = fileService.copy(palsFile); Assert.assertEquals(palsFileCopy, palsFile); }
@Test public void copyList() throws IOException { List<PalsFile> fileList = new ArrayList<PalsFile>(); for (int i = 0; i < 4; ++i) { File file = new File(filename); Assert.assertTrue(file.exists()); File copy = new File(copyFilename); FileUtils.copyFile(file, copy); PalsFile palsFile = fileService.createFile(copy); palsFile.setName("name"); palsFile.setContentType("ct"); fileList.add(palsFile); } List<PalsFile> copyList = fileService.copy(fileList); for (int i = 0; i < copyList.size(); ++i) { Assert.assertEquals(copyList.get(i), fileList.get(i)); } }