### Question:
DLFolderResolversImpl implements DLFolderResolvers { @Override public DataFetcher<DLFolder> deleteDLFolderDataFetcher() { return environment -> { long folderId = util.getLongArg(environment, "folderId"); return dlFolderLocalService.deleteDLFolder(folderId); }; }  @Reference(unbind = "-") void setDLFolderLocalService(DLFolderLocalService dlFolderLocalService); @Reference void setUtil(GraphQLUtil util); @Override DataFetcher<List<DLFolder>> getDLFoldersDataFetcher(); @Override DataFetcher<List<DLFolder>> getDLFoldersForTypeDataFetcher(); @Override DataFetcher<CompletableFuture<DLFolder>> getDLFolderDataFetcher(); @Override DataFetcher<DLFolder> createDLFolderDataFetcher(); @Override DataFetcher<DLFolder> updateDLFolderDataFetcher(); @Override DataFetcher<DLFolder> deleteDLFolderDataFetcher();  }### Answer:
@Test public void deleteDLFolderDataFetcher_should_return_deleted_object() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("folderId", FOLDER_ID); DataFetchingEnvironment environment = getTestEnvironment(arguments); DLFolder expectedResult = mock(DLFolder.class); expectedResult.setFolderId(FOLDER_ID); useMockGraphQLUtil(environment, USER_ID, true); when(localService.deleteDLFolder(eq(FOLDER_ID))) .thenReturn(expectedResult); DLFolder result = resolvers.deleteDLFolderDataFetcher() .get(environment); assertNotNull(result); assertEquals(expectedResult, result); }
@Test(expected = NoSuchFolderException.class) public void deleteDLFolderDataFetcher_without_args_should_return_null_with_exception() throws Exception { DataFetchingEnvironment environment = getTestEnvironment(null); DLFolder expectedResult = mock(DLFolder.class); expectedResult.setFolderId(FOLDER_ID); useMockGraphQLUtil(environment, USER_ID, true); when(localService.deleteDLFolder(eq(FOLDER_ID))) .thenThrow(NoSuchFolderException.class); DLFolder result = resolvers.deleteDLFolderDataFetcher() .get(environment); assertNull(result); }
@Test(expected = NoSuchFolderException.class) public void deleteDLFolderDataFetcher_with_invalid_id_should_return_null_with_exception() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("folderId", 789456L); DataFetchingEnvironment environment = getTestEnvironment(arguments); DLFolder expectedResult = mock(DLFolder.class); expectedResult.setFolderId(FOLDER_ID); useMockGraphQLUtil(environment, USER_ID, false); when(graphQLUtil.getLongArg(eq(environment), eq("folderId"))) .thenReturn(789456L); when(localService.deleteDLFolder(eq(789456L))) .thenThrow(NoSuchFolderException.class); DLFolder result = resolvers.deleteDLFolderDataFetcher() .get(environment); assertNull(result); }