forked from microsoftgraph/msgraph-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDateOnlyTests.java
More file actions
39 lines (30 loc) · 1.05 KB
/
Copy pathDateOnlyTests.java
File metadata and controls
39 lines (30 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.microsoft.graph.serializer;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.microsoft.graph.models.extensions.DateOnly;
public class DateOnlyTests {
@Test
public void testDateSerializer() throws Exception {
String strDate = DateOnly.parse("2016-04-27").toString();
assertEquals("2016-04-27", strDate);
}
@Test
public void testDateSerializerIndefinite() throws Exception {
String strDate = DateOnly.parse("0001-01-01").toString();
assertEquals("0001-01-01", strDate);
}
@Test
public void testDateDeserializer() throws Exception {
DateOnly date = DateOnly.parse("2016-04-27");
assertEquals(2016, date.getYear());
assertEquals(4, date.getMonth());
assertEquals(27, date.getDay());
}
@Test
public void testDateDeserializerIndefinite() throws Exception{
DateOnly date = DateOnly.parse("0001-01-01");
assertEquals(1, date.getYear());
assertEquals(1, date.getMonth());
assertEquals(1, date.getDay());
}
}