### Question:
ExpandoRowResolversImpl implements ExpandoRowResolvers { @Override public DataFetcher<ExpandoRow> createExpandoRowDataFetcher() { return environment -> { long tableId = util.getLongArg(environment, "tableId"); long classPK = util.getLongArg(environment, "classPK"); return expandoRowLocalService.addRow( tableId, classPK); }; }  @Reference(unbind = "-") void setExpandoRowLocalService(ExpandoRowLocalService expandoRowLocalService); @Reference void setUtil(GraphQLUtil util); @Override DataFetcher<List<ExpandoRow>> getExpandoRowsDataFetcher(); @Override DataFetcher<CompletableFuture<ExpandoRow>> getExpandoRowDataFetcher(); @Override DataFetcher<ExpandoRow> createExpandoRowDataFetcher(); @Override DataFetcher<ExpandoRow> deleteExpandoRowDataFetcher();  }### Answer:
@Test public void createExpandoRowDataFetcher_should_return_new_object() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("tableId", TABLE_ID); arguments.put("classPK", CLASS_PK); DataFetchingEnvironment environment = getTestEnvironment(arguments); ExpandoRow expectedResult = mock(ExpandoRow.class); expectedResult.setRowId(ROW_ID); expectedResult.setTableId(TABLE_ID); expectedResult.setClassPK(CLASS_PK); useMockGraphQLUtil(environment, true); when(localService.addRow(eq(TABLE_ID), eq(CLASS_PK))) .thenReturn(expectedResult); ExpandoRow result = resolvers.createExpandoRowDataFetcher() .get(environment); assertNotNull(result); assertEquals(expectedResult, result); }
@Test(expected = PortalException.class) public void createExpandoRowDataFetcher_without_args_should_throw_validation_exception() throws Exception { DataFetchingEnvironment environment = getTestEnvironment(null); useMockGraphQLUtil(environment, false); when(localService.addRow(anyLong(), anyLong())) .thenThrow(PortalException.class); ExpandoRow result = resolvers.createExpandoRowDataFetcher() .get(environment); assertNull(result); }