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 53af98d  Add missing test
53af98d is described below

commit 53af98d998fbec8822a4ef08df6ad670ed707814
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Apr 8 08:05:58 2024 -0400

    Add missing test
---
 ...ptionTest.java => AlreadySelectedExceptionTest.java} | 17 ++++++++++++-----
 .../commons/cli/UnrecognizedOptionExceptionTest.java    |  1 +
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git 
a/src/test/java/org/apache/commons/cli/UnrecognizedOptionExceptionTest.java 
b/src/test/java/org/apache/commons/cli/AlreadySelectedExceptionTest.java
similarity index 57%
copy from 
src/test/java/org/apache/commons/cli/UnrecognizedOptionExceptionTest.java
copy to src/test/java/org/apache/commons/cli/AlreadySelectedExceptionTest.java
index 85f7b8b..289b62f 100644
--- a/src/test/java/org/apache/commons/cli/UnrecognizedOptionExceptionTest.java
+++ b/src/test/java/org/apache/commons/cli/AlreadySelectedExceptionTest.java
@@ -14,21 +14,28 @@
   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 static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
 import org.junit.jupiter.api.Test;
 
 /**
- * Tests {@link UnrecognizedOptionException}.
+ * Tests {@link AlreadySelectedException}.
  */
-public class UnrecognizedOptionExceptionTest {
+public class AlreadySelectedExceptionTest {
 
     @Test
     public void testConstructor() {
-        assertEquals("a", new UnrecognizedOptionException("a").getMessage());
-        assertEquals("a", new UnrecognizedOptionException("a", 
"b").getMessage());
-        assertEquals("b", new UnrecognizedOptionException("a", 
"b").getOption());
+        assertEquals("a", new AlreadySelectedException("a").getMessage());
+        assertNull(new AlreadySelectedException("a").getOption());
+        final Option option = new Option("a", "d");
+        final OptionGroup group = new OptionGroup();
+        assertNotNull(new AlreadySelectedException(group, 
option).getMessage());
+        assertEquals(option, new AlreadySelectedException(group, 
option).getOption());
+        assertEquals(group, new AlreadySelectedException(group, 
option).getOptionGroup());
     }
 }
diff --git 
a/src/test/java/org/apache/commons/cli/UnrecognizedOptionExceptionTest.java 
b/src/test/java/org/apache/commons/cli/UnrecognizedOptionExceptionTest.java
index 85f7b8b..53a32d0 100644
--- a/src/test/java/org/apache/commons/cli/UnrecognizedOptionExceptionTest.java
+++ b/src/test/java/org/apache/commons/cli/UnrecognizedOptionExceptionTest.java
@@ -14,6 +14,7 @@
   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;

Reply via email to