|
17 | 17 |
|
18 | 18 | import com.fasterxml.jackson.core.JsonFactory; |
19 | 19 | import com.fasterxml.jackson.core.JsonGenerator; |
| 20 | +import com.google.gson.Gson; |
| 21 | +import com.google.gson.JsonObject; |
20 | 22 | import com.intuit.ipp.data.BatchItemRequest; |
21 | 23 | import com.intuit.ipp.data.CDCQuery; |
22 | 24 | import com.intuit.ipp.data.Customer; |
@@ -45,11 +47,13 @@ public class BatchItemRequestSerializerTest { |
45 | 47 |
|
46 | 48 | private BatchItemRequestSerializer serializer; |
47 | 49 | private JsonFactory factory; |
| 50 | + private Gson gson; |
48 | 51 |
|
49 | 52 | @BeforeClass |
50 | 53 | public void setUp() { |
51 | 54 | serializer = new BatchItemRequestSerializer(); |
52 | 55 | factory = new JsonFactory(); |
| 56 | + gson = new Gson(); |
53 | 57 | } |
54 | 58 |
|
55 | 59 | @Test |
@@ -163,7 +167,13 @@ public void testBatchSerialize_CDCQuery() throws IOException { |
163 | 167 |
|
164 | 168 | generator.flush(); |
165 | 169 | String output = outputStream.toString(); |
166 | | - Assert.assertEquals(output, "{\"bId\":\"bID6\",\"CDCQuery\":{\"Entities\":\"Customer\",\"ChangedSince\":\"2019-01-01T05:30:00.666+05:30\"}}"); |
| 170 | + JsonObject jsonObject = gson.fromJson(output, JsonObject.class); |
| 171 | + Assert.assertNotNull(output); |
| 172 | + Assert.assertEquals(jsonObject.get("bId").getAsString(), "bID6"); |
| 173 | + JsonObject cdcQueryJson = jsonObject.get("CDCQuery").getAsJsonObject(); |
| 174 | + Assert.assertNotNull(cdcQueryJson); |
| 175 | + Assert.assertEquals(cdcQueryJson.get("Entities").getAsString(), "Customer"); |
| 176 | + Assert.assertEquals(cdcQueryJson.get("ChangedSince").getAsString().split("T")[0], "2019-01-01"); |
167 | 177 | } |
168 | 178 |
|
169 | 179 | @Test |
|
0 commit comments