|
6 | 6 | import static org.junit.Assert.assertNull; |
7 | 7 | import static org.junit.Assert.assertTrue; |
8 | 8 |
|
| 9 | +import com.microsoft.graph.models.extensions.*; |
9 | 10 | import org.junit.Before; |
10 | 11 | import org.junit.Test; |
11 | 12 |
|
|
18 | 19 | import com.microsoft.graph.functional.TestBase; |
19 | 20 | import com.microsoft.graph.http.HttpMethod; |
20 | 21 | import com.microsoft.graph.logger.DefaultLogger; |
21 | | -import com.microsoft.graph.models.extensions.Drive; |
22 | | -import com.microsoft.graph.models.extensions.DriveItemCreateUploadSessionBody; |
23 | | -import com.microsoft.graph.models.extensions.DriveItemUploadableProperties; |
24 | | -import com.microsoft.graph.models.extensions.Entity; |
25 | | -import com.microsoft.graph.models.extensions.PlannerAssignment; |
26 | | -import com.microsoft.graph.models.extensions.PlannerAssignments; |
27 | | -import com.microsoft.graph.models.extensions.PlannerTask; |
28 | | -import com.microsoft.graph.models.extensions.PlannerTaskDetails; |
29 | | -import com.microsoft.graph.models.extensions.User; |
| 22 | + |
| 23 | +import java.util.Collections; |
30 | 24 |
|
31 | 25 | public class AdditionalDataTests { |
32 | 26 | public DefaultSerializer serializer; |
@@ -150,4 +144,20 @@ public void testHashMapProperties() { |
150 | 144 | assertTrue(taskDetails.checklist.get("d280ed1a-9f6b-4f9c-a962-fb4d00dc50ff").title.equals("Try reading task details")); |
151 | 145 | assertTrue(taskDetails.checklist.get("d280ed1a-9f6b-4f9c-a962-fb4d00dc50ff").lastModifiedBy.user.additionalDataManager().get("customProp").getAsString().equals("somestring")); |
152 | 146 | } |
| 147 | + |
| 148 | + @Test |
| 149 | + public void testSerializeAdditionalDataOnCollections() { |
| 150 | + ChatMessage chatMessage = new ChatMessage(); |
| 151 | + ChatMessageMention chatMessageMention = new ChatMessageMention(); |
| 152 | + chatMessageMention.additionalDataManager().put("helloWorld", new JsonPrimitive("3.141516")); |
| 153 | + IdentitySet identitySet = new IdentitySet(); |
| 154 | + identitySet.additionalDataManager().put("identitySetKey", new JsonPrimitive("identitySetValue")); |
| 155 | + chatMessageMention.mentioned = identitySet; |
| 156 | + chatMessage.mentions = Collections.singletonList(chatMessageMention); |
| 157 | + String output = serializer.serializeObject(chatMessage); |
| 158 | + assertTrue(output.contains("helloWorld")); |
| 159 | + assertTrue(output.contains("3.141516")); |
| 160 | + assertTrue(output.contains("identitySetKey")); |
| 161 | + assertTrue(output.contains("identitySetValue")); |
| 162 | + } |
153 | 163 | } |
0 commit comments