### Question:
BlogsEntryResolversImpl implements BlogsEntryResolvers { @Override public DataFetcher<BlogsEntry> deleteBlogsEntryDataFetcher() { return environment -> { long entryId = util.getLongArg(environment, "entryId"); return blogsEntryLocalService.deleteBlogsEntry(entryId); }; }  @Reference(unbind = "-") void setBlogsEntryLocalService(BlogsEntryLocalService blogsEntryLocalService); @Reference void setUtil(GraphQLUtil util); @Override DataFetcher<List<BlogsEntry>> getBlogsEntriesDataFetcher(); @Override DataFetcher<CompletableFuture<BlogsEntry>> getBlogsEntryDataFetcher(); @Override DataFetcher<BlogsEntry> createBlogsEntryDataFetcher(); @Override DataFetcher<BlogsEntry> updateBlogsEntryDataFetcher(); @Override DataFetcher<BlogsEntry> deleteBlogsEntryDataFetcher();  }### Answer:
@Test(expected = NoSuchEntryException.class) public void deleteBlogsEntryDataFetcher_with_invalid_id_should_return_null_with_exception() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("entryId", 789456L); DataFetchingEnvironment environment = getTestEnvironment(arguments); BlogsEntry expectedResult = mock(BlogsEntry.class); expectedResult.setEntryId(ENTRY_ID); useMockGraphQLUtil(environment, USER_ID, false); when(graphQLUtil.getLongArg(eq(environment), eq("entryId"))) .thenReturn(789456L); when(localService.deleteBlogsEntry(eq(789456L))) .thenThrow(NoSuchEntryException.class); BlogsEntry result = resolvers.deleteBlogsEntryDataFetcher() .get(environment); assertNull(result); }
@Test public void deleteBlogsEntryDataFetcher_should_return_deleted_object() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("entryId", ENTRY_ID); DataFetchingEnvironment environment = getTestEnvironment(arguments); BlogsEntry expectedResult = mock(BlogsEntry.class); expectedResult.setEntryId(ENTRY_ID); useMockGraphQLUtil(environment, USER_ID, true); when(localService.deleteBlogsEntry(eq(ENTRY_ID))) .thenReturn(expectedResult); BlogsEntry result = resolvers.deleteBlogsEntryDataFetcher() .get(environment); assertNotNull(result); assertEquals(expectedResult, result); }
@Test(expected = NoSuchEntryException.class) public void deleteBlogsEntryDataFetcher_without_args_should_return_null_with_exception() throws Exception { DataFetchingEnvironment environment = getTestEnvironment(null); BlogsEntry expectedResult = mock(BlogsEntry.class); expectedResult.setEntryId(ENTRY_ID); useMockGraphQLUtil(environment, USER_ID, true); when(localService.deleteBlogsEntry(eq(ENTRY_ID))) .thenThrow(NoSuchEntryException.class); BlogsEntry result = resolvers.deleteBlogsEntryDataFetcher() .get(environment); assertNull(result); }