This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git
The following commit(s) were added to refs/heads/master by this push:
new f4ab6c9 Add missing test
f4ab6c9 is described below
commit f4ab6c9dbe062e558dff98ae68c3bc7f5da06372
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Apr 8 08:18:07 2024 -0400
Add missing test
---
.../org/apache/commons/cli/ParseException.java | 2 ++
.../org/apache/commons/cli/ParseExceptionTest.java | 40 ++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/src/main/java/org/apache/commons/cli/ParseException.java
b/src/main/java/org/apache/commons/cli/ParseException.java
index 2af1614..b2f5dbf 100644
--- a/src/main/java/org/apache/commons/cli/ParseException.java
+++ b/src/main/java/org/apache/commons/cli/ParseException.java
@@ -49,6 +49,7 @@ public class ParseException extends Exception {
}
return new ParseException(e);
}
+
/**
* Constructs a new {@code ParseException} with the specified detail
message.
*
@@ -60,6 +61,7 @@ public class ParseException extends Exception {
/**
* Constructs a new {@code ParseException} wrapping the specified
exception.
+ *
* @param e the Exception to wrap.
*/
public ParseException(final Throwable e) {
diff --git a/src/test/java/org/apache/commons/cli/ParseExceptionTest.java
b/src/test/java/org/apache/commons/cli/ParseExceptionTest.java
new file mode 100644
index 0000000..293f624
--- /dev/null
+++ b/src/test/java/org/apache/commons/cli/ParseExceptionTest.java
@@ -0,0 +1,40 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ */
+
+package org.apache.commons.cli;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.IOException;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests {@link ParseException}.
+ */
+public class ParseExceptionTest {
+
+ @Test
+ public void testConstructor() {
+ assertEquals("a", new ParseException("a").getMessage());
+ final Throwable t = new IOException();
+ assertEquals(t, new ParseException(t).getCause());
+ assertEquals(t, ParseException.wrap(t).getCause());
+ final ParseException pe = new ParseException("A");
+ assertEquals(pe, ParseException.wrap(pe));
+ }
+}