Search in sources :

Example 1 with RecurrenceRange

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

the class DefaultSerializerTests method testRecurrenceRangeSerialization.

@Test
public void testRecurrenceRangeSerialization() throws Exception {
    final String expected = "{\"endDate\":\"2016-05-25\",\"numberOfOccurrences\":4,\"recurrenceTimeZone\":\"PST\",\"startDate\":\"2016-04-25\",\"type\":\"endDate\"}";
    final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
    RecurrenceRange brr = new RecurrenceRange();
    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);
}
Also used : DefaultSerializer(com.microsoft.graph.serializer.DefaultSerializer) RecurrenceRange(com.microsoft.graph.models.RecurrenceRange) DateOnly(com.microsoft.graph.core.DateOnly) DefaultLogger(com.microsoft.graph.logger.DefaultLogger) Test(org.junit.jupiter.api.Test)

Example 2 with RecurrenceRange

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

the class DefaultSerializerTests 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" + "}";
    RecurrenceRange baseRecurrenceRange = serializer.deserializeObject(source, RecurrenceRange.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);
}
Also used : DefaultSerializer(com.microsoft.graph.serializer.DefaultSerializer) RecurrenceRange(com.microsoft.graph.models.RecurrenceRange) DefaultLogger(com.microsoft.graph.logger.DefaultLogger) Test(org.junit.jupiter.api.Test)

Example 3 with RecurrenceRange

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

the class DefaultSerializerTests method testRecurrenceRangeSerialization.

@Test
public void testRecurrenceRangeSerialization() throws Exception {
    final String expected = "{\"endDate\":\"2016-05-25\",\"numberOfOccurrences\":4,\"recurrenceTimeZone\":\"PST\",\"startDate\":\"2016-04-25\",\"type\":\"endDate\"}";
    final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
    RecurrenceRange brr = new RecurrenceRange();
    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);
}
Also used : DefaultSerializer(com.microsoft.graph.serializer.DefaultSerializer) RecurrenceRange(com.microsoft.graph.models.RecurrenceRange) DateOnly(com.microsoft.graph.core.DateOnly) DefaultLogger(com.microsoft.graph.logger.DefaultLogger) Test(org.junit.jupiter.api.Test)

Example 4 with RecurrenceRange

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

the class DefaultSerializerTests 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" + "}";
    RecurrenceRange baseRecurrenceRange = serializer.deserializeObject(source, RecurrenceRange.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);
}
Also used : DefaultSerializer(com.microsoft.graph.serializer.DefaultSerializer) RecurrenceRange(com.microsoft.graph.models.RecurrenceRange) DefaultLogger(com.microsoft.graph.logger.DefaultLogger) Test(org.junit.jupiter.api.Test)

Aggregations

DefaultLogger (com.microsoft.graph.logger.DefaultLogger)4 RecurrenceRange (com.microsoft.graph.models.RecurrenceRange)4 DefaultSerializer (com.microsoft.graph.serializer.DefaultSerializer)4 Test (org.junit.jupiter.api.Test)4 DateOnly (com.microsoft.graph.core.DateOnly)2