@Test
public void testAccept() throws Exception {

    Node delegate = mock(Node.class);
    ItemFacade<Item, Session> facade = getFacade(delegate);
    CompletableFuture<String> pathLatch = new CompletableFuture<>();
    final String expectedPath = "/correct/path";
    when(delegate.getPath()).thenReturn(expectedPath);
    doAnswer(invoked -> {
        ((ItemVisitor) invoked.getArgument(0)).visit(delegate);
        return true;
    }).when(delegate).accept(any(ItemVisitor.class));
    facade.accept(new ItemVisitor() {
        @Override
        public void visit(final Property property) throws RepositoryException {
        }
        @Override
        public void visit(final Node node) throws RepositoryException {
            assertTrue("is facade", node instanceof NodeFacade);
            assertSame("is same as delegate", delegate, NodeFacade.unwrap(node));
            pathLatch.complete(node.getPath());
        }
    });
    assertEquals("expect path after visitor", expectedPath, pathLatch.getNow(""));
}