use of com.amazonaws.mobileconnectors.pinpoint.targeting.endpointProfile.EndpointProfileDemographic in project aws-sdk-android by aws-amplify.
the class EndpointProfileTest method testProfile.
@Test
public void testProfile() {
assertTrue(target.getAllAttributes().isEmpty());
assertEquals(mockContext.getSystem().getAppDetails().getAppId(), target.getApplicationId());
assertEquals(UNIQUE_ID, target.getEndpointId());
assertEquals(mockContext.getSystem().getAppDetails().versionName(), target.getDemographic().getAppVersion());
assertEquals(mockContext.getApplicationContext().getResources().getConfiguration().locale.toString(), target.getDemographic().getLocale().toString());
assertEquals(mockContext.getSystem().getDeviceDetails().manufacturer(), target.getDemographic().getMake());
assertEquals(Build.MODEL, target.getDemographic().getModel());
assertEquals("ANDROID", target.getDemographic().getPlatform());
assertEquals(Build.VERSION.RELEASE, target.getDemographic().getPlatformVersion());
assertEquals(TimeZone.getDefault().getID(), target.getDemographic().getTimezone());
assertNotNull(target.getEffectiveDate());
assertNotNull(target.getLocation());
assertEquals(target.getOptOut(), "ALL");
assertNull(target.getAddress());
assertEquals(target.getDemographic().getPlatform(), "ANDROID");
assertEquals(target.getChannelType(), "GCM");
assertFalse(target.hasAttribute(""));
assertFalse(target.hasAttribute(null));
assertFalse(target.hasMetric(""));
assertFalse(target.hasMetric(null));
target.setDemographic(null);
assertNull(target.getDemographic());
target.setLocation(null);
assertNull(target.getLocation());
target.setEffectiveDate(0);
assertNotNull(target.getEffectiveDate());
target.setUser(null);
assertNull(target.getUser());
final EndpointProfileDemographic demographic = new EndpointProfileDemographic(mockContext);
demographic.setMake("test");
demographic.setModel("test");
demographic.setTimezone("test");
demographic.setLocale(new Locale("en", "US"));
demographic.setAppVersion("test");
demographic.setPlatform("test");
demographic.setPlatformVersion("test");
target.setDemographic(demographic);
assertEquals(demographic, target.getDemographic());
final EndpointProfileLocation location = new EndpointProfileLocation(mockContext);
location.setLatitude(0.0);
location.setLongitude(0.0);
location.setPostalCode("test");
location.setCity("test");
location.setRegion("test");
location.setCountry("test");
target.setLocation(location);
assertEquals(location, target.getLocation());
}
use of com.amazonaws.mobileconnectors.pinpoint.targeting.endpointProfile.EndpointProfileDemographic in project aws-sdk-android by aws-amplify.
the class EndpointProfileTest method testLocaleWithInvalidISO3Code.
@Test
public void testLocaleWithInvalidISO3Code() {
final TargetingClient targetingClient = new TargetingClient(mockContext, mock(ThreadPoolExecutor.class));
final EndpointProfile endpointProfile = targetingClient.currentEndpoint();
final EndpointProfileDemographic demographic = endpointProfile.getDemographic();
// Old country code for Serbia and Montenegro that has no ISO3 equivalent.
// See https://en.wikipedia.org/wiki/ISO_3166-2:CS for more info
Locale locale = new Locale("en", "CS");
demographic.setLocale(locale);
assertTrue(demographic.getLocale().toString().equalsIgnoreCase(locale.toString()));
targetingClient.updateEndpointProfile(endpointProfile);
}
Aggregations