@Test
public void testCheckPermission() throws Exception {

    Session delegate = mock(Session.class);
    SessionFacade<Session> facade = getFacade(delegate);
    final CompletableFuture<String> latch = new CompletableFuture<>();
    doAnswer(invoke -> latch.complete("done"))
            .when(delegate).checkPermission("/correct/path", Session.ACTION_READ);
    facade.checkPermission("", "");
    assertFalse("should not be done", latch.isDone());
    facade.checkPermission("/correct/path", Session.ACTION_READ);
    assertEquals("should be done", "done", latch.getNow(""));
}