Search in sources :

Example 1 with DriveItemCreateUploadSessionParameterSet

use of com.microsoft.graph.models.DriveItemCreateUploadSessionParameterSet in project msgraph-sdk-java by microsoftgraph.

the class AdditionalDataTests method testPropsAdditionalDataOnNonIJSONObjects.

@Test
public void testPropsAdditionalDataOnNonIJSONObjects() {
    final DriveItemUploadableProperties upProps = new DriveItemUploadableProperties();
    upProps.name = "vacation.gif";
    upProps.additionalDataManager().put("@microsoft.graph.conflictBehavior", new JsonPrimitive("rename"));
    final DriveItemCreateUploadSessionParameterSet body = DriveItemCreateUploadSessionParameterSet.newBuilder().withItem(upProps).build();
    String serializedObject = serializer.serializeObject(body);
    assertEquals("{\"item\":{\"name\":\"vacation.gif\",\"@microsoft.graph.conflictBehavior\":\"rename\"}}", serializedObject);
}
Also used : DriveItemUploadableProperties(com.microsoft.graph.models.DriveItemUploadableProperties) JsonPrimitive(com.google.gson.JsonPrimitive) DriveItemCreateUploadSessionParameterSet(com.microsoft.graph.models.DriveItemCreateUploadSessionParameterSet) Test(org.junit.jupiter.api.Test)

Example 2 with DriveItemCreateUploadSessionParameterSet

use of com.microsoft.graph.models.DriveItemCreateUploadSessionParameterSet in project msgraph-beta-sdk-java by microsoftgraph.

the class AdditionalDataTests method testPropsAdditionalDataOnNonIJSONObjects.

@Test
public void testPropsAdditionalDataOnNonIJSONObjects() {
    final DriveItemUploadableProperties upProps = new DriveItemUploadableProperties();
    upProps.name = "vacation.gif";
    upProps.additionalDataManager().put("@microsoft.graph.conflictBehavior", new JsonPrimitive("rename"));
    final DriveItemCreateUploadSessionParameterSet body = DriveItemCreateUploadSessionParameterSet.newBuilder().withItem(upProps).build();
    String serializedObject = serializer.serializeObject(body);
    assertEquals("{\"item\":{\"name\":\"vacation.gif\",\"@microsoft.graph.conflictBehavior\":\"rename\"}}", serializedObject);
}
Also used : DriveItemUploadableProperties(com.microsoft.graph.models.DriveItemUploadableProperties) JsonPrimitive(com.google.gson.JsonPrimitive) DriveItemCreateUploadSessionParameterSet(com.microsoft.graph.models.DriveItemCreateUploadSessionParameterSet) Test(org.junit.jupiter.api.Test)

Aggregations

JsonPrimitive (com.google.gson.JsonPrimitive)2 DriveItemCreateUploadSessionParameterSet (com.microsoft.graph.models.DriveItemCreateUploadSessionParameterSet)2 DriveItemUploadableProperties (com.microsoft.graph.models.DriveItemUploadableProperties)2 Test (org.junit.jupiter.api.Test)2