### Question:
ExpandoColumnResolversImpl implements ExpandoColumnResolvers { @Override public DataFetcher<ExpandoColumn> deleteExpandoColumnDataFetcher() { return environment -> { long columnId = util.getLongArg(environment, "columnId"); return expandoColumnLocalService.deleteExpandoColumn(columnId); }; }  @Reference(unbind = "-") void setExpandoColumnLocalService(ExpandoColumnLocalService expandoColumnLocalService); @Reference void setUtil(GraphQLUtil util); @Override DataFetcher<List<ExpandoColumn>> getExpandoColumnsDataFetcher(); @Override DataFetcher<CompletableFuture<ExpandoColumn>> getExpandoColumnDataFetcher(); @Override DataFetcher<ExpandoColumn> createExpandoColumnDataFetcher(); @Override DataFetcher<ExpandoColumn> updateExpandoColumnDataFetcher(); @Override DataFetcher<ExpandoColumn> deleteExpandoColumnDataFetcher();  }### Answer:
@Test public void deleteExpandoColumnDataFetcher_should_return_deleted_object() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("columnId", COLUMN_ID); DataFetchingEnvironment environment = getTestEnvironment(arguments); ExpandoColumn expectedResult = mock(ExpandoColumn.class); expectedResult.setColumnId(COLUMN_ID); useMockGraphQLUtil(environment, true); when(localService.deleteExpandoColumn(eq(COLUMN_ID))) .thenReturn(expectedResult); ExpandoColumn result = resolvers.deleteExpandoColumnDataFetcher() .get(environment); assertNotNull(result); assertEquals(expectedResult, result); }
@Test(expected = NoSuchColumnException.class) public void deleteExpandoColumnDataFetcher_without_args_should_return_null_with_exception() throws Exception { DataFetchingEnvironment environment = getTestEnvironment(null); ExpandoColumn expectedResult = mock(ExpandoColumn.class); expectedResult.setColumnId(COLUMN_ID); useMockGraphQLUtil(environment, true); when(localService.deleteExpandoColumn(eq(COLUMN_ID))) .thenThrow(NoSuchColumnException.class); ExpandoColumn result = resolvers.deleteExpandoColumnDataFetcher() .get(environment); assertNull(result); }
@Test(expected = NoSuchColumnException.class) public void deleteExpandoColumnDataFetcher_with_invalid_id_should_return_null_with_exception() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("columnId", 789456L); DataFetchingEnvironment environment = getTestEnvironment(arguments); ExpandoColumn expectedResult = mock(ExpandoColumn.class); expectedResult.setColumnId(COLUMN_ID); useMockGraphQLUtil(environment, false); when(graphQLUtil.getLongArg(eq(environment), eq("columnId"))) .thenReturn(789456L); when(localService.deleteExpandoColumn(eq(789456L))) .thenThrow(NoSuchColumnException.class); ExpandoColumn result = resolvers.deleteExpandoColumnDataFetcher() .get(environment); assertNull(result); }