use of com.microsoft.graph.models.generated.BaseRecurrenceRange in project msgraph-sdk-java by microsoftgraph.
the class DefaultSeralizerTests method testRecurrenceRangeSerialization.
@Test
public void testRecurrenceRangeSerialization() throws Exception {
final String expected = "{\"type\":\"endDate\",\"startDate\":\"2016-04-25\",\"endDate\":\"2016-05-25\",\"recurrenceTimeZone\":\"PST\",\"numberOfOccurrences\":4}";
final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
BaseRecurrenceRange brr = new BaseRecurrenceRange();
brr.type = RecurrenceRangeType.END_DATE;
brr.startDate = new DateOnly(2016, 4, 25);
brr.endDate = new DateOnly(2016, 5, 25);
brr.recurrenceTimeZone = "PST";
brr.numberOfOccurrences = 4;
String jsonOut = serializer.serializeObject(brr);
assertNotNull(jsonOut);
assertEquals(expected, jsonOut);
}
use of com.microsoft.graph.models.generated.BaseRecurrenceRange in project msgraph-sdk-java by microsoftgraph.
the class DefaultSeralizerTests method testRecurrenceRangeDeserialization.
@Test
public void testRecurrenceRangeDeserialization() throws Exception {
final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
String source = "{\n" + " \"type\": \"noEnd\",\n" + " \"startDate\": \"2016-04-27\",\n" + " \"endDate\": \"0001-01-01\",\n" + " \"recurrenceTimeZone\": \"China Standard Time\",\n" + " \"numberOfOccurrences\": 0\n" + "}";
BaseRecurrenceRange baseRecurrenceRange = serializer.deserializeObject(source, BaseRecurrenceRange.class);
assertNotNull(source);
assertEquals(RecurrenceRangeType.NO_END, baseRecurrenceRange.type);
assertEquals("2016-04-27", baseRecurrenceRange.startDate.toString());
assertEquals("0001-01-01", baseRecurrenceRange.endDate.toString());
assertEquals("China Standard Time", baseRecurrenceRange.recurrenceTimeZone);
assertEquals(Integer.valueOf(0), baseRecurrenceRange.numberOfOccurrences);
}
Aggregations