|
16 | 16 | import com.google.gson.JsonElement; |
17 | 17 | import com.google.gson.JsonObject; |
18 | 18 | import com.google.gson.JsonPrimitive; |
| 19 | +import com.microsoft.graph.logger.DefaultLogger; |
19 | 20 | import com.microsoft.graph.models.extensions.PlannerAssignedToTaskBoardTaskFormat; |
20 | 21 | import com.microsoft.graph.models.extensions.PlannerAssignment; |
21 | 22 | import com.microsoft.graph.models.extensions.PlannerAssignments; |
|
35 | 36 | import com.microsoft.graph.requests.extensions.IPlannerTaskDetailsRequest; |
36 | 37 | import com.microsoft.graph.requests.extensions.IPlannerTaskRequest; |
37 | 38 | import com.microsoft.graph.serializer.AdditionalDataManager; |
| 39 | +import com.microsoft.graph.serializer.DefaultSerializer; |
38 | 40 |
|
39 | 41 | @Ignore |
40 | 42 | public class PlannerTests { |
@@ -402,6 +404,51 @@ public void testDeleteBucket() { |
402 | 404 | req.addHeader("If-Match", createdBucket.etag); |
403 | 405 | req.delete(); |
404 | 406 | } |
| 407 | + |
| 408 | + @Test |
| 409 | + public void testPlannerChecklistItemDeserialization() throws Exception{ |
| 410 | + String input = "{\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#planner/tasks('433tZlfn_USJwWRL9khDx8kALTM7')/details/$entity\",\"@odata.etag\":\"W/\\\"JzEtVGFza0RldGFpbHMgQEBAQEBAQEBAQEBAQEBAcCc=\\\"\",\"description\":\"This is a test description of test event two.\",\"previewType\":\"automatic\",\"id\":\"433tZlfn_USJwWRL9khDx8kALTM7\",\"references\":{},\"checklist\":{\"55554\":{\"@odata.type\":\"#microsoft.graph.plannerChecklistItem\",\"isChecked\":false,\"title\":\"Test Item 2\",\"orderHint\":\"8586580527[2\",\"lastModifiedDateTime\":\"2018-11-30T05:01:53.0387892Z\",\"lastModifiedBy\":{\"user\":{\"displayName\":null,\"id\":\"ec786dee-da15-4896-8e73-57141477bae7\"}}},\"91100\":{\"@odata.type\":\"#microsoft.graph.plannerChecklistItem\",\"isChecked\":true,\"title\":\"Test Item 1 \",\"orderHint\":\"8586580528393292964Pc\",\"lastModifiedDateTime\":\"2018-11-30T05:01:47.4138223Z\",\"lastModifiedBy\":{\"user\":{\"displayName\":null,\"id\":\"ec786dee-da15-4896-8e73-57141477bae7\"}}}}}"; |
| 411 | + final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger()); |
| 412 | + PlannerTaskDetails ptd = serializer.deserializeObject(input, PlannerTaskDetails.class); |
| 413 | + assertNotNull(ptd); |
| 414 | + PlannerChecklistItem item1 = ptd.checklist.get("91100"); |
| 415 | + assertEquals(item1.title,"Test Item 1 "); |
| 416 | + PlannerChecklistItem item2 = ptd.checklist.get("55554"); |
| 417 | + assertEquals(item2.title,"Test Item 2"); |
| 418 | + } |
| 419 | + |
| 420 | + @Test |
| 421 | + public void testPlannerTaskDetailsDeserialization() { |
| 422 | + String input = "{\r\n" + |
| 423 | + " \"references\": {},\r\n" + |
| 424 | + " \"@odata.etag\": \"W/\\\"JzEtVGFza0RldGFpbHMgQEBAQEBAQEBAQEBAQEBAUCc=\\\"\",\r\n" + |
| 425 | + " \"description\": null,\r\n" + |
| 426 | + " \"checklist\": {\r\n" + |
| 427 | + " \"42660\": {\r\n" + |
| 428 | + " \"lastModifiedDateTime\": \"2018-10-28T14:29:37.7423391Z\",\r\n" + |
| 429 | + " \"@odata.type\": \"#microsoft.graph.plannerChecklistItem\",\r\n" + |
| 430 | + " \"orderHint\": \"8586608699726429822PK\",\r\n" + |
| 431 | + " \"lastModifiedBy\": {\r\n" + |
| 432 | + " \"user\": {\r\n" + |
| 433 | + " \"displayName\": null,\r\n" + |
| 434 | + " \"id\": \"f3a1dfe8-f2ef-4870-9642-413d468c571c\"\r\n" + |
| 435 | + " }\r\n" + |
| 436 | + " },\r\n" + |
| 437 | + " \"title\": \"Ein Checklisteneintrag\",\r\n" + |
| 438 | + " \"isChecked\": false\r\n" + |
| 439 | + " }\r\n" + |
| 440 | + " },\r\n" + |
| 441 | + " \"@odata.context\": \"https://graph.microsoft.com/v1.0/$metadata#planner/tasks('C6iIn6oJcEGcLX5XAiKeCZcAOv30')/details/$entity\",\r\n" + |
| 442 | + " \"previewType\": \"automatic\",\r\n" + |
| 443 | + " \"id\": \"C6iIn6oJcEGcLX5XAiKeCZcAOv30\"\r\n" + |
| 444 | + "}"; |
| 445 | + final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger()); |
| 446 | + PlannerTaskDetails ptd = serializer.deserializeObject(input, PlannerTaskDetails.class); |
| 447 | + assertNotNull(ptd); |
| 448 | + PlannerChecklistItem item = ptd.checklist.get("42660"); |
| 449 | + assertEquals(item.title, "Ein Checklisteneintrag"); |
| 450 | + assertEquals(item.isChecked, false); |
| 451 | + } |
405 | 452 |
|
406 | 453 | @AfterClass |
407 | 454 | public static void tearDown() throws InterruptedException { |
|
0 commit comments