Skip to content

Commit

Permalink
Test for dontShowNullForMissingCommandDescription
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarg committed Oct 4, 2023
1 parent d5e14a9 commit 5902f52
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/test/java/com/beust/jcommander/DefaultUsageFormatterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -391,4 +391,18 @@ class Arg {
c.getUsageFormatter().usage(sb);
Assert.assertTrue(sb.toString().contains("Default: <empty string>"));
}

@Test
public void dontShowNullForMissingCommandDescription() {
// given
class Command {}
JCommander jc = JCommander.newBuilder().addCommand("testCommand", new Command()).build();
StringBuilder sb = new StringBuilder();

// when
jc.getUsageFormatter().usage(sb);

// then
Assert.assertFalse(sb.toString().contains("null"));
}
}

0 comments on commit 5902f52

Please sign in to comment.