Skip to content

Commit be9f017

Browse files
committed
Using the encoder on state is too broad.
Related to issue: #14 Currently only the conditions and class name are encoded: https://github.com/ParsePlatform/ParseLiveQuery-iOS-OSX/blob/master/Sources/ParseLiveQuery/Internal/QueryEncoder.swift fix test
1 parent 948563c commit be9f017

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ParseLiveQuery/src/main/java/com/parse/SubscribeClientOperation.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
jsonObject.put("requestId", requestId);
2323
jsonObject.put("sessionToken", sessionToken);
2424

25-
JSONObject queryJsonObject = state.toJSON(PointerEncoder.get());
25+
JSONObject queryJsonObject = new JSONObject();
26+
queryJsonObject.put("className", state.className());
27+
28+
PointerEncoder pointerEncoder = PointerEncoder.get();
29+
queryJsonObject.put("where", pointerEncoder.encode(state.constraints()));
2630

2731
jsonObject.put("query", queryJsonObject);
2832

ParseLiveQuery/src/test/java/com/parse/TestParseLiveQueryClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public void testUnsubscribeWhenSubscribedToCallback() throws Exception {
116116
@Test
117117
public void testErrorWhileSubscribing() throws Exception {
118118
ParseQuery.State state = mock(ParseQuery.State.class);
119-
when(state.toJSON(any(ParseEncoder.class))).thenThrow(new RuntimeException("forced error"));
119+
when(state.constraints()).thenThrow(new RuntimeException("forced error"));
120120

121121
ParseQuery.State.Builder builder = mock(ParseQuery.State.Builder.class);
122122
when(builder.build()).thenReturn(state);

0 commit comments

Comments
 (0)