### Question:
AssetQueryService { public Invoker<AssetQueryResult> getAssets(ProjectAssetsQuery query) { return new Invoker<>(libraryService -> libraryService.getProjectAssets(query), () -> tokenForGetProjectAssets, newToken -> tokenForGetProjectAssets = newToken); } @Inject  AssetQueryService(final Caller<LibraryService> libraryServiceCaller); Invoker<AssetQueryResult> getAssets(ProjectAssetsQuery query); Invoker<Integer> getNumberOfAssets(ProjectAssetsQuery query);  }### Answer:
@Test public void onlyLatestGetAssetCallbackIsInvocable() throws Exception { final boolean[] observed = { false, false }; assetQueryService.getAssets(query).call(ignore -> { throw new AssertionError("First callback should not be invoked."); }, (msg, error) -> { throw new AssertionError("First error callback should not be invoked."); }); assetQueryService.getAssets(query).call(ignore -> observed[0] = true, (msg, error) -> observed[1] = true); RemoteCallback<?> firstCallback = remoteCallbacks.get(0); ErrorCallback<Message> firstErrorCallback = errorCallbacks.get(0); RemoteCallback<?> secondCallback = remoteCallbacks.get(1); ErrorCallback<Message> secondErrorCallback = errorCallbacks.get(1); firstCallback.callback(null); firstErrorCallback.error(null, null); secondCallback.callback(null); assertTrue("Latest callback not invoked.", observed[0]); secondErrorCallback.error(null, null); assertTrue("Latest error callback not invoked.", observed[1]); }