QueryFacade implements Query { @Override public void bindValue(String varName, Value value) throws IllegalArgumentException, RepositoryException { delegate.bindValue(varName, value); } 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 testBindValue() throws Exception { Query delegate = mock(Query.class); QueryFacade<Query, Session> facade = getFacade(delegate); CompletableFuture<Map.Entry<String, Value>> latch = new CompletableFuture<>(); doAnswer(invoked -> latch.complete(Fun.toEntry(invoked.getArgument(0), invoked.getArgument(1)))) .when(delegate).bindValue(anyString(), any(Value.class)); final String varName = "foo"; final Value value = mock(Value.class); facade.bindValue(varName, value); final Map.Entry<String, Value> fromLatch = latch.getNow(Fun.toEntry("", mock(Value.class))); assertSame("same key in latch", varName, fromLatch.getKey()); assertSame("same value in latch", value, fromLatch.getValue()); }