### Question:
JournalFolderResolversImpl implements JournalFolderResolvers { @Override public DataFetcher<JournalFolder> deleteJournalFolderDataFetcher() { return environment -> { long folderId = util.getLongArg(environment, "folderId"); return journalFolderLocalService.deleteJournalFolder(folderId); }; }  @Reference(unbind = "-") void setJournalFolderLocalService(JournalFolderLocalService journalFolderLocalService); @Reference void setUtil(GraphQLUtil util); @Override DataFetcher<List<JournalFolder>> getJournalFoldersDataFetcher(); @Override DataFetcher<CompletableFuture<JournalFolder>> getJournalFolderDataFetcher(); @Override DataFetcher<JournalFolder> createJournalFolderDataFetcher(); @Override DataFetcher<JournalFolder> updateJournalFolderDataFetcher(); @Override DataFetcher<JournalFolder> deleteJournalFolderDataFetcher();  }### Answer:
@Test public void deleteJournalFolderDataFetcher_should_return_deleted_object() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("folderId", FOLDER_ID); DataFetchingEnvironment environment = getTestEnvironment(arguments); JournalFolder expectedResult = mock(JournalFolder.class); expectedResult.setFolderId(FOLDER_ID); useMockGraphQLUtil(environment, USER_ID, true); when(localService.deleteJournalFolder(eq(FOLDER_ID))) .thenReturn(expectedResult); JournalFolder result = resolvers.deleteJournalFolderDataFetcher() .get(environment); assertNotNull(result); assertEquals(expectedResult, result); }
@Test(expected = NoSuchFolderException.class) public void deleteJournalFolderDataFetcher_without_args_should_return_null_with_exception() throws Exception { DataFetchingEnvironment environment = getTestEnvironment(null); JournalFolder expectedResult = mock(JournalFolder.class); expectedResult.setFolderId(FOLDER_ID); useMockGraphQLUtil(environment, USER_ID, true); when(localService.deleteJournalFolder(eq(FOLDER_ID))) .thenThrow(NoSuchFolderException.class); JournalFolder result = resolvers.deleteJournalFolderDataFetcher() .get(environment); assertNull(result); }
@Test(expected = NoSuchFolderException.class) public void deleteJournalFolderDataFetcher_with_invalid_id_should_return_null_with_exception() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("folderId", 789456L); DataFetchingEnvironment environment = getTestEnvironment(arguments); JournalFolder expectedResult = mock(JournalFolder.class); expectedResult.setFolderId(FOLDER_ID); useMockGraphQLUtil(environment, USER_ID, false); when(graphQLUtil.getLongArg(eq(environment), eq("folderId"))) .thenReturn(789456L); when(localService.deleteJournalFolder(eq(789456L))) .thenThrow(NoSuchFolderException.class); JournalFolder result = resolvers.deleteJournalFolderDataFetcher() .get(environment); assertNull(result); }