Search in sources :

Example 26 with EventBatch

use of com.optimizely.ab.event.internal.payload.EventBatch in project java-sdk by optimizely.

the class JsonSerializerTest method serializeConversionWithSessionId.

@Test
public void serializeConversionWithSessionId() throws IOException {
    EventBatch conversion = generateConversionWithSessionId();
    // can't compare JSON strings since orders could vary so compare JSONObjects instead
    JSONObject actual = new JSONObject(serializer.serialize(conversion));
    JSONObject expected = new JSONObject(generateConversionWithSessionIdJson());
    assertTrue(actual.similar(expected));
}
Also used : JSONObject(org.json.JSONObject) EventBatch(com.optimizely.ab.event.internal.payload.EventBatch) Test(org.junit.Test)

Example 27 with EventBatch

use of com.optimizely.ab.event.internal.payload.EventBatch in project java-sdk by optimizely.

the class JsonSerializerTest method serializeImpressionWithSessionId.

@Test
public void serializeImpressionWithSessionId() throws IOException {
    EventBatch impression = generateImpressionWithSessionId();
    // can't compare JSON strings since orders could vary so compare JSONObjects instead
    JSONObject actual = new JSONObject(serializer.serialize(impression));
    JSONObject expected = new JSONObject(generateImpressionWithSessionIdJson());
    assertTrue(actual.similar(expected));
}
Also used : JSONObject(org.json.JSONObject) EventBatch(com.optimizely.ab.event.internal.payload.EventBatch) Test(org.junit.Test)

Example 28 with EventBatch

use of com.optimizely.ab.event.internal.payload.EventBatch in project java-sdk by optimizely.

the class JsonSerializerTest method serializeImpression.

@Test
public void serializeImpression() throws IOException {
    EventBatch impression = generateImpression();
    // can't compare JSON strings since orders could vary so compare JSONObjects instead
    JSONObject actual = new JSONObject(serializer.serialize(impression));
    JSONObject expected = new JSONObject(generateImpressionJson());
    assertTrue(actual.similar(expected));
}
Also used : JSONObject(org.json.JSONObject) EventBatch(com.optimizely.ab.event.internal.payload.EventBatch) Test(org.junit.Test)

Example 29 with EventBatch

use of com.optimizely.ab.event.internal.payload.EventBatch in project java-sdk by optimizely.

the class JacksonSerializerTest method serializeImpression.

@Test
public void serializeImpression() throws IOException {
    EventBatch impression = generateImpression();
    // can't compare JSON strings since orders could vary so compare objects instead
    EventBatch actual = mapper.readValue(serializer.serialize(impression), EventBatch.class);
    EventBatch expected = mapper.readValue(generateImpressionJson(), EventBatch.class);
    assertThat(actual, is(expected));
}
Also used : EventBatch(com.optimizely.ab.event.internal.payload.EventBatch) Test(org.junit.Test)

Example 30 with EventBatch

use of com.optimizely.ab.event.internal.payload.EventBatch in project java-sdk by optimizely.

the class JacksonSerializerTest method serializeConversionWithSessionId.

@Test
public void serializeConversionWithSessionId() throws IOException {
    EventBatch conversion = generateConversionWithSessionId();
    // can't compare JSON strings since orders could vary so compare objects instead
    EventBatch actual = mapper.readValue(serializer.serialize(conversion), EventBatch.class);
    EventBatch expected = mapper.readValue(generateConversionWithSessionIdJson(), EventBatch.class);
    assertThat(actual, is(expected));
}
Also used : EventBatch(com.optimizely.ab.event.internal.payload.EventBatch) Test(org.junit.Test)

Aggregations

EventBatch (com.optimizely.ab.event.internal.payload.EventBatch)33 Test (org.junit.Test)27 LogEvent (com.optimizely.ab.event.LogEvent)13 Experiment (com.optimizely.ab.config.Experiment)12 Variation (com.optimizely.ab.config.Variation)12 Attribute (com.optimizely.ab.config.Attribute)9 EventType (com.optimizely.ab.config.EventType)7 Bucketer (com.optimizely.ab.bucketing.Bucketer)6 ProjectConfig (com.optimizely.ab.config.ProjectConfig)6 Decision (com.optimizely.ab.event.internal.payload.Decision)6 DecisionService (com.optimizely.ab.bucketing.DecisionService)5 UserProfileService (com.optimizely.ab.bucketing.UserProfileService)5 NoOpErrorHandler (com.optimizely.ab.error.NoOpErrorHandler)5 HashMap (java.util.HashMap)5 ErrorHandler (com.optimizely.ab.error.ErrorHandler)4 JSONObject (org.json.JSONObject)4 JSONObject (org.json.simple.JSONObject)4 Snapshot (com.optimizely.ab.event.internal.payload.Snapshot)3 Visitor (com.optimizely.ab.event.internal.payload.Visitor)3 ArrayList (java.util.ArrayList)3