Skip to content

Commit 06ed1a8

Browse files
committed
- adds a unit test to deserialize single extended value properties
1 parent b7b53f7 commit 06ed1a8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/test/java/com/microsoft/graph/serializer/CollectionPageSerializerTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.microsoft.graph.models.extensions.ServicePrincipal;
3131
import com.microsoft.graph.models.extensions.User;
3232
import com.microsoft.graph.requests.extensions.AttachmentCollectionPage;
33+
import com.microsoft.graph.requests.extensions.EventCollectionResponse;
3334
import com.microsoft.graph.requests.extensions.AttachmentCollectionResponse;
3435

3536
public class CollectionPageSerializerTests {
@@ -100,6 +101,14 @@ public void testEntityWithCollectionOfMultipleTypes() throws Exception {
100101
assertTrue(page.get(0) instanceof User);
101102
assertTrue(page.get(1) instanceof ServicePrincipal);
102103
}
104+
@Test
105+
public void testEntityCollectionWithSingleValueExtendedProperties() throws Exception {
106+
final String jsonString = "{\"@odata.context\": \"https://graph.microsoft.com/v1.0/$metadata#users('c2e8df37-c6a7-4d88-89b1-feb4f1fda7c5')/events\",\"@odata.nextLink\": \"https://graph.microsoft.com/v1.0/me/events?$skip=10\",\"value\": [{\"@odata.context\": \"https://graph.microsoft.com/v1.0/$metadata#Me/messages/$entity\",\"@odata.id\": \"https://graph.microsoft.com/v1.0/users('ddfcd489-628b-40d7-b48b-57002df800e5@1717622f-1d94-4d0c-9d74-709fad664b77')/messages('AAMkAGE1M2_bs88AACHsLqWAAA=')\",\"@odata.etag\": \"W/\\\"CQAAABYAAACY4MQpaFz9SbqUDe4+bs88AACbyS4H\\\"\",\"id\": \"AAMkAGE1M2_bs88AACHsLqWAAA=\",\"subject\": \"RE: Talk about emergency prep\",\"sender\": {\"emailAddress\": {\"name\": \"Christine Irwin\",\"address\": \"[email protected]\"}},\"from\": null,\"toRecipients\": [{\"emailAddress\": {\"name\": \"Christine Irwin\",\"address\": \"[email protected]\"}}],\"[email protected]\": \"https://graph.microsoft.com/v1.0/$metadata#Me/messages('AAMkAGE1M2_bs88AACHsLqWAAA%3D')/singleValueExtendedProperties\",\"singleValueExtendedProperties\": [{\"id\": \"String {66f5a359-4659-4830-9070-00047ec6ac6e} Name Color\",\"value\": \"Green\"}]}]}";
107+
final DefaultSerializer defaultSerializer = new DefaultSerializer(logger);
108+
final EventCollectionResponse events = defaultSerializer.deserializeObject(jsonString, EventCollectionResponse.class);
109+
assertNotNull(events);
110+
assertTrue(events.value.get(0).singleValueExtendedProperties.getCurrentPage().size() > 0);
111+
}
103112

104113
private FileAttachment getFileAttachment() throws Exception{
105114
FileAttachment fileAttachment = new FileAttachment();

0 commit comments

Comments
 (0)