Skip to content

Commit 43a343a

Browse files
Updating unit tests in EventFactoryTest (#256)
1 parent 04ce75d commit 43a343a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

core-api/src/test/java/com/optimizely/ab/event/internal/EventFactoryTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@
2020
import com.google.gson.Gson;
2121
import com.google.gson.GsonBuilder;
2222
import com.optimizely.ab.bucketing.Bucketer;
23-
import com.optimizely.ab.bucketing.DecisionService;
24-
import com.optimizely.ab.bucketing.UserProfileService;
2523
import com.optimizely.ab.config.Attribute;
2624
import com.optimizely.ab.config.EventType;
2725
import com.optimizely.ab.config.Experiment;
2826
import com.optimizely.ab.config.ProjectConfig;
2927
import com.optimizely.ab.config.Variation;
30-
import com.optimizely.ab.error.ErrorHandler;
3128
import com.optimizely.ab.event.LogEvent;
3229
import com.optimizely.ab.event.internal.payload.Decision;
3330
import com.optimizely.ab.event.internal.payload.EventBatch;
@@ -147,6 +144,7 @@ public void createImpressionEventPassingUserAgentAttribute() throws Exception {
147144
assertThat((double) eventBatch.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getTimestamp(), closeTo((double) System.currentTimeMillis(), 1000.0));
148145
assertFalse(eventBatch.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0).getIsCampaignHoldback());
149146
assertThat(eventBatch.getAnonymizeIp(), is(validProjectConfig.getAnonymizeIP()));
147+
assertTrue(eventBatch.getEnrichDecisions());
150148
assertThat(eventBatch.getProjectId(), is(validProjectConfig.getProjectId()));
151149
assertThat(eventBatch.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0), is(expectedDecision));
152150
assertThat(eventBatch.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0).getCampaignId(),
@@ -206,6 +204,7 @@ public void createImpressionEvent() throws Exception {
206204
assertThat((double) eventBatch.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getTimestamp(), closeTo((double) System.currentTimeMillis(), 1000.0));
207205
assertFalse(eventBatch.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0).getIsCampaignHoldback());
208206
assertThat(eventBatch.getAnonymizeIp(), is(validProjectConfig.getAnonymizeIP()));
207+
assertTrue(eventBatch.getEnrichDecisions());
209208
assertThat(eventBatch.getProjectId(), is(validProjectConfig.getProjectId()));
210209
assertThat(eventBatch.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0), is(expectedDecision));
211210
assertThat(eventBatch.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0).getCampaignId(),
@@ -521,6 +520,7 @@ public void createConversionEvent() throws Exception {
521520
assertTrue(conversion.getVisitors().get(0).getAttributes().containsAll(expectedUserFeatures));
522521
assertTrue(conversion.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getTags().equals(eventTagMap));
523522
assertEquals(conversion.getAnonymizeIp(), validProjectConfig.getAnonymizeIP());
523+
assertTrue(conversion.getEnrichDecisions());
524524
assertEquals(conversion.getClientName(), EventBatch.ClientEngine.JAVA_SDK.getClientEngineValue());
525525
assertEquals(conversion.getClientVersion(), BuildVersionInfo.VERSION);
526526
}
@@ -588,6 +588,7 @@ public void createConversionEventPassingUserAgentAttribute() throws Exception {
588588
assertTrue(conversion.getVisitors().get(0).getAttributes().containsAll(expectedUserFeatures));
589589
assertTrue(conversion.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getTags().equals(eventTagMap));
590590
assertEquals(conversion.getAnonymizeIp(), validProjectConfig.getAnonymizeIP());
591+
assertTrue(conversion.getEnrichDecisions());
591592
assertEquals(conversion.getClientName(), EventBatch.ClientEngine.JAVA_SDK.getClientEngineValue());
592593
assertEquals(conversion.getClientVersion(), BuildVersionInfo.VERSION);
593594
}
@@ -822,6 +823,7 @@ public void createImpressionEventWithBucketingId() throws Exception {
822823
assertThat((double) impression.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getTimestamp(), closeTo((double) System.currentTimeMillis(), 1000.0));
823824
assertFalse(impression.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0).getIsCampaignHoldback());
824825
assertThat(impression.getAnonymizeIp(), is(projectConfig.getAnonymizeIP()));
826+
assertTrue(impression.getEnrichDecisions());
825827
assertThat(impression.getProjectId(), is(projectConfig.getProjectId()));
826828
assertThat(impression.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0), is(expectedDecision));
827829
assertThat(impression.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0).getCampaignId(), is(activatedExperiment.getLayerId()));
@@ -900,6 +902,7 @@ public void createConversionEventWithBucketingId() throws Exception {
900902
assertEquals(conversion.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getQuantity(), null);
901903
assertTrue(conversion.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getTags().equals(eventTagMap));
902904
assertEquals(conversion.getAnonymizeIp(), validProjectConfig.getAnonymizeIP());
905+
assertTrue(conversion.getEnrichDecisions());
903906
assertEquals(conversion.getClientName(), EventBatch.ClientEngine.JAVA_SDK.getClientEngineValue());
904907
assertEquals(conversion.getClientVersion(), BuildVersionInfo.VERSION);
905908
}

0 commit comments

Comments
 (0)