@@ -265,15 +265,15 @@ public void identifyEventIsSerialized() throws IOException {
265
265
@ Test
266
266
public void customEventIsSerialized () throws IOException {
267
267
LDContext context = LDContext .builder ("userkey" ).name ("me" ).build ();
268
- LDValue contextKeysJson = LDValue .buildObject ().put ("user " , context . getKey () ).build ();
268
+ LDValue contextJson = LDValue .buildObject ().put ("kind " , "user" ). put ( "key" , "userkey" ). put ( "name" , "me" ).build ();
269
269
EventOutputFormatter f = new EventOutputFormatter (defaultEventsConfig ());
270
270
271
271
Event .Custom ceWithoutData = customEvent (context , "customkey" ).build ();
272
272
LDValue ceJson1 = parseValue ("{" +
273
273
"\" kind\" :\" custom\" ," +
274
274
"\" creationDate\" :100000," +
275
275
"\" key\" :\" customkey\" ," +
276
- "\" contextKeys \" :" + contextKeysJson +
276
+ "\" context \" :" + contextJson +
277
277
"}" );
278
278
assertJsonEquals (ceJson1 , getSingleOutputEvent (f , ceWithoutData ));
279
279
@@ -282,7 +282,7 @@ public void customEventIsSerialized() throws IOException {
282
282
"\" kind\" :\" custom\" ," +
283
283
"\" creationDate\" :100000," +
284
284
"\" key\" :\" customkey\" ," +
285
- "\" contextKeys \" :" + contextKeysJson + "," +
285
+ "\" context \" :" + contextJson + "," +
286
286
"\" data\" :\" thing\" " +
287
287
"}" );
288
288
assertJsonEquals (ceJson2 , getSingleOutputEvent (f , ceWithData ));
@@ -292,7 +292,7 @@ public void customEventIsSerialized() throws IOException {
292
292
"\" kind\" :\" custom\" ," +
293
293
"\" creationDate\" :100000," +
294
294
"\" key\" :\" customkey\" ," +
295
- "\" contextKeys \" :" + contextKeysJson + "," +
295
+ "\" context \" :" + contextJson + "," +
296
296
"\" metricValue\" :2.5" +
297
297
"}" );
298
298
assertJsonEquals (ceJson3 , getSingleOutputEvent (f , ceWithMetric ));
@@ -303,7 +303,7 @@ public void customEventIsSerialized() throws IOException {
303
303
"\" kind\" :\" custom\" ," +
304
304
"\" creationDate\" :100000," +
305
305
"\" key\" :\" customkey\" ," +
306
- "\" contextKeys \" :" + contextKeysJson + "," +
306
+ "\" context \" :" + contextJson + "," +
307
307
"\" data\" :\" thing\" ," +
308
308
"\" metricValue\" :2.5" +
309
309
"}" );
@@ -408,8 +408,10 @@ public void migrationOpEventIsSerialized() throws IOException {
408
408
.put ("reason" , LDValue .buildObject ()
409
409
.put ("kind" , "FALLTHROUGH" )
410
410
.build ()).build ())
411
- .put ("contextKeys" , LDValue .buildObject ()
412
- .put ("user" , "user-key" )
411
+ .put ("context" , LDValue .buildObject ()
412
+ .put ("kind" , "user" )
413
+ .put ("key" , "user-key" )
414
+ .put ("name" , "me" )
413
415
.build ())
414
416
.put ("samplingRatio" , 2 )
415
417
.put ("measurements" , LDValue .buildArray ()
@@ -495,8 +497,10 @@ public void migrationOpEventSerializationCanExcludeOptionalItems() throws IOExce
495
497
.put ("reason" , LDValue .buildObject ()
496
498
.put ("kind" , "FALLTHROUGH" )
497
499
.build ()).build ())
498
- .put ("contextKeys" , LDValue .buildObject ()
499
- .put ("user" , "user-key" )
500
+ .put ("context" , LDValue .buildObject ()
501
+ .put ("kind" , "user" )
502
+ .put ("key" , "user-key" )
503
+ .put ("name" , "me" )
500
504
.build ())
501
505
.put ("measurements" , LDValue .buildArray ()
502
506
.add (LDValue .buildObject ()
0 commit comments