use of com.microsoft.graph.requests.DriveItemDeltaCollectionResponse in project msgraph-beta-sdk-java by microsoftgraph.
the class DefaultSerializerTests method testDriveItemChildAdditionalDataDeserialization.
/**
* Make sure that deserializing a DriveItems also deserializes child additionalData
*
* @throws Exception If there is an exception during the test
*/
@Test
public void testDriveItemChildAdditionalDataDeserialization() throws Exception {
final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
String source = "{\n" + " \"@odata.context\": \"https://graph.microsoft.com/v1.0/$metadata#users('02008492-3fec-4ce4-bb54-980ad856856f')/drive/root/children\",\n" + " \"value\": [\n" + " {\n" + " \"createdBy\": {\n" + " \"user\": {\n" + " \"email\": \"the@email.com\",\n" + " \"id\": \"02008492-3fec-4ce4-bb54-980ad856856f\",\n" + " \"displayName\": \"John Doe\"\n" + " }\n" + " }\n" + " }\n" + " ]\n" + "}";
DriveItemDeltaCollectionResponse result = serializer.deserializeObject(source, DriveItemDeltaCollectionResponse.class);
assertNotNull(result);
assertNotNull(result.value);
assertEquals(1, result.value.size());
assertNotNull(result.value.get(0));
assertNotNull(result.value.get(0).createdBy);
assertNotNull(result.value.get(0).createdBy.user);
assertNotNull(result.value.get(0).createdBy.user.additionalDataManager());
assertNotNull(result.value.get(0).createdBy.user.additionalDataManager().get("email"));
assertEquals("the@email.com", result.value.get(0).createdBy.user.additionalDataManager().get("email").getAsString());
}
use of com.microsoft.graph.requests.DriveItemDeltaCollectionResponse in project msgraph-sdk-java by microsoftgraph.
the class DefaultSerializerTests method testDriveItemChildAdditionalDataDeserialization.
/**
* Make sure that deserializing a DriveItems also deserializes child additionalData
*
* @throws Exception If there is an exception during the test
*/
@Test
public void testDriveItemChildAdditionalDataDeserialization() throws Exception {
final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
String source = "{\n" + " \"@odata.context\": \"https://graph.microsoft.com/v1.0/$metadata#users('02008492-3fec-4ce4-bb54-980ad856856f')/drive/root/children\",\n" + " \"value\": [\n" + " {\n" + " \"createdBy\": {\n" + " \"user\": {\n" + " \"email\": \"the@email.com\",\n" + " \"id\": \"02008492-3fec-4ce4-bb54-980ad856856f\",\n" + " \"displayName\": \"John Doe\"\n" + " }\n" + " }\n" + " }\n" + " ]\n" + "}";
DriveItemDeltaCollectionResponse result = serializer.deserializeObject(source, DriveItemDeltaCollectionResponse.class);
assertNotNull(result);
assertNotNull(result.value);
assertEquals(1, result.value.size());
assertNotNull(result.value.get(0));
assertNotNull(result.value.get(0).createdBy);
assertNotNull(result.value.get(0).createdBy.user);
assertNotNull(result.value.get(0).createdBy.user.additionalDataManager());
assertNotNull(result.value.get(0).createdBy.user.additionalDataManager().get("email"));
assertEquals("the@email.com", result.value.get(0).createdBy.user.additionalDataManager().get("email").getAsString());
}
Aggregations