GuidedDecisionTableGraphEditorServiceImpl extends KieService<GuidedDecisionTableEditorGraphContent> implements GuidedDecisionTableGraphEditorService { @Override public Path create(final Path context, final String fileName, final GuidedDecisionTableEditorGraphModel model, final String comment) { try { final org.uberfire.java.nio.file.Path nioPath = Paths.convert(context).resolve(fileName); if (ioService.exists(nioPath)) { throw new FileAlreadyExistsException(nioPath.toString()); } final Set<Path> paths = getLinkedDecisionTablesInPackage(context); paths.forEach((path) -> model.getEntries().add(new GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry(path, getLatestVersionPath(path)))); ioService.write(nioPath, GuidedDTGraphXMLPersistence.getInstance().marshal(model), commentedOptionFactory.makeCommentedOption(comment)); final Path newPath = Paths.convert(nioPath); return newPath; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } } GuidedDecisionTableGraphEditorServiceImpl(); @Inject  GuidedDecisionTableGraphEditorServiceImpl(final @Named("ioStrategy") IOService ioService,
                                                     final CopyService copyService,
                                                     final DeleteService deleteService,
                                                     final RenameService renameService,
                                                     final KieModuleService moduleService,
                                                     final VersionRecordService versionRecordService,
                                                     final GuidedDecisionTableEditorService dtableService,
                                                     final GuidedDecisionTableLinkManager dtableLinkManager,
                                                     final Event<ResourceOpenedEvent> resourceOpenedEvent,
                                                     final CommentedOptionFactory commentedOptionFactory,
                                                     final GuidedDTableResourceTypeDefinition resourceType,
                                                     final DotFileFilter dotFileFilter,
                                                     final SessionInfo sessionInfo); @Override Path create(final Path context,
                       final String fileName,
                       final GuidedDecisionTableEditorGraphModel model,
                       final String comment); @Override GuidedDecisionTableEditorGraphModel load(final Path path); @Override GuidedDecisionTableEditorGraphContent loadContent(final Path path); @Override Path save(final Path path,
                     final GuidedDecisionTableEditorGraphModel model,
                     final Metadata metadata,
                     final String comment); @Override void delete(final Path path,
                       final String comment); @Override Path rename(final Path path,
                       final String newName,
                       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 List<Path> listDecisionTablesInPackage(final Path path);  }
@Test public void checkCreate() { final Path context = mock(Path.class); final String fileName = "filename." + dtGraphResourceType.getSuffix(); final GuidedDecisionTableEditorGraphModel content = new GuidedDecisionTableEditorGraphModel(); final String comment = "comment"; when(context.toURI()).thenReturn("file: final Path p = service.create(context, fileName, content, comment); verify(ioService, times(1)).write(any(org.uberfire.java.nio.file.Path.class), any(String.class), any(CommentedOption.class)); assertTrue(p.toURI().contains("src/main/resources/mypackage/filename." + dtGraphResourceType.getSuffix())); }