QueryFacade implements Query { @Override public void setLimit(long limit) { delegate.setLimit(limit); } QueryFacade(final @NotNull Q delegate, final @NotNull SessionFacade<S> session); @Override QueryResult execute(); @Override void setLimit(long limit); @Override void setOffset(long offset); @Override String getStatement(); @Override String getLanguage(); @Override String getStoredQueryPath(); @Override void bindValue(String varName, Value value); @Override String[] getBindVariableNames(); @Override final Node storeAsNode(String absPath);  }
@Test public void testSetLimit() { Query delegate = mock(Query.class); QueryFacade<Query, Session> facade = getFacade(delegate); CompletableFuture<Long> latch = new CompletableFuture<>(); doAnswer(invoked -> latch.complete(invoked.getArgument(0))).when(delegate).setLimit(anyLong()); final long value = 42L; facade.setLimit(value); assertEquals("same value in latch", (Long) value, latch.getNow(0L)); }