PerspectiveServicesImpl implements PerspectiveServices { @Override public Collection<LayoutTemplate> listLayoutTemplates() { return pluginServices.listPlugins(PluginType.PERSPECTIVE_LAYOUT).stream() .map(this::getLayoutTemplate) .collect(Collectors.toList()); } @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 testList() { Plugin layoutPlugin = new Plugin("layout", PluginType.PERSPECTIVE_LAYOUT, path2); when(pluginServices.listPlugins(PluginType.PERSPECTIVE_LAYOUT)) .thenReturn(Collections.singletonList(layoutPlugin)); Collection<LayoutTemplate> layouts = perspectiveServices.listLayoutTemplates(); assertEquals(layouts.size(), 1); LayoutTemplate layoutTemplate = layouts.iterator().next(); assertEquals(layoutTemplate.getName(), "layout"); verify(pluginServices).listPlugins(PluginType.PERSPECTIVE_LAYOUT); }