@Test public void testMinimizedPayloadContainsRequiredFields() { payload = new ChannelRegistrationPayload.Builder() .setOptIn(testOptIn) .setBackgroundEnabled(testBackgroundEnabled) .setDeviceType(testDeviceType) .setPushAddress(testPushAddress) .build(); ChannelRegistrationPayload newPayload = new ChannelRegistrationPayload.Builder(payload) .setOptIn(!payload.optIn) .setBackgroundEnabled(!payload.backgroundEnabled) .build(); ChannelRegistrationPayload minPayload = newPayload.minimizedPayload(payload); assertEquals(minPayload.optIn, newPayload.optIn); assertEquals(minPayload.backgroundEnabled, newPayload.backgroundEnabled); assertEquals(minPayload.deviceType, newPayload.deviceType); assertEquals(minPayload.pushAddress, newPayload.pushAddress); }
@NonNull public ChannelRegistrationPayload minimizedPayload(@Nullable ChannelRegistrationPayload last) { if (last == null) { return this; } Builder builder = new Builder(this); builder.setApid(null); builder.setUserId(null); builder.setAccengageDeviceId(null); if (last.setTags && setTags) { if (last.tags != null && last.tags.equals(tags)) { builder.setTags(false, null); } } if (namedUserId == null || UAStringUtil.equals(last.namedUserId, namedUserId)) { if (UAStringUtil.equals(last.country, country)) { builder.setCountry(null); } if (UAStringUtil.equals(last.language, language)) { builder.setLanguage(null); } if (UAStringUtil.equals(last.timezone, timezone)) { builder.setTimezone(null); } if (last.locationSettings != null && last.locationSettings.equals(locationSettings)) { builder.setLocationSettings(null); } if (UAStringUtil.equals(last.appVersion, appVersion)) { builder.setAppVersion(null); } if (UAStringUtil.equals(last.sdkVersion, sdkVersion)) { builder.setSdkVersion(null); } if (UAStringUtil.equals(last.deviceModel, deviceModel)) { builder.setDeviceModel(null); } if (UAStringUtil.equals(last.carrier, carrier)) { builder.setCarrier(null); } if (last.apiVersion != null && last.apiVersion.equals(apiVersion)) { builder.setApiVersion(null); } } return builder.build(); }
ChannelRegistrationPayload implements JsonSerializable { @NonNull public ChannelRegistrationPayload minimizedPayload(@Nullable ChannelRegistrationPayload last) { if (last == null) { return this; } Builder builder = new Builder(this); builder.setApid(null); builder.setUserId(null); builder.setAccengageDeviceId(null); if (last.setTags && setTags) { if (last.tags != null && last.tags.equals(tags)) { builder.setTags(false, null); } } if (namedUserId == null || UAStringUtil.equals(last.namedUserId, namedUserId)) { if (UAStringUtil.equals(last.country, country)) { builder.setCountry(null); } if (UAStringUtil.equals(last.language, language)) { builder.setLanguage(null); } if (UAStringUtil.equals(last.timezone, timezone)) { builder.setTimezone(null); } if (last.locationSettings != null && last.locationSettings.equals(locationSettings)) { builder.setLocationSettings(null); } if (UAStringUtil.equals(last.appVersion, appVersion)) { builder.setAppVersion(null); } if (UAStringUtil.equals(last.sdkVersion, sdkVersion)) { builder.setSdkVersion(null); } if (UAStringUtil.equals(last.deviceModel, deviceModel)) { builder.setDeviceModel(null); } if (UAStringUtil.equals(last.carrier, carrier)) { builder.setCarrier(null); } if (last.apiVersion != null && last.apiVersion.equals(apiVersion)) { builder.setApiVersion(null); } } return builder.build(); } }
ChannelRegistrationPayload implements JsonSerializable { @NonNull public ChannelRegistrationPayload minimizedPayload(@Nullable ChannelRegistrationPayload last) { if (last == null) { return this; } Builder builder = new Builder(this); builder.setApid(null); builder.setUserId(null); builder.setAccengageDeviceId(null); if (last.setTags && setTags) { if (last.tags != null && last.tags.equals(tags)) { builder.setTags(false, null); } } if (namedUserId == null || UAStringUtil.equals(last.namedUserId, namedUserId)) { if (UAStringUtil.equals(last.country, country)) { builder.setCountry(null); } if (UAStringUtil.equals(last.language, language)) { builder.setLanguage(null); } if (UAStringUtil.equals(last.timezone, timezone)) { builder.setTimezone(null); } if (last.locationSettings != null && last.locationSettings.equals(locationSettings)) { builder.setLocationSettings(null); } if (UAStringUtil.equals(last.appVersion, appVersion)) { builder.setAppVersion(null); } if (UAStringUtil.equals(last.sdkVersion, sdkVersion)) { builder.setSdkVersion(null); } if (UAStringUtil.equals(last.deviceModel, deviceModel)) { builder.setDeviceModel(null); } if (UAStringUtil.equals(last.carrier, carrier)) { builder.setCarrier(null); } if (last.apiVersion != null && last.apiVersion.equals(apiVersion)) { builder.setApiVersion(null); } } return builder.build(); } private  ChannelRegistrationPayload(Builder builder); }
ChannelRegistrationPayload implements JsonSerializable { @NonNull public ChannelRegistrationPayload minimizedPayload(@Nullable ChannelRegistrationPayload last) { if (last == null) { return this; } Builder builder = new Builder(this); builder.setApid(null); builder.setUserId(null); builder.setAccengageDeviceId(null); if (last.setTags && setTags) { if (last.tags != null && last.tags.equals(tags)) { builder.setTags(false, null); } } if (namedUserId == null || UAStringUtil.equals(last.namedUserId, namedUserId)) { if (UAStringUtil.equals(last.country, country)) { builder.setCountry(null); } if (UAStringUtil.equals(last.language, language)) { builder.setLanguage(null); } if (UAStringUtil.equals(last.timezone, timezone)) { builder.setTimezone(null); } if (last.locationSettings != null && last.locationSettings.equals(locationSettings)) { builder.setLocationSettings(null); } if (UAStringUtil.equals(last.appVersion, appVersion)) { builder.setAppVersion(null); } if (UAStringUtil.equals(last.sdkVersion, sdkVersion)) { builder.setSdkVersion(null); } if (UAStringUtil.equals(last.deviceModel, deviceModel)) { builder.setDeviceModel(null); } if (UAStringUtil.equals(last.carrier, carrier)) { builder.setCarrier(null); } if (last.apiVersion != null && last.apiVersion.equals(apiVersion)) { builder.setApiVersion(null); } } return builder.build(); } private  ChannelRegistrationPayload(Builder builder); @NonNull ChannelRegistrationPayload minimizedPayload(@Nullable ChannelRegistrationPayload last); @NonNull @Override JsonValue toJsonValue(); @NonNull @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
ChannelRegistrationPayload implements JsonSerializable { @NonNull public ChannelRegistrationPayload minimizedPayload(@Nullable ChannelRegistrationPayload last) { if (last == null) { return this; } Builder builder = new Builder(this); builder.setApid(null); builder.setUserId(null); builder.setAccengageDeviceId(null); if (last.setTags && setTags) { if (last.tags != null && last.tags.equals(tags)) { builder.setTags(false, null); } } if (namedUserId == null || UAStringUtil.equals(last.namedUserId, namedUserId)) { if (UAStringUtil.equals(last.country, country)) { builder.setCountry(null); } if (UAStringUtil.equals(last.language, language)) { builder.setLanguage(null); } if (UAStringUtil.equals(last.timezone, timezone)) { builder.setTimezone(null); } if (last.locationSettings != null && last.locationSettings.equals(locationSettings)) { builder.setLocationSettings(null); } if (UAStringUtil.equals(last.appVersion, appVersion)) { builder.setAppVersion(null); } if (UAStringUtil.equals(last.sdkVersion, sdkVersion)) { builder.setSdkVersion(null); } if (UAStringUtil.equals(last.deviceModel, deviceModel)) { builder.setDeviceModel(null); } if (UAStringUtil.equals(last.carrier, carrier)) { builder.setCarrier(null); } if (last.apiVersion != null && last.apiVersion.equals(apiVersion)) { builder.setApiVersion(null); } } return builder.build(); } private  ChannelRegistrationPayload(Builder builder); @NonNull ChannelRegistrationPayload minimizedPayload(@Nullable ChannelRegistrationPayload last); @NonNull @Override JsonValue toJsonValue(); @NonNull @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); @NonNull
    static final String ANDROID_DEVICE_TYPE; @NonNull
    static final String AMAZON_DEVICE_TYPE; final boolean optIn; final boolean backgroundEnabled; final String deviceType; final String pushAddress; final boolean setTags; final Set<String> tags; final String userId; final String apid; final String timezone; final String language; final String country; final Boolean locationSettings; final String appVersion; final String sdkVersion; final String deviceModel; final Integer apiVersion; final String carrier; final String accengageDeviceId; final String deliveryType; final String namedUserId; }