@Test
  public void checkDelete() {
    final Path path = mock(Path.class);
    final String comment = "comment";

    service.delete(path, comment);

    verify(deleteService, times(1)).delete(eq(path), eq(comment));
  }
  @Test
  public void checkCopy() {
    final Path path = mock(Path.class);
    final String newFileName = "newFileName";
    final String comment = "comment";

    service.copy(path, newFileName, comment);

    verify(copyService, times(1)).copy(eq(path), eq(newFileName), eq(comment));
  }
  @Test
  public void checkLoad() {
    final Path path = mock(Path.class);
    when(path.toURI())
        .thenReturn(
            "default://project/src/main/resources/mypackage/dtable."
                + dtGraphResourceType.getSuffix());

    when(ioService.readAllString(any(org.uberfire.java.nio.file.Path.class))).thenReturn("");

    final GuidedDecisionTableEditorGraphModel model = service.load(path);

    verify(ioService, times(1)).readAllString(any(org.uberfire.java.nio.file.Path.class));
    assertNotNull(model);
  }
  @Test
  public void checkConstructContent() {
    final Path path = mock(Path.class);
    final Overview overview = mock(Overview.class);
    when(path.toURI())
        .thenReturn(
            "default://project/src/main/resources/mypackage/dtable."
                + dtGraphResourceType.getSuffix());

    final GuidedDecisionTableEditorGraphContent content = service.constructContent(path, overview);

    verify(resourceOpenedEvent, times(1)).fire(any(ResourceOpenedEvent.class));

    assertNotNull(content.getModel());
    assertEquals(overview, content.getOverview());
  }
  @Test
  public void testListDecisionTablesInPackage() {
    final Path path = mock(Path.class);
    when(path.toURI()).thenReturn("default://project/src/main/resources/dtable1.gdst");

    resolvedPaths.add(makeNioPath("default://project/src/main/resources/dtable1.gdst"));
    resolvedPaths.add(makeNioPath("default://project/src/main/resources/dtable2.gdst"));
    resolvedPaths.add(makeNioPath("default://project/src/main/resources/dtable3.gdst"));
    resolvedPaths.add(makeNioPath("default://project/src/main/resources/pupa.smurf"));

    final List<Path> paths = service.listDecisionTablesInPackage(path);

    assertNotNull(paths);
    assertEquals(3, paths.size());
    final Set<String> fileNames = new HashSet<>();
    fileNames.addAll(
        paths.stream().collect(Collectors.mapping(Path::getFileName, Collectors.toSet())));
    assertTrue(fileNames.contains("dtable1.gdst"));
    assertTrue(fileNames.contains("dtable2.gdst"));
    assertTrue(fileNames.contains("dtable3.gdst"));
  }
  @Test
  @SuppressWarnings("unchecked")
  public void checkSave() {
    final Path path = mock(Path.class);
    final GuidedDecisionTableEditorGraphModel model = new GuidedDecisionTableEditorGraphModel();
    final Metadata metadata = mock(Metadata.class);
    final String comment = "comment";
    when(path.toURI())
        .thenReturn(
            "default://project/src/main/resources/mypackage/dtable."
                + dtGraphResourceType.getSuffix());

    service.save(path, model, metadata, comment);

    verify(ioService, times(1))
        .write(
            any(org.uberfire.java.nio.file.Path.class),
            any(String.class),
            any(Map.class),
            any(CommentedOption.class));
  }
  @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("default://project/src/main/resources/mypackage");

    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()));
  }