use of com.amplifyframework.analytics.AnalyticsProperties in project amplify-android by aws-amplify.
the class AnalyticsPinpointInstrumentedTest method testIdentifyUserWithUserAtrributes.
/**
* {@link AWSPinpointUserProfile} extends {@link UserProfile} to include
* {@link AWSPinpointUserProfile#userAttributes} which is specific to Pinpoint. This test is very
* similar to testIdentifyUserWithDefaultProfile, but it adds user attributes in additional
* to the endpoint attributes.
*/
@Test
public void testIdentifyUserWithUserAtrributes() {
UserProfile.Location location = getTestLocation();
AnalyticsProperties properties = getEndpointProperties();
AnalyticsProperties userAttributes = getUserAttributes();
AWSPinpointUserProfile pinpointUserProfile = AWSPinpointUserProfile.builder().name("test-user").email("user@test.com").plan("test-plan").location(location).customProperties(properties).userAttributes(userAttributes).build();
Amplify.Analytics.identifyUser("userId", pinpointUserProfile);
EndpointProfile endpointProfile = targetingClient.currentEndpoint();
assertCommonEndpointProfileProperties(endpointProfile);
assertEquals("User attribute value", endpointProfile.getUser().getUserAttributes().get("SomeUserAttribute").get(0));
}
use of com.amplifyframework.analytics.AnalyticsProperties in project amplify-android by aws-amplify.
the class AnalyticsPinpointInstrumentedTest method testIdentifyUserWithDefaultProfile.
/**
* The {@link AnalyticsCategory#identifyUser(String, UserProfile)} method should set
* an {@link EndpointProfile} on the Pinpoint {@link TargetingClient}, containing
* all provided Amplify attributes.
*/
@Test
public void testIdentifyUserWithDefaultProfile() {
UserProfile.Location location = getTestLocation();
AnalyticsProperties properties = getEndpointProperties();
UserProfile userProfile = UserProfile.builder().name("test-user").email("user@test.com").plan("test-plan").location(location).customProperties(properties).build();
Amplify.Analytics.identifyUser("userId", userProfile);
EndpointProfile endpointProfile = targetingClient.currentEndpoint();
assertCommonEndpointProfileProperties(endpointProfile);
assertNull(endpointProfile.getUser().getUserAttributes());
}
Aggregations