|
40 | 40 | import com.optimizely.ab.internal.ExperimentUtils;
|
41 | 41 | import com.optimizely.ab.internal.LogbackVerifier;
|
42 | 42 | import com.optimizely.ab.internal.ReservedEventKey;
|
| 43 | +import com.optimizely.ab.notification.ActivateNotificationListener; |
| 44 | +import com.optimizely.ab.notification.NotificationCenter; |
43 | 45 | import com.optimizely.ab.notification.NotificationListener;
|
| 46 | +import com.optimizely.ab.notification.TrackNotificationListener; |
44 | 47 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
45 |
| -import com.optimizely.ab.notification.ActivateNotification; |
46 |
| -import com.optimizely.ab.notification.NotificationCenter; |
47 |
| -import com.optimizely.ab.notification.TrackNotification; |
48 |
| - |
49 | 48 | import org.junit.Rule;
|
50 | 49 | import org.junit.Test;
|
51 | 50 | import org.junit.rules.ExpectedException;
|
@@ -2239,7 +2238,7 @@ public void activateWithListener() throws Exception {
|
2239 | 2238 |
|
2240 | 2239 | testUserAttributes.put(testBucketingIdKey, testBucketingId);
|
2241 | 2240 |
|
2242 |
| - ActivateNotification activateNotification = new ActivateNotification() { |
| 2241 | + ActivateNotificationListener activateNotification = new ActivateNotificationListener() { |
2243 | 2242 | @Override
|
2244 | 2243 | public void onActivate(@Nonnull Experiment experiment, @Nonnull String userId, @Nonnull Map<String, String> attributes, @Nonnull Variation variation, @Nonnull LogEvent event) {
|
2245 | 2244 | assertEquals(experiment.getKey(), activatedExperiment.getKey());
|
@@ -2307,7 +2306,7 @@ public void activateWithListenerNullAttributes() throws Exception {
|
2307 | 2306 | when(mockBucketer.bucket(activatedExperiment, testUserId))
|
2308 | 2307 | .thenReturn(bucketedVariation);
|
2309 | 2308 |
|
2310 |
| - ActivateNotification activateNotification = new ActivateNotification() { |
| 2309 | + ActivateNotificationListener activateNotification = new ActivateNotificationListener() { |
2311 | 2310 | @Override
|
2312 | 2311 | public void onActivate(@Nonnull Experiment experiment, @Nonnull String userId, @Nonnull Map<String, String> attributes, @Nonnull Variation variation, @Nonnull LogEvent event) {
|
2313 | 2312 | assertEquals(experiment.getKey(), activatedExperiment.getKey());
|
@@ -2616,7 +2615,7 @@ public void addNotificationListenerFromNotificationCenter() throws Exception {
|
2616 | 2615 | .thenReturn(bucketedVariation);
|
2617 | 2616 |
|
2618 | 2617 | // Add listener
|
2619 |
| - ActivateNotification listener = mock(ActivateNotification.class); |
| 2618 | + ActivateNotificationListener listener = mock(ActivateNotificationListener.class); |
2620 | 2619 | optimizely.notificationCenter.addNotification(NotificationCenter.NotificationType.Activate, listener);
|
2621 | 2620 |
|
2622 | 2621 | // Check if listener is notified when experiment is activated
|
@@ -2644,7 +2643,7 @@ public void addNotificationListenerFromNotificationCenter() throws Exception {
|
2644 | 2643 | anyMapOf(String.class, Object.class)))
|
2645 | 2644 | .thenReturn(logEventToDispatch);
|
2646 | 2645 |
|
2647 |
| - TrackNotification trackNotification = mock(TrackNotification.class); |
| 2646 | + TrackNotificationListener trackNotification = mock(TrackNotificationListener.class); |
2648 | 2647 |
|
2649 | 2648 | optimizely.notificationCenter.addNotification(NotificationCenter.NotificationType.Track, trackNotification);
|
2650 | 2649 |
|
@@ -2688,11 +2687,11 @@ public void removeNotificationListenerNotificationCenter() throws Exception {
|
2688 | 2687 | .thenReturn(logEventToDispatch);
|
2689 | 2688 |
|
2690 | 2689 | // Add and remove listener
|
2691 |
| - ActivateNotification activateNotification = mock(ActivateNotification.class); |
| 2690 | + ActivateNotificationListener activateNotification = mock(ActivateNotificationListener.class); |
2692 | 2691 | int notificationId = optimizely.notificationCenter.addNotification(NotificationCenter.NotificationType.Activate, activateNotification);
|
2693 | 2692 | assertTrue(optimizely.notificationCenter.removeNotification(notificationId));
|
2694 | 2693 |
|
2695 |
| - TrackNotification trackNotification = mock(TrackNotification.class); |
| 2694 | + TrackNotificationListener trackNotification = mock(TrackNotificationListener.class); |
2696 | 2695 | notificationId = optimizely.notificationCenter.addNotification(NotificationCenter.NotificationType.Track, trackNotification);
|
2697 | 2696 | assertTrue(optimizely.notificationCenter.removeNotification(notificationId));
|
2698 | 2697 |
|
@@ -2774,8 +2773,8 @@ public void clearNotificationListenersNotificationCenter() throws Exception {
|
2774 | 2773 | attributeCaptor.capture()
|
2775 | 2774 | )).thenReturn(logEventToDispatch);
|
2776 | 2775 |
|
2777 |
| - ActivateNotification activateNotification = mock(ActivateNotification.class); |
2778 |
| - TrackNotification trackNotification = mock(TrackNotification.class); |
| 2776 | + ActivateNotificationListener activateNotification = mock(ActivateNotificationListener.class); |
| 2777 | + TrackNotificationListener trackNotification = mock(TrackNotificationListener.class); |
2779 | 2778 |
|
2780 | 2779 | optimizely.notificationCenter.addNotification(NotificationCenter.NotificationType.Activate, activateNotification);
|
2781 | 2780 | optimizely.notificationCenter.addNotification(NotificationCenter.NotificationType.Track, trackNotification);
|
@@ -2867,7 +2866,7 @@ public void trackEventWithListenerAttributes() throws Exception {
|
2867 | 2866 | logbackVerifier.expectMessage(Level.DEBUG, "Dispatching conversion event to URL test_url with params " +
|
2868 | 2867 | testParams + " and payload \"\"");
|
2869 | 2868 |
|
2870 |
| - TrackNotification trackNotification = new TrackNotification() { |
| 2869 | + TrackNotificationListener trackNotification = new TrackNotificationListener() { |
2871 | 2870 | @Override
|
2872 | 2871 | public void onTrack(@Nonnull String eventKey, @Nonnull String userId, @Nonnull Map<String, String> _attributes, @Nonnull Map<String, ?> eventTags, @Nonnull LogEvent event) {
|
2873 | 2872 | assertEquals(eventType.getKey(), eventKey);
|
@@ -2947,7 +2946,7 @@ public void trackEventWithListenerNullAttributes() throws Exception {
|
2947 | 2946 | logbackVerifier.expectMessage(Level.DEBUG, "Dispatching conversion event to URL test_url with params " +
|
2948 | 2947 | testParams + " and payload \"\"");
|
2949 | 2948 |
|
2950 |
| - TrackNotification trackNotification = new TrackNotification() { |
| 2949 | + TrackNotificationListener trackNotification = new TrackNotificationListener() { |
2951 | 2950 | @Override
|
2952 | 2951 | public void onTrack(@Nonnull String eventKey, @Nonnull String userId, @Nonnull Map<String, String> attributes, @Nonnull Map<String, ?> eventTags, @Nonnull LogEvent event) {
|
2953 | 2952 | assertEquals(eventType.getKey(), eventKey);
|
|
0 commit comments