@@ -46,22 +46,26 @@ public void allAttributesAreSerialized() throws Exception {
46
46
}
47
47
48
48
@ Test
49
- public void contextKeysAreSetInsteadOfContextWhenNotInlined () throws Exception {
50
- testContextKeysSerialization (
49
+ public void contextIsAlwaysInlined () throws Exception {
50
+ testContextSerialization (
51
51
LDContext .create ("userkey" ),
52
- LDValue .buildObject ().put ("user" , "userkey" ).build ()
52
+ LDValue .buildObject ().put ("kind" , " user" ). put ( "key " , "userkey" ).build ()
53
53
);
54
54
55
- testContextKeysSerialization (
55
+ testContextSerialization (
56
56
LDContext .create (ContextKind .of ("kind1" ), "key1" ),
57
- LDValue .buildObject ().put ("kind1" , "key1" ).build ()
57
+ LDValue .buildObject ().put ("kind" , " kind1" ). put ( "key " , "key1" ).build ()
58
58
);
59
59
60
- testContextKeysSerialization (
60
+ testContextSerialization (
61
61
LDContext .createMulti (
62
62
LDContext .create (ContextKind .of ("kind1" ), "key1" ),
63
63
LDContext .create (ContextKind .of ("kind2" ), "key2" )),
64
- LDValue .buildObject ().put ("kind1" , "key1" ).put ("kind2" , "key2" ).build ()
64
+ LDValue .buildObject ()
65
+ .put ("kind" , "multi" )
66
+ .put ("kind1" , LDValue .buildObject ().put ("key" , "key1" ).build ())
67
+ .put ("kind2" , LDValue .buildObject ().put ("key" , "key2" ).build ())
68
+ .build ()
65
69
);
66
70
}
67
71
@@ -709,14 +713,14 @@ private LDValue getSingleOutputEvent(EventOutputFormatter f, Event event) throws
709
713
return parseValue (w .toString ()).get (0 );
710
714
}
711
715
712
- private void testContextKeysSerialization (LDContext context , LDValue expectedJsonValue ) throws IOException {
716
+ private void testContextSerialization (LDContext context , LDValue expectedJsonValue ) throws IOException {
713
717
EventsConfiguration config = makeEventsConfig (false , null );
714
718
EventOutputFormatter f = new EventOutputFormatter (config );
715
719
716
720
Event .Custom customEvent = customEvent (context , "eventkey" ).build ();
717
721
LDValue outputEvent = getSingleOutputEvent (f , customEvent );
718
- assertJsonEquals (expectedJsonValue , outputEvent .get ("contextKeys " ));
719
- assertJsonEquals (LDValue .ofNull (), outputEvent .get ("context " ));
722
+ assertJsonEquals (expectedJsonValue , outputEvent .get ("context " ));
723
+ assertJsonEquals (LDValue .ofNull (), outputEvent .get ("contextKeys " ));
720
724
}
721
725
722
726
private void testInlineContextSerialization (LDContext context , LDValue expectedJsonValue , EventsConfiguration baseConfig ) throws IOException {
0 commit comments