|
1 | 1 | package com.microsoft.graph.functional; |
2 | 2 |
|
3 | 3 | import static org.junit.Assert.assertEquals; |
| 4 | +import static org.junit.Assert.assertNotNull; |
4 | 5 |
|
5 | 6 | import org.junit.Before; |
6 | 7 | import org.junit.Ignore; |
7 | 8 | import org.junit.Test; |
8 | 9 |
|
9 | 10 | import com.google.gson.JsonObject; |
| 11 | +import com.google.gson.JsonParser; |
10 | 12 | import com.microsoft.graph.models.extensions.User; |
11 | 13 |
|
12 | 14 | /** |
@@ -41,4 +43,22 @@ public void testCustomGet() { |
41 | 43 | assertEquals(meGraphService.displayName, meOriginal.displayName); |
42 | 44 | assertEquals(meJson.get("displayName").getAsString(), meOriginal.displayName); |
43 | 45 | } |
| 46 | + |
| 47 | + /** |
| 48 | + * Test PUT with a custom request for both serialized and JSON content |
| 49 | + */ |
| 50 | + @Test |
| 51 | + public void testCustomPut() { |
| 52 | + JsonParser parser = new JsonParser(); |
| 53 | + String str = "{ \"appActivityId\": \"/article?12345\", \"activitySourceHost\": \"https://www.contoso.com\", \"userTimezone\": \"Africa/Casablanca\"," |
| 54 | + + " \"appDisplayName\": \"Contoso, Ltd.\", \"activationUrl\": \"https://www.contoso.com/article?id=12345\", \"contentUrl\": \"https://www.contoso.com/article?id=12345\", " |
| 55 | + + "\"fallbackUrl\": \"https://www.contoso.com/article?id=12345\", \"contentInfo\": { \"@context\": \"https://schema.org\", \"@type\": \"Article\", \"author\": \"Jennifer Booth\", " |
| 56 | + + "\"name\": \"How to Tie a Reef Knot\" }, \"visualElements\": { \"attribution\": { \"iconUrl\": \"https://www.contoso.com/icon\", \"alternateText\": \"Contoso, Ltd.\", " |
| 57 | + + "\"addImageQuery\": false }, \"description\": \"How to Tie a Reef Knot. A step-by-step visual guide to the art of nautical knot-tying.\", \"backgroundColor\": \"#ff0000\"," |
| 58 | + + " \"displayText\": \"Contoso How-To: How to Tie a Reef Knot\", \"content\": { \"$schema\": \"https://adaptivecards.io/schemas/adaptive-card.json\", \"type\": \"AdaptiveCard\"," |
| 59 | + + " \"body\": [{ \"type\": \"TextBlock\", \"text\": \"Contoso MainPage\" }] } } }"; |
| 60 | + |
| 61 | + JsonObject response = testBase.graphClient.customRequest("/me/activities/%2Farticle%3F12346").buildRequest().put(parser.parse(str).getAsJsonObject()); |
| 62 | + assertNotNull(response); |
| 63 | + } |
44 | 64 | } |
0 commit comments