### Question:
JournalFeedResolversImpl implements JournalFeedResolvers { @Override public DataFetcher<JournalFeed> deleteJournalFeedDataFetcher() { return environment -> { long id = util.getLongArg(environment, "id"); return journalFeedLocalService.deleteJournalFeed(id); }; }  @Reference(unbind = "-") void setJournalFeedLocalService(JournalFeedLocalService journalFeedLocalService); @Reference void setUtil(GraphQLUtil util); @Override DataFetcher<List<JournalFeed>> getJournalFeedsDataFetcher(); @Override DataFetcher<CompletableFuture<JournalFeed>> getJournalFeedDataFetcher(); @Override DataFetcher<JournalFeed> createJournalFeedDataFetcher(); @Override DataFetcher<JournalFeed> updateJournalFeedDataFetcher(); @Override DataFetcher<JournalFeed> deleteJournalFeedDataFetcher();  }### Answer:
@Test public void deleteJournalFeedDataFetcher_should_return_deleted_object() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("id", ID); DataFetchingEnvironment environment = getTestEnvironment(arguments); JournalFeed expectedResult = mock(JournalFeed.class); expectedResult.setId(ID); useMockGraphQLUtil(environment, USER_ID, true); when(localService.deleteJournalFeed(eq(ID))) .thenReturn(expectedResult); JournalFeed result = resolvers.deleteJournalFeedDataFetcher() .get(environment); assertNotNull(result); assertEquals(expectedResult, result); }
@Test(expected = NoSuchFeedException.class) public void deleteJournalFeedDataFetcher_without_args_should_return_null_with_exception() throws Exception { DataFetchingEnvironment environment = getTestEnvironment(null); JournalFeed expectedResult = mock(JournalFeed.class); expectedResult.setId(ID); useMockGraphQLUtil(environment, USER_ID, true); when(localService.deleteJournalFeed(eq(ID))) .thenThrow(NoSuchFeedException.class); JournalFeed result = resolvers.deleteJournalFeedDataFetcher() .get(environment); assertNull(result); }
@Test(expected = NoSuchFeedException.class) public void deleteJournalFeedDataFetcher_with_invalid_id_should_return_null_with_exception() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("id", 789456L); DataFetchingEnvironment environment = getTestEnvironment(arguments); JournalFeed expectedResult = mock(JournalFeed.class); expectedResult.setId(ID); useMockGraphQLUtil(environment, USER_ID, false); when(graphQLUtil.getLongArg(eq(environment), eq("id"))) .thenReturn(789456L); when(localService.deleteJournalFeed(eq(789456L))) .thenThrow(NoSuchFeedException.class); JournalFeed result = resolvers.deleteJournalFeedDataFetcher() .get(environment); assertNull(result); }