### Question:
ExpandoTableResolversImpl implements ExpandoTableResolvers { @Override public DataFetcher<ExpandoTable> createExpandoTableDataFetcher() { return environment -> { long companyId = util.getLongArg(environment, "companyId"); String className = util.getStringArg(environment, "className"); String name = util.getStringArg(environment, "name"); return expandoTableLocalService.addTable( companyId, className, name); }; }  @Reference(unbind = "-") void setExpandoTableLocalService(ExpandoTableLocalService expandoTableLocalService); @Reference void setUtil(GraphQLUtil util); @Override DataFetcher<List<ExpandoTable>> getExpandoTablesDataFetcher(); @Override DataFetcher<CompletableFuture<ExpandoTable>> getExpandoTableDataFetcher(); @Override DataFetcher<ExpandoTable> createExpandoTableDataFetcher(); @Override DataFetcher<ExpandoTable> updateExpandoTableDataFetcher(); @Override DataFetcher<ExpandoTable> deleteExpandoTableDataFetcher();  }### Answer:
@Test public void createExpandoTableDataFetcher_should_return_new_object() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("companyId", COMPANY_ID); arguments.put("className", CLASS_NAME); arguments.put("name", NAME); DataFetchingEnvironment environment = getTestEnvironment(arguments); ExpandoTable expectedResult = mock(ExpandoTable.class); expectedResult.setTableId(TABLE_ID); expectedResult.setCompanyId(COMPANY_ID); expectedResult.setClassName(CLASS_NAME); expectedResult.setName(NAME); useMockGraphQLUtil(environment, true); when(localService.addTable(eq(COMPANY_ID), eq(CLASS_NAME), eq(NAME))) .thenReturn(expectedResult); ExpandoTable result = resolvers.createExpandoTableDataFetcher() .get(environment); assertNotNull(result); assertEquals(expectedResult, result); }
@Test(expected = PortalException.class) public void createExpandoTableDataFetcher_without_args_should_throw_validation_exception() throws Exception { DataFetchingEnvironment environment = getTestEnvironment(null); useMockGraphQLUtil(environment, false); when(localService.addTable(anyLong(), anyString(), anyString())) .thenThrow(PortalException.class); ExpandoTable result = resolvers.createExpandoTableDataFetcher() .get(environment); assertNull(result); }