Skip to content
This repository was archived by the owner on Sep 4, 2020. It is now read-only.

Commit 59ee5da

Browse files
author
Brian Melton
committed
Adding test for serialization
1 parent a046822 commit 59ee5da

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

graphsdk/src/androidTest/java/com/microsoft/graph/serializer/DefaultSerializerTests.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.microsoft.graph.extensions.RecurrenceRangeType;
2929
import com.microsoft.graph.generated.BaseRecurrenceRange;
3030
import com.microsoft.graph.logger.DefaultLogger;
31+
import com.microsoft.graph.model.DateOnly;
3132

3233
/**
3334
* Test cases for the {@see DefaultSerializer}
@@ -69,6 +70,16 @@ public void testRecurrenceRangeDeserialization() throws Exception {
6970
}
7071

7172
public void testRecurrenceRangeSerialization() throws Exception {
72-
73+
final String expected = "{\"endDate\":\"2016-05-25\",\"numberOfOccurrences\":4,\"@odata.type\":\"microsoft.graph.recurrenceRange\",\"recurrenceTimeZone\":\"PST\",\"startDate\":\"2016-04-25\",\"type\":\"endDate\"}";
74+
final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
75+
BaseRecurrenceRange brr = new BaseRecurrenceRange();
76+
brr.type = RecurrenceRangeType.endDate;
77+
brr.startDate = new DateOnly(2016, 4, 25);
78+
brr.endDate = new DateOnly(2016, 5, 25);
79+
brr.recurrenceTimeZone = "PST";
80+
brr.numberOfOccurrences = 4;
81+
String jsonOut = serializer.serializeObject(brr);
82+
assertNotNull(jsonOut);
83+
assertEquals(jsonOut, expected);
7384
}
7485
}

0 commit comments

Comments
 (0)