PerspectiveServicesImpl implements PerspectiveServices { @Override public Path rename(Path path, String newName, String comment) { Path pathRenamed = pluginServices.rename(path, newName, comment); this.setLayoutTemplateName(pathRenamed, newName, comment); return pathRenamed; } @Inject  PerspectiveServicesImpl(final PluginServicesImpl pluginServices,
                                   final LayoutServicesImpl layoutServices,
                                   final SaveAndRenameServiceImpl<LayoutTemplate, DefaultMetadata> saveAndRenameService); @PostConstruct void init(); @Override Plugin createNewPerspective(String name, LayoutTemplate.Style style); @Override Collection<LayoutTemplate> listLayoutTemplates(); @Override LayoutTemplate getLayoutTemplate(String perspectiveName); @Override LayoutTemplate getLayoutTemplate(Path perspectivePath); @Override LayoutTemplate getLayoutTemplate(Plugin perspectivePlugin); Plugin getLayoutTemplatePlugin(String perspectiveName); @Override Path saveLayoutTemplate(Path perspectivePath, LayoutTemplate layoutTemplate, String commitMessage); @Override LayoutTemplate convertToLayoutTemplate(String layoutModel); @Override Path copy(Path path, String newName, String comment); @Override Path copy(Path path, String newName, Path targetDirectory, String comment); @Override Path rename(Path path, String newName, String comment); @Override void delete(Path path, String comment); @Override Path save(final Path path,
                     final LayoutTemplate content,
                     final DefaultMetadata metadata,
                     final String comment); @Override Path saveAndRename(final Path path,
                              final String newFileName,
                              final DefaultMetadata metadata,
                              final LayoutTemplate content,
                              final String comment);  }
@Test public void testRename() { Path result = perspectiveServices.rename(path, "newName", ""); ArgumentCaptor<LayoutEditorModel> layoutModelArg = ArgumentCaptor.forClass(LayoutEditorModel.class); verify(pluginServices).saveLayout(layoutModelArg.capture(), anyString()); LayoutEditorModel layoutModelCopy = layoutModelArg.getValue(); assertEquals(layoutModelCopy.getName(), "newName"); assertEquals(layoutModelCopy.getPath(), result); }