Skip to content

Commit a2a6adb

Browse files
committed
PDFBOX-6119: expand test coverage
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1930464 13f79535-47bb-0310-9956-ffa450edef68
1 parent c19ed78 commit a2a6adb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

xmpbox/src/test/java/org/apache/xmpbox/DateConverterTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.io.IOException;
2727

2828
import static org.junit.jupiter.api.Assertions.assertEquals;
29+
import static org.junit.jupiter.api.Assertions.assertNull;
2930
import static org.junit.jupiter.api.Assertions.assertThrows;
3031

3132
import 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

Comments
 (0)