HtmlEditorServiceImpl implements HtmlEditorService { @Override public Path copy(final Path path, final String newName, final String comment) { return copyService.copy(path, newName, comment); } @Inject  HtmlEditorServiceImpl(final VFSService vfsServices,
                                 final DeleteService deleteService,
                                 final RenameService renameService,
                                 final CopyService copyService,
                                 final SaveAndRenameServiceImpl<String, DefaultMetadata> saveAndRenameService); @PostConstruct void init(); @Override void delete(final Path path,
                       final String comment); @Override Path rename(final Path path,
                       final String newName,
                       final String comment); @Override Path save(final Path path,
                     final String content,
                     final DefaultMetadata _metadata,
                     final String _comment); @Override Path copy(final Path path,
                     final String newName,
                     final String comment); @Override Path copy(final Path path,
                     final String newName,
                     final Path targetDirectory,
                     final String comment); @Override String load(final Path path); @Override Path saveAndRename(final Path path,
                              final String newFileName,
                              final DefaultMetadata metadata,
                              final String content,
                              final String comment);  }
@Test public void testCopyWithoutTargetDirectory() throws Exception { final Path expectedPath = mock(Path.class); doReturn(expectedPath).when(copyService).copy(path, newFileName, comment); final Path actualPath = htmlEditorService.copy(path, newFileName, comment); verify(copyService).copy(path, newFileName, comment); assertEquals(expectedPath, actualPath); }
@Test public void testCopyWithTargetDirectory() throws Exception { final Path targetDirectory = mock(Path.class); final Path expectedPath = mock(Path.class); doReturn(expectedPath).when(copyService).copy(path, newFileName, targetDirectory, comment); final Path actualPath = htmlEditorService.copy(path, newFileName, targetDirectory, comment); verify(copyService).copy(path, newFileName, targetDirectory, comment); assertEquals(expectedPath, actualPath); }