### Question:
TargetingClient { public void updateEndpointProfile() { this.executeUpdate(this.currentEndpoint()); } TargetingClient(final PinpointContext context,
                           ExecutorService executor);  TargetingClient(final PinpointContext context); EndpointProfile currentEndpoint(); void updateEndpointProfile(); @SuppressWarnings("checkstyle:hiddenfield") void updateEndpointProfile(EndpointProfile endpointProfile); void addAttribute(final String attributeName, final List<String> attributeValues); void removeAttribute(final String attributeName); void addMetric(String metricName, Double metricValue); void removeMetric(String metricName);  }### Answer:
@Test public void updateEndpoint_enqueueEndpointForDeliveryCalled() { targetingClient.updateEndpointProfile(); verifyAndRunExecutorService(1); verify(mockPinpointServiceClient, times(1)) .updateEndpoint(any(UpdateEndpointRequest.class)); }
@Test public void updateEndpointCallNullSetters() { EndpointProfile profile = new EndpointProfile(mockContext); profile.getDemographic().setLocale(null); profile.getDemographic().setAppVersion(null); profile.getDemographic().setMake(null); profile.getDemographic().setModel(null); profile.getDemographic().setPlatform(null); profile.getDemographic().setPlatformVersion(null); profile.getDemographic().setTimezone(null); profile.getLocation().setCountry(null); profile.getLocation().setCity(null); profile.getLocation().setLatitude(null); profile.getLocation().setLongitude(null); profile.getLocation().setPostalCode(null); profile.getLocation().setRegion(null); targetingClient.updateEndpointProfile(profile); }
@Test public void updateEndpointNullUserId() { final ArgumentCaptor<UpdateEndpointRequest> requestArgumentCaptor = ArgumentCaptor.forClass(UpdateEndpointRequest.class); targetingClient.updateEndpointProfile(); verifyAndRunExecutorService(1); verify(mockPinpointServiceClient, times(1)) .updateEndpoint(requestArgumentCaptor.capture()); for (final UpdateEndpointRequest request : requestArgumentCaptor.getAllValues()) { assertNull(request.getEndpointRequest().getUser()); } }
@Test public void updateEndpointEmptyUserId() { final ArgumentCaptor<UpdateEndpointRequest> requestArgumentCaptor = ArgumentCaptor.forClass(UpdateEndpointRequest.class); EndpointProfile endpointProfile = new EndpointProfile(mockContext); EndpointProfileUser user = new EndpointProfileUser(); user.setUserId(""); endpointProfile.setUser(user); targetingClient.updateEndpointProfile(endpointProfile); verifyAndRunExecutorService(1); verify(mockPinpointServiceClient, times(1)) .updateEndpoint(requestArgumentCaptor.capture()); for (final UpdateEndpointRequest request : requestArgumentCaptor.getAllValues()) { assertNotNull(request.getEndpointRequest().getUser()); assertEquals(request.getEndpointRequest().getUser().getUserId(), ""); } }