### Question:
RepositoryContext { public ListenableFuture<List<GenericJson>> postApiOperationAsync(ApiOperation operation) { AsyncApiOperation asyncApiOperation = new AsyncApiOperation(operation); eventBus.post(asyncApiOperation); return asyncApiOperation.getResult(); } private  RepositoryContext(Builder builder); @Deprecated() void postAsyncOperation(AsyncApiOperation operation); ListenableFuture<List<GenericJson>> postApiOperationAsync(ApiOperation operation); DefaultAclMode getDefaultAclMode();  }### Answer:
@Test public void invokePostApiOperationAsync_resultIsSet() throws Exception { ListenableFuture<List<GenericJson>> result = Futures.immediateFuture(ImmutableList.of()); doAnswer(invocation -> { AsyncApiOperation asyncApiOperation = invocation.getArgument(0); asyncApiOperation.setResult(result); return null; }).when(mockEventBus).post(any()); ApiOperation apiOperation = ApiOperations.deleteItem(DOC_ID); ListenableFuture<List<GenericJson>> res = repositoryContext.postApiOperationAsync(apiOperation); ArgumentCaptor<AsyncApiOperation> argumentCaptor = ArgumentCaptor.forClass(AsyncApiOperation.class); verify(mockEventBus).post(argumentCaptor.capture()); assertSame(argumentCaptor.getValue().getOperation(), apiOperation); assertSame(result.get(), res.get()); }