2626import java .io .IOException ;
2727
2828import static org .junit .jupiter .api .Assertions .assertEquals ;
29+ import static org .junit .jupiter .api .Assertions .assertNull ;
2930import static org .junit .jupiter .api .Assertions .assertThrows ;
3031
3132import java .text .SimpleDateFormat ;
@@ -157,6 +158,9 @@ void testDateConversion() throws IOException
157158 assertEquals (DateConverter .toCalendar (testString1 ).toInstant (),
158159 LocalDateTime .parse (testString1 , ISO_LOCAL_DATE_TIME ).atZone (ZoneId .of ("UTC" ))
159160 .toInstant ());
161+
162+ assertNull (DateConverter .toCalendar (null ));
163+ assertNull (DateConverter .toCalendar ("" ));
160164 }
161165
162166 /**
@@ -176,6 +180,16 @@ void testDateFormatting() throws IOException
176180 dateFormat .format (DateConverter .toCalendar (DateConverter .toISO8601 (cal ,true )).getTime ())
177181 );
178182
183+ cal = DateConverter .toCalendar ("2015-02-02T16:37:19.192+09:09" );
184+ assertEquals (dateFormat .format (cal .getTime ()),
185+ dateFormat .format (DateConverter .toCalendar (DateConverter .toISO8601 (cal ,true )).getTime ())
186+ );
187+
188+ cal = DateConverter .toCalendar ("2015-02-02T16:37:19.192+10:10" );
189+ assertEquals (dateFormat .format (cal .getTime ()),
190+ dateFormat .format (DateConverter .toCalendar (DateConverter .toISO8601 (cal ,true )).getTime ())
191+ );
192+
179193 // PDFBOX-6107
180194 cal = DateConverter .toCalendar ("0000-01-01" );
181195 cal .setTimeZone (TimeZone .getTimeZone ("UTC" ));
0 commit comments