### Question:
DLFileEntryTypeResolversImpl implements DLFileEntryTypeResolvers { @Override public DataFetcher<CompletableFuture<DLFileEntryType>> getDLFileEntryTypeDataFetcher() { return environment -> { long fileEntryTypeId = getFileEntryTypeId(environment); if (fileEntryTypeId <= 0) { return null; } DataLoader<Long, DLFileEntryType> dataLoader = environment.getDataLoader(DLFileEntryTypeBatchLoader.KEY); return dataLoader.load(fileEntryTypeId); }; }  @Reference(unbind = "-") void setDLFileEntryTypeLocalService(DLFileEntryTypeLocalService dlFileEntryTypeLocalService); @Reference void setUtil(GraphQLUtil util); @Override DataFetcher<List<DLFileEntryType>> getDLFileEntryTypesDataFetcher(); @Override DataFetcher<List<DLFileEntryType>> getDLFileEntryTypesForFolderDataFetcher(); @Override DataFetcher<CompletableFuture<DLFileEntryType>> getDLFileEntryTypeDataFetcher(); @Override DataFetcher<DLFileEntryType> createDLFileEntryTypeDataFetcher(); @Override DataFetcher<DLFileEntryType> updateDLFileEntryTypeDataFetcher(); @Override DataFetcher<DLFileEntryType> deleteDLFileEntryTypeDataFetcher();  }### Answer:
@Test public void getDLFileEntryTypeDataFetcher_should_return_the_searched_object() throws Exception { DLFileEntryType expectedResult = mock(DLFileEntryType.class); expectedResult.setFileEntryTypeId(FILE_ENTRY_TYPE_ID); useSimpleGraphQLUtil(); when(mockEnvironment.getArgument("fileEntryTypeId")) .thenReturn(FILE_ENTRY_TYPE_ID); when(dataLoader.load(FILE_ENTRY_TYPE_ID)) .thenReturn(CompletableFuture.supplyAsync(() -> expectedResult)); CompletableFuture<DLFileEntryType> asyncResult = resolvers.getDLFileEntryTypeDataFetcher() .get(mockEnvironment); assertNotNull(asyncResult); DLFileEntryType result = asyncResult.get(); assertNotNull(result); assertEquals(expectedResult, result); }
@Test public void getDLFileEntryTypeDataFetcher_no_specified_id_should_return_null() throws Exception { when(mockEnvironment.getArgument("fileEntryTypeId")) .thenReturn(0L); CompletableFuture<DLFileEntryType> asyncResult = resolvers.getDLFileEntryTypeDataFetcher() .get(mockEnvironment); assertNull(asyncResult); }
@Test public void getDLFileEntryTypeDataFetcher_with_unknown_id_should_return_null() throws Exception { useSimpleGraphQLUtil(); when(mockEnvironment.getArgument("fileEntryTypeId")) .thenReturn(FILE_ENTRY_TYPE_ID); when(dataLoader.load(FILE_ENTRY_TYPE_ID)) .thenReturn(CompletableFuture.supplyAsync(() -> null)); CompletableFuture<DLFileEntryType> asyncResult = resolvers.getDLFileEntryTypeDataFetcher() .get(mockEnvironment); assertNotNull(asyncResult); DLFileEntryType result = asyncResult.get(); assertNull(result); }