### Question:
AssetLinkResolversImpl implements AssetLinkResolvers { @Override public DataFetcher<AssetLink> updateAssetLinkDataFetcher() { return environment -> { long userId = util.getLongArg(environment, "userId", util.getDefaultUserId()); long entryId1 = util.getLongArg(environment, "entryId1"); long entryId2 = util.getLongArg(environment, "entryId2"); int type = util.getIntArg(environment, "type", AssetLinkConstants.TYPE_RELATED); int weight = util.getIntArg(environment, "weight"); return assetLinkLocalService.updateLink( userId, entryId1, entryId2, type, weight); }; }  @Reference(unbind = "-") void setAssetLinkLocalService(AssetLinkLocalService assetLinkLocalService); @Reference void setUtil(GraphQLUtil util); @Override DataFetcher<List<AssetLink>> getAssetLinksDataFetcher(); @Override DataFetcher<CompletableFuture<AssetLink>> getAssetLinkDataFetcher(); @Override DataFetcher<AssetLink> createAssetLinkDataFetcher(); @Override DataFetcher<AssetLink> updateAssetLinkDataFetcher(); @Override DataFetcher<AssetLink> deleteAssetLinkDataFetcher();  }### Answer:
@Test public void updateAssetLinkDataFetcher_should_return_updated_object() throws Exception { Map<String, Object> arguments = new HashMap<>(); arguments.put("userId", USER_ID); arguments.put("entryId1", ENTRY_ID1); arguments.put("entryId2", ENTRY_ID2); arguments.put("type", TYPE); arguments.put("weight", WEIGHT); DataFetchingEnvironment environment = getTestEnvironment(arguments); AssetLink expectedResult = mock(AssetLink.class); expectedResult.setUserId(USER_ID); expectedResult.setLinkId(LINK_ID); expectedResult.setEntryId1(ENTRY_ID1); expectedResult.setEntryId2(ENTRY_ID2); expectedResult.setType(TYPE); expectedResult.setWeight(WEIGHT); useMockGraphQLUtil(environment, USER_ID, true); when(localService.updateLink(eq(USER_ID), eq(ENTRY_ID1), eq(ENTRY_ID2), eq(TYPE), eq(WEIGHT))) .thenReturn(expectedResult); AssetLink result = resolvers.updateAssetLinkDataFetcher() .get(environment); assertNotNull(result); assertEquals(expectedResult, result); }
@Test(expected = PortalException.class) public void updateAssetLinkDataFetcher_without_args_should_throw_validation_exception() throws Exception { DataFetchingEnvironment environment = getTestEnvironment(null); useMockGraphQLUtil(environment, DEFAULT_USER_ID, false); when(graphQLUtil.getLongArg(eq(environment), eq("linkId"))) .thenReturn(LINK_ID); when(localService.updateLink(anyLong(), anyLong(), anyLong(), anyInt(), anyInt())) .thenThrow(PortalException.class); AssetLink result = resolvers.updateAssetLinkDataFetcher() .get(environment); assertNull(result); }