### Question:
ExpandoColumnResolversImpl implements ExpandoColumnResolvers { @Override public DataFetcher<CompletableFuture<ExpandoColumn>> getExpandoColumnDataFetcher() { return environment -> { long columnId = getColumnId(environment); if (columnId <= 0) { return null; } DataLoader<Long, ExpandoColumn> dataLoader = environment.getDataLoader(ExpandoColumnBatchLoader.KEY); return dataLoader.load(columnId); }; }  @Reference(unbind = "-") void setExpandoColumnLocalService(ExpandoColumnLocalService expandoColumnLocalService); @Reference void setUtil(GraphQLUtil util); @Override DataFetcher<List<ExpandoColumn>> getExpandoColumnsDataFetcher(); @Override DataFetcher<CompletableFuture<ExpandoColumn>> getExpandoColumnDataFetcher(); @Override DataFetcher<ExpandoColumn> createExpandoColumnDataFetcher(); @Override DataFetcher<ExpandoColumn> updateExpandoColumnDataFetcher(); @Override DataFetcher<ExpandoColumn> deleteExpandoColumnDataFetcher();  }### Answer:
@Test public void getExpandoColumnDataFetcher_should_return_the_searched_object() throws Exception { ExpandoColumn expectedResult = mock(ExpandoColumn.class); expectedResult.setColumnId(COLUMN_ID); useSimpleGraphQLUtil(); when(mockEnvironment.getArgument("columnId")) .thenReturn(COLUMN_ID); when(dataLoader.load(COLUMN_ID)) .thenReturn(CompletableFuture.supplyAsync(() -> expectedResult)); CompletableFuture<ExpandoColumn> asyncResult = resolvers.getExpandoColumnDataFetcher() .get(mockEnvironment); assertNotNull(asyncResult); ExpandoColumn result = asyncResult.get(); assertNotNull(result); assertEquals(expectedResult, result); }
@Test public void getExpandoColumnDataFetcher_no_specified_id_should_return_null() throws Exception { when(mockEnvironment.getArgument("columnId")) .thenReturn(0L); CompletableFuture<ExpandoColumn> asyncResult = resolvers.getExpandoColumnDataFetcher() .get(mockEnvironment); assertNull(asyncResult); }
@Test public void getExpandoColumnDataFetcher_with_unknown_id_should_return_null() throws Exception { useSimpleGraphQLUtil(); when(mockEnvironment.getArgument("columnId")) .thenReturn(COLUMN_ID); when(dataLoader.load(COLUMN_ID)) .thenReturn(CompletableFuture.supplyAsync(() -> null)); CompletableFuture<ExpandoColumn> asyncResult = resolvers.getExpandoColumnDataFetcher() .get(mockEnvironment); assertNotNull(asyncResult); ExpandoColumn result = asyncResult.get(); assertNull(result); }