forked from microsoftgraph/msgraph-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDurationTests.java
More file actions
28 lines (21 loc) · 863 Bytes
/
DurationTests.java
File metadata and controls
28 lines (21 loc) · 863 Bytes
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
package com.microsoft.graph.serializer;
import static org.junit.Assert.assertEquals;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
import org.junit.Test;
public class DurationTests {
@Test
public void testDurationSerializer() throws Exception {
String strDuration = DatatypeFactory.newInstance().newDurationDayTime(true, 0, 2, 30, 0).toString();
assertEquals("P0DT2H30M0S", strDuration);
}
@Test
public void testDurationDeserializer() throws Exception {
Duration duration = DatatypeFactory.newInstance().newDurationDayTime(true, 0, 1, 30, 45);
assertEquals(0, duration.getMonths());
assertEquals(0, duration.getDays());
assertEquals(1, duration.getHours());
assertEquals(30, duration.getMinutes());
assertEquals(45, duration.getSeconds());
}
}