@@ -50,6 +50,8 @@ public void setUp() {
50
50
51
51
@ Test
52
52
public void basicSetGetShouldSucceed () {
53
+ Assume .assumeFalse (protocol == RedisProtocol .RESP3 );
54
+
53
55
// naive set with a path
54
56
jsonV2 .jsonSetWithEscape ("null" , ROOT_PATH , (Object ) null );
55
57
assertJsonArrayEquals (jsonArray ((Object ) null ), jsonV2 .jsonGet ("null" , ROOT_PATH ));
@@ -70,6 +72,29 @@ public void basicSetGetShouldSucceed() {
70
72
assertJsonArrayEquals (jsonArray ("strung" ), jsonV2 .jsonGet ("obj" , p ));
71
73
}
72
74
75
+ @ Test
76
+ public void basicSetGetShouldSucceedResp3 () {
77
+ Assume .assumeTrue (protocol == RedisProtocol .RESP3 );
78
+
79
+ // naive set with a path
80
+ jsonV2 .jsonSetWithEscape ("null" , ROOT_PATH , (Object ) null );
81
+ assertJsonArrayEquals (jsonArray ((Object ) null ), jsonV2 .jsonGet ("null" , ROOT_PATH ));
82
+
83
+ // real scalar value and no path
84
+ jsonV2 .jsonSetWithEscape ("str" , "strong" );
85
+ assertJsonArrayEquals (jsonArray ("strong" ), jsonV2 .jsonGet ("str" ));
86
+
87
+ // a slightly more complex object
88
+ IRLObject obj = new IRLObject ();
89
+ jsonV2 .jsonSetWithEscape ("obj" , obj );
90
+ assertJsonArrayEquals (jsonArray (new JSONObject (gson .toJson (obj ))), jsonV2 .jsonGet ("obj" ));
91
+
92
+ // check an update
93
+ Path2 p = Path2 .of (".str" );
94
+ jsonV2 .jsonSet ("obj" , p , gson .toJson ("strung" ));
95
+ assertJsonArrayEquals (jsonArray ("strung" ), jsonV2 .jsonGet ("obj" , p ));
96
+ }
97
+
73
98
@ Test
74
99
public void setExistingPathOnlyIfExistsShouldSucceed () {
75
100
jsonV2 .jsonSetWithEscape ("obj" , new IRLObject ());
0 commit comments