Skip to content

Commit 480802d

Browse files
committed
Use isEmpty().
1 parent bb3c587 commit 480802d

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/test/java/org/apache/commons/cli/OptionGroupTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void testSingleOptionFromGroup() throws Exception
7373
assertTrue( "Confirm -d is NOT set", !cl.hasOption("d") );
7474
assertTrue( "Confirm -s is NOT set", !cl.hasOption("s") );
7575
assertTrue( "Confirm -c is NOT set", !cl.hasOption("c") );
76-
assertTrue( "Confirm no extra args", cl.getArgList().size() == 0);
76+
assertTrue( "Confirm no extra args", cl.getArgList().isEmpty());
7777
}
7878

7979
@Test
@@ -88,7 +88,7 @@ public void testSingleOption() throws Exception
8888
assertTrue( "Confirm -d is NOT set", !cl.hasOption("d") );
8989
assertTrue( "Confirm -s is NOT set", !cl.hasOption("s") );
9090
assertTrue( "Confirm -c is NOT set", !cl.hasOption("c") );
91-
assertTrue( "Confirm no extra args", cl.getArgList().size() == 0);
91+
assertTrue( "Confirm no extra args", cl.getArgList().isEmpty());
9292
}
9393

9494
@Test
@@ -103,7 +103,7 @@ public void testTwoValidOptions() throws Exception
103103
assertTrue( "Confirm -d is NOT set", !cl.hasOption("d") );
104104
assertTrue( "Confirm -s is NOT set", !cl.hasOption("s") );
105105
assertTrue( "Confirm -c is NOT set", !cl.hasOption("c") );
106-
assertTrue( "Confirm no extra args", cl.getArgList().size() == 0);
106+
assertTrue( "Confirm no extra args", cl.getArgList().isEmpty());
107107
}
108108

109109
@Test
@@ -118,7 +118,7 @@ public void testSingleLongOption() throws Exception
118118
assertTrue( "Confirm -d is NOT set", !cl.hasOption("d") );
119119
assertTrue( "Confirm -s is NOT set", !cl.hasOption("s") );
120120
assertTrue( "Confirm -c is NOT set", !cl.hasOption("c") );
121-
assertTrue( "Confirm no extra args", cl.getArgList().size() == 0);
121+
assertTrue( "Confirm no extra args", cl.getArgList().isEmpty());
122122
}
123123

124124
@Test
@@ -133,7 +133,7 @@ public void testTwoValidLongOptions() throws Exception
133133
assertTrue( "Confirm -d is NOT set", !cl.hasOption("d") );
134134
assertTrue( "Confirm -s is NOT set", !cl.hasOption("s") );
135135
assertTrue( "Confirm -c is NOT set", !cl.hasOption("c") );
136-
assertTrue( "Confirm no extra args", cl.getArgList().size() == 0);
136+
assertTrue( "Confirm no extra args", cl.getArgList().isEmpty());
137137
}
138138

139139
@Test
@@ -198,7 +198,7 @@ public void testTwoOptionsFromDifferentGroup() throws Exception
198198
assertTrue( "Confirm -d is NOT set", !cl.hasOption("d") );
199199
assertTrue( "Confirm -s is set", cl.hasOption("s") );
200200
assertTrue( "Confirm -c is NOT set", !cl.hasOption("c") );
201-
assertTrue( "Confirm NO extra args", cl.getArgList().size() == 0);
201+
assertTrue( "Confirm NO extra args", cl.getArgList().isEmpty());
202202
}
203203

204204
@Test

src/test/java/org/apache/commons/cli/ParserTestCase.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public void testStopAtExpectedArg() throws Exception
227227

228228
assertTrue("Confirm -b is set", cl.hasOption('b'));
229229
assertEquals("Confirm -b is set", "foo", cl.getOptionValue('b'));
230-
assertTrue("Confirm no extra args: " + cl.getArgList().size(), cl.getArgList().size() == 0);
230+
assertTrue("Confirm no extra args: " + cl.getArgList().size(), cl.getArgList().isEmpty());
231231
}
232232

233233
@Test
@@ -676,7 +676,7 @@ public void testWithRequiredOption() throws Exception
676676
assertTrue("Confirm -a is NOT set", !cl.hasOption("a"));
677677
assertTrue("Confirm -b is set", cl.hasOption("b"));
678678
assertTrue("Confirm arg of -b", cl.getOptionValue("b").equals("file"));
679-
assertTrue("Confirm NO of extra args", cl.getArgList().size() == 0);
679+
assertTrue("Confirm NO of extra args", cl.getArgList().isEmpty());
680680
}
681681

682682
@Test
@@ -693,7 +693,7 @@ public void testOptionAndRequiredOption() throws Exception
693693
assertTrue("Confirm -a is set", cl.hasOption("a"));
694694
assertTrue("Confirm -b is set", cl.hasOption("b"));
695695
assertTrue("Confirm arg of -b", cl.getOptionValue("b").equals("file"));
696-
assertTrue("Confirm NO of extra args", cl.getArgList().size() == 0);
696+
assertTrue("Confirm NO of extra args", cl.getArgList().isEmpty());
697697
}
698698

699699
@Test

0 commit comments

Comments
 (0)