From 763450022c105cdd63201abe6baa4a3619411826 Mon Sep 17 00:00:00 2001 From: Chava Friedler Date: Wed, 27 Jul 2022 10:48:11 -0400 Subject: [PATCH] Prepare for release 13.0.0 --- CHANGELOG.md | 6 + appboy-segment-integration/build.gradle | 4 +- ...AndroidTest.java => BrazeAndroidTest.java} | 7 +- .../appboy/AppboyIntegration.java | 33 +++-- .../{AppboyTest.java => BrazeTest.java} | 114 +++++++++--------- .../{MockAppboy.java => MockBraze.java} | 34 +++--- 6 files changed, 99 insertions(+), 99 deletions(-) rename appboy-segment-integration/src/androidTest/java/com/segment/analytics/android/integrations/appboy/{AppboyAndroidTest.java => BrazeAndroidTest.java} (76%) rename appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/{AppboyTest.java => BrazeTest.java} (75%) rename appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/{MockAppboy.java => MockBraze.java} (93%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3261dac..cb2f49a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 13.0.0 + +##### Breaking +- Updated to [Braze Android SDK 22.0.0](https://github.com/Appboy/appboy-android-sdk/blob/master/CHANGELOG.md#2200). +- Updated to analytics-android 4.10.1. + ## 12.0.0 ##### Breaking diff --git a/appboy-segment-integration/build.gradle b/appboy-segment-integration/build.gradle index ac2c8a1..a4212d4 100755 --- a/appboy-segment-integration/build.gradle +++ b/appboy-segment-integration/build.gradle @@ -67,9 +67,9 @@ dependencies { google() } - compileOnly 'com.segment.analytics.android:analytics:4.3.1' + compileOnly 'com.segment.analytics.android:analytics:4.10.1' - api 'com.appboy:android-sdk-ui:21.0.0+' + api 'com.appboy:android-sdk-ui:22.0.0+' testImplementation 'junit:junit:4.12' diff --git a/appboy-segment-integration/src/androidTest/java/com/segment/analytics/android/integrations/appboy/AppboyAndroidTest.java b/appboy-segment-integration/src/androidTest/java/com/segment/analytics/android/integrations/appboy/BrazeAndroidTest.java similarity index 76% rename from appboy-segment-integration/src/androidTest/java/com/segment/analytics/android/integrations/appboy/AppboyAndroidTest.java rename to appboy-segment-integration/src/androidTest/java/com/segment/analytics/android/integrations/appboy/BrazeAndroidTest.java index 48357a8..6e8a219 100644 --- a/appboy-segment-integration/src/androidTest/java/com/segment/analytics/android/integrations/appboy/AppboyAndroidTest.java +++ b/appboy-segment-integration/src/androidTest/java/com/segment/analytics/android/integrations/appboy/BrazeAndroidTest.java @@ -3,7 +3,6 @@ import androidx.test.core.app.ApplicationProvider; import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner; -import com.appboy.Appboy; import com.braze.Braze; import com.braze.configuration.BrazeConfig; import com.segment.analytics.Analytics; @@ -18,7 +17,7 @@ import static org.junit.Assert.assertEquals; @RunWith(AndroidJUnit4ClassRunner.class) -public class AppboyAndroidTest { +public class BrazeAndroidTest { @BeforeClass public static void beforeClass() { @@ -34,9 +33,9 @@ public void testIdentifyCallsChangeUser() { .userId(testUserId) .traits(createTraits(testUserId)) .build(); - AppboyIntegration integration = new AppboyIntegration(Appboy.getInstance(ApplicationProvider.getApplicationContext()), "token", Logger.with(Analytics.LogLevel.DEBUG), true); + AppboyIntegration integration = new AppboyIntegration(Braze.getInstance(ApplicationProvider.getApplicationContext()), "token", Logger.with(Analytics.LogLevel.DEBUG), true); integration.identify(identifyPayload); - assertEquals(testUserId, Appboy.getInstance(ApplicationProvider.getApplicationContext()).getCurrentUser().getUserId()); + assertEquals(testUserId, Braze.getInstance(ApplicationProvider.getApplicationContext()).getCurrentUser().getUserId()); } } diff --git a/appboy-segment-integration/src/main/java/com/segment/analytics/android/integrations/appboy/AppboyIntegration.java b/appboy-segment-integration/src/main/java/com/segment/analytics/android/integrations/appboy/AppboyIntegration.java index 25536f3..ef26013 100755 --- a/appboy-segment-integration/src/main/java/com/segment/analytics/android/integrations/appboy/AppboyIntegration.java +++ b/appboy-segment-integration/src/main/java/com/segment/analytics/android/integrations/appboy/AppboyIntegration.java @@ -7,14 +7,13 @@ import androidx.annotation.RestrictTo; import androidx.annotation.VisibleForTesting; -import com.appboy.Appboy; -import com.appboy.IAppboy; import com.appboy.enums.Gender; import com.appboy.enums.Month; import com.appboy.enums.SdkFlavor; -import com.braze.models.outgoing.BrazeProperties; import com.appboy.models.outgoing.AttributionData; +import com.braze.models.outgoing.BrazeProperties; import com.braze.Braze; +import com.braze.IBraze; import com.braze.enums.BrazeSdkMetadata; import com.braze.support.StringUtils; import com.braze.BrazeUser; @@ -43,8 +42,8 @@ import java.util.Locale; import java.util.Set; -public class AppboyIntegration extends Integration { - private static final String APPBOY_KEY = "Appboy"; +public class AppboyIntegration extends Integration { + private static final String BRAZE_KEY = "Appboy"; private static final Set MALE_TOKENS = new HashSet<>(Arrays.asList("M", "MALE")); private static final Set FEMALE_TOKENS = new HashSet<>(Arrays.asList("F", @@ -62,7 +61,7 @@ public class AppboyIntegration extends Integration { public static final Factory FACTORY = new Factory() { @Override public Integration create(ValueMap settings, Analytics analytics) { - Logger logger = analytics.logger(APPBOY_KEY); + Logger logger = analytics.logger(BRAZE_KEY); String apiKey = settings.getString(API_KEY_KEY); SdkFlavor flavor = SdkFlavor.SEGMENT; boolean inAppMessageRegistrationEnabled = @@ -82,15 +81,15 @@ public Integration create(ValueMap settings, Analytics analytics) { } final Context applicationContext = analytics.getApplication().getApplicationContext(); - Appboy.configure(applicationContext, builder.build()); + Braze.configure(applicationContext, builder.build()); Braze.getInstance(applicationContext); - logger.verbose("Configured Braze+Segment integration and initialized Appboy."); + logger.verbose("Configured Braze+Segment integration and initialized Braze."); return new AppboyIntegration(applicationContext, apiKey, logger, inAppMessageRegistrationEnabled); } @Override public String key() { - return APPBOY_KEY; + return BRAZE_KEY; } }; @@ -99,7 +98,7 @@ public String key() { private final boolean mAutomaticInAppMessageRegistrationEnabled; private final Context mContext; // Only used for testing - private final IAppboy mBraze; + private final IBraze mBraze; public AppboyIntegration(Context context, String token, @@ -113,12 +112,12 @@ public AppboyIntegration(Context context, } @RestrictTo(RestrictTo.Scope.TESTS) - public AppboyIntegration(IAppboy appboy, + public AppboyIntegration(IBraze braze, String token, Logger logger, boolean automaticInAppMessageRegistrationEnabled) { mContext = null; - mBraze = appboy; + mBraze = braze; mToken = token; mLogger = logger; mAutomaticInAppMessageRegistrationEnabled = automaticInAppMessageRegistrationEnabled; @@ -129,15 +128,15 @@ public String getToken() { } @Override - public Appboy getUnderlyingInstance() { + public Braze getUnderlyingInstance() { if (mContext != null) { - return (Appboy) Braze.getInstance(mContext); + return (Braze) Braze.getInstance(mContext); } else { - return (Appboy) mBraze; + return (Braze) mBraze; } } - public IAppboy getInternalInstance() { + public IBraze getInternalInstance() { if (mContext != null) { return Braze.getInstance(mContext); } else { @@ -158,7 +157,7 @@ public void identify(IdentifyPayload identify) { BrazeUser currentUser = getInternalInstance().getCurrentUser(); if (currentUser == null) { - mLogger.info("Appboy.getCurrentUser() was null, aborting identify"); + mLogger.info("Braze.getCurrentUser() was null, aborting identify"); return; } diff --git a/appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/AppboyTest.java b/appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/BrazeTest.java similarity index 75% rename from appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/AppboyTest.java rename to appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/BrazeTest.java index 754c10f..0378867 100644 --- a/appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/AppboyTest.java +++ b/appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/BrazeTest.java @@ -6,7 +6,7 @@ import androidx.test.core.app.ApplicationProvider; -import com.appboy.IAppboy; +import com.braze.IBraze; import com.appboy.enums.Gender; import com.braze.models.outgoing.BrazeProperties; import com.braze.BrazeUser; @@ -44,9 +44,9 @@ @SuppressWarnings("deprecation") @LooperMode(LooperMode.Mode.LEGACY) @RunWith(RobolectricTestRunner.class) -public class AppboyTest { - private IAppboy mAppboy; - private BrazeUser mAppboyUser; +public class BrazeTest { + private IBraze mBraze; + private BrazeUser mBrazeUser; private AppboyIntegration mIntegration; private Analytics mAnalytics; @@ -56,13 +56,13 @@ public void setUp() { final Application mockApplication = mock(Application.class); Mockito.when(mockApplication.getApplicationContext()).thenReturn(getContext()); Mockito.when(mAnalytics.getApplication()).thenReturn(mockApplication); - mAppboy = spy(new MockAppboy()); - mAppboyUser = mock(BrazeUser.class); + mBraze = spy(new MockBraze()); + mBrazeUser = mock(BrazeUser.class); - when(mAppboy.getCurrentUser()).thenReturn(mAppboyUser); + when(mBraze.getCurrentUser()).thenReturn(mBrazeUser); Logger logger = Logger.with(Analytics.LogLevel.DEBUG); when(mAnalytics.logger("Appboy")).thenReturn(logger); - mIntegration = new AppboyIntegration(mAppboy, "foo", logger, true); + mIntegration = new AppboyIntegration(mBraze, "foo", logger, true); } private Context getContext() { @@ -81,7 +81,7 @@ public void testFactoryLoadsProperValuesFromSettings() { public void testActivityStartCallsOpenSession() { Activity activity = mock(Activity.class); mIntegration.onActivityStarted(activity); - verify(mAppboy).openSession(activity); + verify(mBraze).openSession(activity); verifyNoMoreAppboyInteractions(); } @@ -89,7 +89,7 @@ public void testActivityStartCallsOpenSession() { public void testActivityStopCallsCloseSession() { Activity activity = mock(Activity.class); mIntegration.onActivityStopped(activity); - verify(mAppboy).closeSession(activity); + verify(mBraze).closeSession(activity); verifyNoMoreAppboyInteractions(); } @@ -104,7 +104,7 @@ public void testIdentifyCallWithNoFieldsSet() { Traits traits = createTraits("userId"); IdentifyPayload identifyPayload = getBasicIdentifyPayloadWithTraits(traits); mIntegration.identify(identifyPayload); - verify(mAppboy, Mockito.times(1)).changeUser("userId"); + verify(mBraze, Mockito.times(1)).changeUser("userId"); } @Test @@ -132,24 +132,24 @@ public void testIdentifyFields() { traits.put("anonymousId", "id2"); IdentifyPayload identifyPayload = getBasicIdentifyPayloadWithTraits(traits); mIntegration.identify(identifyPayload); - verify(mAppboyUser).setEmail("a@o.o"); - verify(mAppboyUser).setFirstName("first"); - verify(mAppboyUser).setLastName("last"); - verify(mAppboyUser).setGender(Gender.MALE); - verify(mAppboyUser).setPhoneNumber("5555551234"); - verify(mAppboyUser).setHomeCity("city"); - verify(mAppboyUser).setCountry("country"); - verify(mAppboyUser).setCustomUserAttribute("int", 10); - verify(mAppboyUser).setCustomUserAttribute("bool", Boolean.TRUE); - verify(mAppboyUser).setCustomUserAttribute("double", 4.2); - verify(mAppboyUser).setCustomUserAttribute("float", new Float(5.0)); - verify(mAppboyUser).setCustomUserAttribute("long", 15L); - verify(mAppboyUser).setCustomUserAttribute("string", "value"); - verify(mAppboyUser).setCustomAttributeArray("array", testStringArray); - verify(mAppboyUser, Mockito.never()).setCustomUserAttribute("userId", "id1"); - verify(mAppboyUser, Mockito.never()).setCustomUserAttribute("anonymousId", "id2"); - verify(mAppboy, Mockito.times(1)).changeUser("userId"); - verify(mAppboy, Mockito.times(1)).getCurrentUser(); + verify(mBrazeUser).setEmail("a@o.o"); + verify(mBrazeUser).setFirstName("first"); + verify(mBrazeUser).setLastName("last"); + verify(mBrazeUser).setGender(Gender.MALE); + verify(mBrazeUser).setPhoneNumber("5555551234"); + verify(mBrazeUser).setHomeCity("city"); + verify(mBrazeUser).setCountry("country"); + verify(mBrazeUser).setCustomUserAttribute("int", 10); + verify(mBrazeUser).setCustomUserAttribute("bool", Boolean.TRUE); + verify(mBrazeUser).setCustomUserAttribute("double", 4.2); + verify(mBrazeUser).setCustomUserAttribute("float", new Float(5.0)); + verify(mBrazeUser).setCustomUserAttribute("long", 15L); + verify(mBrazeUser).setCustomUserAttribute("string", "value"); + verify(mBrazeUser).setCustomAttributeArray("array", testStringArray); + verify(mBrazeUser, Mockito.never()).setCustomUserAttribute("userId", "id1"); + verify(mBrazeUser, Mockito.never()).setCustomUserAttribute("anonymousId", "id2"); + verify(mBraze, Mockito.times(1)).changeUser("userId"); + verify(mBraze, Mockito.times(1)).getCurrentUser(); } @Test @@ -163,7 +163,7 @@ public void testIdentifyArrayList() { traits.put(testName, testArrayList); IdentifyPayload identifyPayload = getBasicIdentifyPayloadWithTraits(traits); mIntegration.identify(identifyPayload); - verify(mAppboyUser).setCustomAttributeArray(refEq(testName), aryEq(stringArray)); + verify(mBrazeUser).setCustomAttributeArray(refEq(testName), aryEq(stringArray)); } @Test @@ -178,8 +178,8 @@ public void testIdentifyArrayListWithListInt() { traits.put(testName, testArrayList); IdentifyPayload identifyPayload = getBasicIdentifyPayloadWithTraits(traits); mIntegration.identify(identifyPayload); - verify(mAppboyUser, Mockito.never()).setCustomAttributeArray(refEq(testName), aryEq(stringArray)); - verify(mAppboyUser, Mockito.never()).setCustomAttributeArray(refEq(testName), aryEq(emptyArray)); + verify(mBrazeUser, Mockito.never()).setCustomAttributeArray(refEq(testName), aryEq(stringArray)); + verify(mBrazeUser, Mockito.never()).setCustomAttributeArray(refEq(testName), aryEq(emptyArray)); } @Test @@ -194,7 +194,7 @@ public void testIdentifyGender() { traits.putGender("m"); identifyPayload = getBasicIdentifyPayloadWithTraits(traits); mIntegration.identify(identifyPayload); - verify(mAppboyUser, Mockito.times(3)).setGender(Gender.MALE); + verify(mBrazeUser, Mockito.times(3)).setGender(Gender.MALE); traits.putGender("female"); identifyPayload = getBasicIdentifyPayloadWithTraits(traits); mIntegration.identify(identifyPayload); @@ -204,10 +204,10 @@ public void testIdentifyGender() { traits.putGender("f"); identifyPayload = getBasicIdentifyPayloadWithTraits(traits); mIntegration.identify(identifyPayload); - verify(mAppboy, Mockito.times(6)).changeUser("userId"); - verify(mAppboyUser, Mockito.times(3)).setGender(Gender.FEMALE); - verify(mAppboyUser, Mockito.times(3)).setGender(Gender.MALE); - verify(mAppboy, Mockito.times(6)).getCurrentUser(); + verify(mBraze, Mockito.times(6)).changeUser("userId"); + verify(mBrazeUser, Mockito.times(3)).setGender(Gender.FEMALE); + verify(mBrazeUser, Mockito.times(3)).setGender(Gender.MALE); + verify(mBraze, Mockito.times(6)).getCurrentUser(); } @Test @@ -219,7 +219,7 @@ public void testIdentifyGenderOnBadInputs() { traits.putGender("female_1"); identifyPayload = getBasicIdentifyPayloadWithTraits(traits); mIntegration.identify(identifyPayload); - verify(mAppboy, Mockito.times(2)).changeUser("userId"); + verify(mBraze, Mockito.times(2)).changeUser("userId"); } @Test @@ -230,7 +230,7 @@ public void testTrackLogsCustomEventWithoutProperties() { // Note, testing event and purchase properties doesn't currently work because the toJsonObject // uses an Android method that returns a default value. // TODO - update tests once we've got a workaround. - verify(mAppboy).logCustomEvent("myEvent"); + verify(mBraze).logCustomEvent("myEvent"); verifyNoMoreAppboyInteractions(); } @@ -240,8 +240,8 @@ public void testTrackLogsCustomEventForNonOrderCompletedEventWithNoRevenueAndPro purchaseProperties.putProducts(new Properties.Product("foo", "bar", 10)); TrackPayload trackPayload = getBasicTrackPayloadWithEventAndProps("nonRevenueEvent", purchaseProperties); mIntegration.track(trackPayload); - verify(mAppboy, Mockito.never()).logPurchase("c", "USD", new BigDecimal("10.0")); - verify(mAppboy).logCustomEvent(Mockito.eq("nonRevenueEvent"), Mockito.any(BrazeProperties.class)); + verify(mBraze, Mockito.never()).logPurchase("c", "USD", new BigDecimal("10.0")); + verify(mBraze).logCustomEvent(Mockito.eq("nonRevenueEvent"), Mockito.any(BrazeProperties.class)); verifyNoMoreAppboyInteractions(); } @@ -249,7 +249,7 @@ public void testTrackLogsCustomEventForNonOrderCompletedEventWithNoRevenueAndPro public void testTrackLogsPurchaseForOrderCompletedEvent() { TrackPayload trackPayload = getBasicTrackPayloadWithEventAndProps("Order Completed", null); mIntegration.track(trackPayload); - verify(mAppboy).logPurchase("Order Completed", "USD", new BigDecimal("0.0")); + verify(mBraze).logPurchase("Order Completed", "USD", new BigDecimal("0.0")); verifyNoMoreAppboyInteractions(); } @@ -257,7 +257,7 @@ public void testTrackLogsPurchaseForOrderCompletedEvent() { public void testTrackLogsPurchaseForCompletedOrderEvent() { TrackPayload trackPayload = getBasicTrackPayloadWithEventAndProps("Completed Order", null); mIntegration.track(trackPayload); - verify(mAppboy).logPurchase("Completed Order", "USD", new BigDecimal("0.0")); + verify(mBraze).logPurchase("Completed Order", "USD", new BigDecimal("0.0")); verifyNoMoreAppboyInteractions(); } @@ -267,7 +267,7 @@ public void testTrackLogsPurchaseForEventWithRevenue() { purchaseProperties.putRevenue(10.0); TrackPayload trackPayload = getBasicTrackPayloadWithEventAndProps("revenueEvent", purchaseProperties); mIntegration.track(trackPayload); - verify(mAppboy).logPurchase("revenueEvent", "USD", new BigDecimal("10.0")); + verify(mBraze).logPurchase("revenueEvent", "USD", new BigDecimal("10.0")); verifyNoMoreAppboyInteractions(); } @@ -277,8 +277,8 @@ public void testTrackLogsPurchasesForOrderCompletedEventWithProducts() { purchaseProperties.putProducts(new Properties.Product("id1", "sku1", 10), new Properties.Product("id2", "sku2", 12)); TrackPayload trackPayload = getBasicTrackPayloadWithEventAndProps("Order Completed", purchaseProperties); mIntegration.track(trackPayload); - verify(mAppboy).logPurchase(Mockito.eq("id1"), Mockito.eq("USD"), Mockito.eq(new BigDecimal("10.0")), Mockito.any(BrazeProperties.class)); - verify(mAppboy).logPurchase(Mockito.eq("id2"), Mockito.eq("USD"), Mockito.eq(new BigDecimal("12.0")), Mockito.any(BrazeProperties.class)); + verify(mBraze).logPurchase(Mockito.eq("id1"), Mockito.eq("USD"), Mockito.eq(new BigDecimal("10.0")), Mockito.any(BrazeProperties.class)); + verify(mBraze).logPurchase(Mockito.eq("id2"), Mockito.eq("USD"), Mockito.eq(new BigDecimal("12.0")), Mockito.any(BrazeProperties.class)); verifyNoMoreAppboyInteractions(); } @@ -288,8 +288,8 @@ public void testTrackLogsPurchasesForCompletedOrderEventWithProducts() { purchaseProperties.putProducts(new Properties.Product("id1", "sku1", 10), new Properties.Product("id2", "sku2", 12)); TrackPayload trackPayload = getBasicTrackPayloadWithEventAndProps("Completed Order", purchaseProperties); mIntegration.track(trackPayload); - verify(mAppboy).logPurchase(Mockito.eq("id1"), Mockito.eq("USD"), Mockito.eq(new BigDecimal("10.0")), Mockito.any(BrazeProperties.class)); - verify(mAppboy).logPurchase(Mockito.eq("id2"), Mockito.eq("USD"), Mockito.eq(new BigDecimal("12.0")), Mockito.any(BrazeProperties.class)); + verify(mBraze).logPurchase(Mockito.eq("id1"), Mockito.eq("USD"), Mockito.eq(new BigDecimal("10.0")), Mockito.any(BrazeProperties.class)); + verify(mBraze).logPurchase(Mockito.eq("id2"), Mockito.eq("USD"), Mockito.eq(new BigDecimal("12.0")), Mockito.any(BrazeProperties.class)); verifyNoMoreAppboyInteractions(); } @@ -300,8 +300,8 @@ public void testTrackLogsPurchasesForEventWithRevenueWithProducts() { purchaseProperties.putProducts(new Properties.Product("id1", "sku1", 10), new Properties.Product("id2", "sku2", 12)); TrackPayload trackPayload = getBasicTrackPayloadWithEventAndProps("revenueEvent", purchaseProperties); mIntegration.track(trackPayload); - verify(mAppboy).logPurchase(Mockito.eq("id1"), Mockito.eq("USD"), Mockito.eq(new BigDecimal("10.0")), Mockito.any(BrazeProperties.class)); - verify(mAppboy).logPurchase(Mockito.eq("id2"), Mockito.eq("USD"), Mockito.eq(new BigDecimal("12.0")), Mockito.any(BrazeProperties.class)); + verify(mBraze).logPurchase(Mockito.eq("id1"), Mockito.eq("USD"), Mockito.eq(new BigDecimal("10.0")), Mockito.any(BrazeProperties.class)); + verify(mBraze).logPurchase(Mockito.eq("id2"), Mockito.eq("USD"), Mockito.eq(new BigDecimal("12.0")), Mockito.any(BrazeProperties.class)); verifyNoMoreAppboyInteractions(); } @@ -311,7 +311,7 @@ public void testTrackLogsPurchaseForOrderCompletedEventWithCustomCurrency() { purchaseProperties.putCurrency("JPY"); TrackPayload trackPayload = getBasicTrackPayloadWithEventAndProps("Order Completed", purchaseProperties); mIntegration.track(trackPayload); - verify(mAppboy).logPurchase("Order Completed", "JPY", new BigDecimal("0.0")); + verify(mBraze).logPurchase("Order Completed", "JPY", new BigDecimal("0.0")); verifyNoMoreAppboyInteractions(); } @@ -321,7 +321,7 @@ public void testTrackLogsPurchaseForCompletedOrderEventWithCustomCurrency() { purchaseProperties.putCurrency("JPY"); TrackPayload trackPayload = getBasicTrackPayloadWithEventAndProps("Completed Order", purchaseProperties); mIntegration.track(trackPayload); - verify(mAppboy).logPurchase("Completed Order", "JPY", new BigDecimal("0.0")); + verify(mBraze).logPurchase("Completed Order", "JPY", new BigDecimal("0.0")); verifyNoMoreAppboyInteractions(); } @@ -332,7 +332,7 @@ public void testTrackLogsPurchaseForEventWithRevenueWithCustomCurrency() { purchaseProperties.putCurrency("JPY"); TrackPayload trackPayload = getBasicTrackPayloadWithEventAndProps("revenueEvent", purchaseProperties); mIntegration.track(trackPayload); - verify(mAppboy).logPurchase("revenueEvent", "JPY", new BigDecimal("10.0")); + verify(mBraze).logPurchase("revenueEvent", "JPY", new BigDecimal("10.0")); verifyNoMoreAppboyInteractions(); } @@ -345,7 +345,7 @@ public void testScreenDoesNotCallAppboy() { @Test public void testFlushCallsRequestImmediateDataFlushOnce() { mIntegration.flush(); - verify(mAppboy).requestImmediateDataFlush(); + verify(mBraze).requestImmediateDataFlush(); verifyNoMoreAppboyInteractions(); } @@ -361,7 +361,7 @@ public void whenPropertiesNull_logPurchaseForSingleItem_logsWithoutProperties() final String currencyCode = "USD"; final BigDecimal price = new BigDecimal("1.00"); mIntegration.logPurchaseForSingleItem(productId, currencyCode, price, null); - verify(mAppboy).logPurchase(productId, currencyCode, price); + verify(mBraze).logPurchase(productId, currencyCode, price); verifyNoMoreAppboyInteractions(); } @@ -371,12 +371,12 @@ public void whenPropertiesEmpty_logPurchaseForSingleItem_logsWithoutProperties() final String currencyCode = "USD"; final BigDecimal price = new BigDecimal("1.00"); mIntegration.logPurchaseForSingleItem(productId, currencyCode, price, new JSONObject()); - verify(mAppboy).logPurchase(productId, currencyCode, price); + verify(mBraze).logPurchase(productId, currencyCode, price); verifyNoMoreAppboyInteractions(); } private void verifyNoMoreAppboyInteractions() { - verifyNoMoreInteractions(mAppboy); + verifyNoMoreInteractions(mBraze); } private IdentifyPayload getBasicIdentifyPayloadWithTraits(Traits traits) { diff --git a/appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/MockAppboy.java b/appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/MockBraze.java similarity index 93% rename from appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/MockAppboy.java rename to appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/MockBraze.java index 930c49f..3ba60c7 100644 --- a/appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/MockAppboy.java +++ b/appboy-segment-integration/src/test/java/com/segment/analytics/android/integrations/appboy/MockBraze.java @@ -6,12 +6,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.appboy.IAppboy; +import com.braze.IBraze; import com.braze.events.BrazeNetworkFailureEvent; +import com.braze.events.BrazePushEvent; import com.braze.events.BrazeSdkAuthenticationErrorEvent; import com.appboy.events.FeedUpdatedEvent; -import com.appboy.events.IEventSubscriber; -import com.appboy.events.IValueCallback; +import com.braze.events.IEventSubscriber; +import com.braze.events.IValueCallback; import com.braze.events.SessionStateChangedEvent; import com.appboy.models.cards.Card; import com.braze.models.outgoing.BrazeProperties; @@ -26,7 +27,7 @@ import java.math.BigDecimal; import java.util.List; -public class MockAppboy implements IAppboy { +public class MockBraze implements IBraze { @Override public void openSession(Activity activity) { @@ -172,21 +173,6 @@ public void getCurrentUser(IValueCallback iValueCallback) { } - @Override - public void registerAppboyPushMessages(String s) { - - } - - @Override - public void registerPushToken(String s) { - - } - - @Override - public String getAppboyPushMessageRegistrationId() { - return null; - } - @Override public String getRegisteredPushToken() { return null; @@ -281,4 +267,14 @@ public void logFeedCardClick(String s) { public void setSdkAuthenticationSignature(@NonNull String s) { } + + @Override + public void setRegisteredPushToken(String s) { + + } + + @Override + public void subscribeToPushNotificationEvents(IEventSubscriber iEventSubscriber) { + + } }