use of com.optimizely.ab.event.internal.payload.EventBatch in project java-sdk by optimizely.
the class JsonSimpleSerializerTest method serializeConversion.
@Test
public void serializeConversion() throws IOException, ParseException {
EventBatch conversion = generateConversion();
// can't compare JSON strings since orders could vary so compare JSONObjects instead
JSONObject actual = (JSONObject) parser.parse(serializer.serialize(conversion));
JSONObject expected = (JSONObject) parser.parse(generateConversionJson());
assertThat(actual, is(expected));
}
use of com.optimizely.ab.event.internal.payload.EventBatch in project java-sdk by optimizely.
the class JsonSimpleSerializerTest method serializeImpressionWithSessionId.
@Test
public void serializeImpressionWithSessionId() throws IOException, ParseException {
EventBatch impression = generateImpressionWithSessionId();
// can't compare JSON strings since orders could vary so compare JSONObjects instead
JSONObject actual = (JSONObject) parser.parse(serializer.serialize(impression));
JSONObject expected = (JSONObject) parser.parse(generateImpressionWithSessionIdJson());
assertThat(actual, is(expected));
}
use of com.optimizely.ab.event.internal.payload.EventBatch in project java-sdk by optimizely.
the class GsonSerializerTest 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 = gson.fromJson(serializer.serialize(impression), EventBatch.class);
EventBatch expected = gson.fromJson(generateImpressionJson(), EventBatch.class);
assertThat(actual, is(expected));
}
use of com.optimizely.ab.event.internal.payload.EventBatch in project java-sdk by optimizely.
the class JacksonSerializerTest method serializeImpressionWithSessionId.
@Test
public void serializeImpressionWithSessionId() throws IOException {
EventBatch impression = generateImpressionWithSessionId();
// 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(generateImpressionWithSessionIdJson(), EventBatch.class);
assertThat(actual, is(expected));
}
use of com.optimizely.ab.event.internal.payload.EventBatch in project java-sdk by optimizely.
the class JsonSerializerTest method serializeConversion.
@Test
public void serializeConversion() throws IOException {
EventBatch conversion = generateConversion();
// can't compare JSON strings since orders could vary so compare JSONObjects instead
JSONObject actual = new JSONObject(serializer.serialize(conversion));
JSONObject expected = new JSONObject(generateConversionJson());
assertTrue(actual.similar(expected));
}
Aggregations