Skip to content

Updating unit tests in EventFactoryTest #256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.optimizely.ab.bucketing.Bucketer;
import com.optimizely.ab.bucketing.DecisionService;
import com.optimizely.ab.bucketing.UserProfileService;
import com.optimizely.ab.config.Attribute;
import com.optimizely.ab.config.EventType;
import com.optimizely.ab.config.Experiment;
import com.optimizely.ab.config.ProjectConfig;
import com.optimizely.ab.config.Variation;
import com.optimizely.ab.error.ErrorHandler;
import com.optimizely.ab.event.LogEvent;
import com.optimizely.ab.event.internal.payload.Decision;
import com.optimizely.ab.event.internal.payload.EventBatch;
Expand Down Expand Up @@ -147,6 +144,7 @@ public void createImpressionEventPassingUserAgentAttribute() throws Exception {
assertThat((double) eventBatch.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getTimestamp(), closeTo((double) System.currentTimeMillis(), 1000.0));
assertFalse(eventBatch.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0).getIsCampaignHoldback());
assertThat(eventBatch.getAnonymizeIp(), is(validProjectConfig.getAnonymizeIP()));
assertTrue(eventBatch.getEnrichDecisions());
assertThat(eventBatch.getProjectId(), is(validProjectConfig.getProjectId()));
assertThat(eventBatch.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0), is(expectedDecision));
assertThat(eventBatch.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0).getCampaignId(),
Expand Down Expand Up @@ -206,6 +204,7 @@ public void createImpressionEvent() throws Exception {
assertThat((double) eventBatch.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getTimestamp(), closeTo((double) System.currentTimeMillis(), 1000.0));
assertFalse(eventBatch.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0).getIsCampaignHoldback());
assertThat(eventBatch.getAnonymizeIp(), is(validProjectConfig.getAnonymizeIP()));
assertTrue(eventBatch.getEnrichDecisions());
assertThat(eventBatch.getProjectId(), is(validProjectConfig.getProjectId()));
assertThat(eventBatch.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0), is(expectedDecision));
assertThat(eventBatch.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0).getCampaignId(),
Expand Down Expand Up @@ -521,6 +520,7 @@ public void createConversionEvent() throws Exception {
assertTrue(conversion.getVisitors().get(0).getAttributes().containsAll(expectedUserFeatures));
assertTrue(conversion.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getTags().equals(eventTagMap));
assertEquals(conversion.getAnonymizeIp(), validProjectConfig.getAnonymizeIP());
assertTrue(conversion.getEnrichDecisions());
assertEquals(conversion.getClientName(), EventBatch.ClientEngine.JAVA_SDK.getClientEngineValue());
assertEquals(conversion.getClientVersion(), BuildVersionInfo.VERSION);
}
Expand Down Expand Up @@ -588,6 +588,7 @@ public void createConversionEventPassingUserAgentAttribute() throws Exception {
assertTrue(conversion.getVisitors().get(0).getAttributes().containsAll(expectedUserFeatures));
assertTrue(conversion.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getTags().equals(eventTagMap));
assertEquals(conversion.getAnonymizeIp(), validProjectConfig.getAnonymizeIP());
assertTrue(conversion.getEnrichDecisions());
assertEquals(conversion.getClientName(), EventBatch.ClientEngine.JAVA_SDK.getClientEngineValue());
assertEquals(conversion.getClientVersion(), BuildVersionInfo.VERSION);
}
Expand Down Expand Up @@ -822,6 +823,7 @@ public void createImpressionEventWithBucketingId() throws Exception {
assertThat((double) impression.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getTimestamp(), closeTo((double) System.currentTimeMillis(), 1000.0));
assertFalse(impression.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0).getIsCampaignHoldback());
assertThat(impression.getAnonymizeIp(), is(projectConfig.getAnonymizeIP()));
assertTrue(impression.getEnrichDecisions());
assertThat(impression.getProjectId(), is(projectConfig.getProjectId()));
assertThat(impression.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0), is(expectedDecision));
assertThat(impression.getVisitors().get(0).getSnapshots().get(0).getDecisions().get(0).getCampaignId(), is(activatedExperiment.getLayerId()));
Expand Down Expand Up @@ -900,6 +902,7 @@ public void createConversionEventWithBucketingId() throws Exception {
assertEquals(conversion.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getQuantity(), null);
assertTrue(conversion.getVisitors().get(0).getSnapshots().get(0).getEvents().get(0).getTags().equals(eventTagMap));
assertEquals(conversion.getAnonymizeIp(), validProjectConfig.getAnonymizeIP());
assertTrue(conversion.getEnrichDecisions());
assertEquals(conversion.getClientName(), EventBatch.ClientEngine.JAVA_SDK.getClientEngineValue());
assertEquals(conversion.getClientVersion(), BuildVersionInfo.VERSION);
}
Expand Down