1616 */
1717public class CalendarSerializerTests {
1818
19+ /**
20+ * Validate if a calendar date instance could be serialized
21+ * @throws Exception if calendar couldn't be serialized
22+ */
1923 @ Test
2024 public void testDateSerialization () throws Exception {
2125 Calendar calendar = Calendar .getInstance ();
@@ -25,7 +29,11 @@ public void testDateSerialization() throws Exception {
2529 assertNotNull (actual );
2630 assertEquals (expected , actual );
2731 }
28-
32+
33+ /**
34+ * Validate if a date without milliseconds and offset could be deserialized
35+ * @throws Exception if date is not parsable
36+ */
2937 @ Test
3038 public void testSimpleDateTimeDeserialization () throws Exception {
3139
@@ -44,6 +52,10 @@ public void testSimpleDateTimeDeserialization() throws Exception {
4452 TimeZone .setDefault (defaultTimeZone );
4553 }
4654
55+ /**
56+ * Validate if date with UTC timezone (z) could be deserialized
57+ * @throws Exception if date is not parsable
58+ */
4759 @ Test
4860 public void testUTCSimpleDateTimeDeserialization () throws Exception {
4961 String datetime = "2019-06-21T17:12:35Z" ;
@@ -54,6 +66,10 @@ public void testUTCSimpleDateTimeDeserialization() throws Exception {
5466 assertEquals (expected .getTimeInMillis (), actual .getTimeInMillis ());
5567 }
5668
69+ /**
70+ * Validate if date with UTC timezone (z) and milliseconds could be deserialized
71+ * @throws Exception if date is not parsable
72+ */
5773 @ Test
5874 public void testUTCDateTimeWithMillisDeserialization () throws Exception {
5975 String datetime = "2019-06-21T17:12:35.1385912Z" ;
@@ -64,6 +80,10 @@ public void testUTCDateTimeWithMillisDeserialization() throws Exception {
6480 assertEquals (expected .getTimeInMillis (), actual .getTimeInMillis ());
6581 }
6682
83+ /**
84+ * Validate if date with UTC offset (+00:00) could be deserialized
85+ * @throws Exception if date is not parsable
86+ */
6787 @ Test
6888 public void testUTCDateTimeInOffsetFormatDeserialization () throws Exception {
6989 String datetime = "2019-06-21T17:12:35+00:00" ;
@@ -74,6 +94,10 @@ public void testUTCDateTimeInOffsetFormatDeserialization() throws Exception {
7494 assertEquals (expected .getTimeInMillis (), actual .getTimeInMillis ());
7595 }
7696
97+ /**
98+ * Validate if date with UTC offset (+00:00) and milliseconds could be deserialized
99+ * @throws Exception if date is not parsable
100+ */
77101 @ Test
78102 public void testUTCDateTimeWithMillisAndOffsetDeserialization () throws Exception {
79103 String datetime = "2019-06-21T17:12:35.1385912+00:00" ;
@@ -84,6 +108,10 @@ public void testUTCDateTimeWithMillisAndOffsetDeserialization() throws Exception
84108 assertEquals (expected .getTimeInMillis (), actual .getTimeInMillis ());
85109 }
86110
111+ /**
112+ * Validate if date with different UTC offset (+0000) could be deserialized
113+ * @throws Exception if date is not parsable
114+ */
87115 @ Test
88116 public void testUTCDateTimeInNonstandardOffsetFormatDeserialization () throws Exception {
89117 String datetime = "2019-06-21T17:12:35+0000" ;
@@ -94,6 +122,10 @@ public void testUTCDateTimeInNonstandardOffsetFormatDeserialization() throws Exc
94122 assertEquals (expected .getTimeInMillis (), actual .getTimeInMillis ());
95123 }
96124
125+ /**
126+ * Validate if date with positive timezone offset (+07:00) could be deserialized
127+ * @throws Exception if date is not parsable
128+ */
97129 @ Test
98130 public void testDateTimePositiveOffsetFormatDeserialization () throws Exception {
99131 String datetime = "2019-06-21T17:12:35+07:00" ;
@@ -104,6 +136,10 @@ public void testDateTimePositiveOffsetFormatDeserialization() throws Exception {
104136 assertEquals (expected .getTimeInMillis (), actual .getTimeInMillis ());
105137 }
106138
139+ /**
140+ * Validate if date with positive timezone offset (+07:00) and milliseconds could be deserialized
141+ * @throws Exception if date is not parsable
142+ */
107143 @ Test
108144 public void testDateTimeWithMillisAndPositiveOffsetDeserialization () throws Exception {
109145 String datetime = "2019-06-21T17:12:35.1385912+07:00" ;
@@ -114,6 +150,10 @@ public void testDateTimeWithMillisAndPositiveOffsetDeserialization() throws Exce
114150 assertEquals (expected .getTimeInMillis (), actual .getTimeInMillis ());
115151 }
116152
153+ /**
154+ * Validate if date with positive timezone offset in different format (+0700) could be deserialized
155+ * @throws Exception if date is not parsable
156+ */
117157 @ Test
118158 public void testUTCDateTimeInNonstandardPositiveOffsetFormatDeserialization () throws Exception {
119159 String datetime = "2019-06-21T17:12:35+0700" ;
@@ -124,6 +164,10 @@ public void testUTCDateTimeInNonstandardPositiveOffsetFormatDeserialization() th
124164 assertEquals (expected .getTimeInMillis (), actual .getTimeInMillis ());
125165 }
126166
167+ /**
168+ * Validate if date with negative timezone offset (-07:00) could be deserialized
169+ * @throws Exception if date is not parsable
170+ */
127171 @ Test
128172 public void testDateTimeNegativeOffsetFormatDeserialization () throws Exception {
129173 String datetime = "2019-06-21T17:12:35-07:00" ;
@@ -134,6 +178,10 @@ public void testDateTimeNegativeOffsetFormatDeserialization() throws Exception {
134178 assertEquals (expected .getTimeInMillis (), actual .getTimeInMillis ());
135179 }
136180
181+ /**
182+ * Validate if date with negative timezone offset (-07:00) and milliseconds could be deserialized
183+ * @throws Exception if date is not parsable
184+ */
137185 @ Test
138186 public void testDateTimeWithMillisAndNegativeOffsetDeserialization () throws Exception {
139187 String datetime = "2019-06-21T17:12:35.1385912-07:00" ;
@@ -144,6 +192,10 @@ public void testDateTimeWithMillisAndNegativeOffsetDeserialization() throws Exce
144192 assertEquals (expected .getTimeInMillis (), actual .getTimeInMillis ());
145193 }
146194
195+ /**
196+ * Validate if date with negative timezone offset in different format (-0700) could be deserialized
197+ * @throws Exception if date is not parsable
198+ */
147199 @ Test
148200 public void testUTCDateTimeInNonstandardNegativeOffsetFormatDeserialization () throws Exception {
149201 String datetime = "2019-06-21T17:12:35-0700" ;
0 commit comments