### Question:
ExpandoValueResolversImpl implements ExpandoValueResolvers { @Override public DataFetcher<CompletableFuture<ExpandoValue>> getExpandoValueDataFetcher() { return environment -> { long valueId = util.getLongArg(environment, "valueId"); if (valueId <= 0) { return null; } DataLoader<Long, ExpandoValue> dataLoader = environment.getDataLoader(ExpandoValueBatchLoader.KEY); return dataLoader.load(valueId); }; }  @Reference(unbind = "-") void setExpandoValueLocalService(ExpandoValueLocalService expandoValueLocalService); @Reference void setUtil(GraphQLUtil util); @Override DataFetcher<List<ExpandoValue>> getExpandoValuesDataFetcher(); @Override DataFetcher<CompletableFuture<ExpandoValue>> getExpandoValueDataFetcher(); @Override DataFetcher<ExpandoValue> createExpandoValueForStringDataFetcher(); @Override DataFetcher<ExpandoValue> createExpandoValueForIntDataFetcher(); @Override DataFetcher<ExpandoValue> createExpandoValueForLongDataFetcher(); @Override DataFetcher<ExpandoValue> createExpandoValueForDoubleDataFetcher(); @Override DataFetcher<ExpandoValue> createExpandoValueForBooleanDataFetcher(); @Override DataFetcher<ExpandoValue> deleteExpandoValueDataFetcher();  }### Answer:
@Test public void getExpandoValueDataFetcher_should_return_the_searched_object() throws Exception { ExpandoValue expectedResult = mock(ExpandoValue.class); expectedResult.setValueId(VALUE_ID); useSimpleGraphQLUtil(); when(mockEnvironment.getArgument("valueId")) .thenReturn(VALUE_ID); when(dataLoader.load(VALUE_ID)) .thenReturn(CompletableFuture.supplyAsync(() -> expectedResult)); CompletableFuture<ExpandoValue> asyncResult = resolvers.getExpandoValueDataFetcher() .get(mockEnvironment); assertNotNull(asyncResult); ExpandoValue result = asyncResult.get(); assertNotNull(result); assertEquals(expectedResult, result); }
@Test public void getExpandoValueDataFetcher_no_specified_id_should_return_null() throws Exception { when(mockEnvironment.getArgument("valueId")) .thenReturn(0L); CompletableFuture<ExpandoValue> asyncResult = resolvers.getExpandoValueDataFetcher() .get(mockEnvironment); assertNull(asyncResult); }
@Test public void getExpandoValueDataFetcher_with_unknown_id_should_return_null() throws Exception { useSimpleGraphQLUtil(); when(mockEnvironment.getArgument("valueId")) .thenReturn(VALUE_ID); when(dataLoader.load(VALUE_ID)) .thenReturn(CompletableFuture.supplyAsync(() -> null)); CompletableFuture<ExpandoValue> asyncResult = resolvers.getExpandoValueDataFetcher() .get(mockEnvironment); assertNotNull(asyncResult); ExpandoValue result = asyncResult.get(); assertNull(result); }