### Question:
ExpandoColumnResolversImpl implements ExpandoColumnResolvers { @Override public DataFetcher<ExpandoColumn> createExpandoColumnDataFetcher() { return environment -> { long tableId = util.getLongArg(environment, "tableId"); String name = util.getStringArg(environment, "name"); int type = util.getIntArg(environment, "type", ExpandoColumnConstants.STRING); return expandoColumnLocalService.addColumn( tableId, name, type, null); }; }  @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 createExpandoColumnDataFetcher_should_return_new_object() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("tableId", TABLE_ID); arguments.put("name", NAME); arguments.put("type", TYPE); DataFetchingEnvironment environment = getTestEnvironment(arguments); ExpandoColumn expectedResult = mock(ExpandoColumn.class); expectedResult.setColumnId(COLUMN_ID); expectedResult.setTableId(TABLE_ID); expectedResult.setName(NAME); expectedResult.setType(TYPE); useMockGraphQLUtil(environment, true); when(localService.addColumn(eq(TABLE_ID), eq(NAME), eq(TYPE), any())) .thenReturn(expectedResult); ExpandoColumn result = resolvers.createExpandoColumnDataFetcher() .get(environment); assertNotNull(result); assertEquals(expectedResult, result); }
@Test(expected = PortalException.class) public void createExpandoColumnDataFetcher_without_args_should_throw_validation_exception() throws Exception { DataFetchingEnvironment environment = getTestEnvironment(null); useMockGraphQLUtil(environment, false); when(localService.addColumn(anyLong(), anyString(), anyInt(), any())) .thenThrow(PortalException.class); ExpandoColumn result = resolvers.createExpandoColumnDataFetcher() .get(environment); assertNull(result); }