You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2026/08/01 18:29:11 UTC
(commons-cli) 01/02: Add sanity check assertions in ConverterTests
This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git
commit a1ee9b97884cf32cf76f1bb5b8d0c47eb4487e96
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 1 14:27:54 2026 -0400
Add sanity check assertions in ConverterTests
---
src/test/java/org/apache/commons/cli/ConverterTests.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/test/java/org/apache/commons/cli/ConverterTests.java b/src/test/java/org/apache/commons/cli/ConverterTests.java
index 64052c41..1f6690f7 100644
--- a/src/test/java/org/apache/commons/cli/ConverterTests.java
+++ b/src/test/java/org/apache/commons/cli/ConverterTests.java
@@ -90,6 +90,7 @@ public class ConverterTests {
void testDateRejectsTrailingText() throws Exception {
final Date expected = new Date(1023400137000L);
final String formatted = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy").format(expected);
+ assertEquals(expected, Converter.DATE.apply(formatted));
assertThrows(java.text.ParseException.class, () -> Converter.DATE.apply(formatted + " trailing"));
}
@@ -100,6 +101,7 @@ public class ConverterTests {
// the reported error position should point past the parsed date rather than at index 0.
final Date expected = new Date(1023400137000L);
final String formatted = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy").format(expected);
+ assertEquals(expected, Converter.DATE.apply(formatted));
final java.text.ParseException e = assertThrows(java.text.ParseException.class, () -> Converter.DATE.apply(formatted + " trailing"));
assertEquals(formatted.length(), e.getErrorOffset());
}