Skip to content

Commit

Permalink
Minor modification in error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
heySourabh committed Aug 25, 2023
1 parent 8764247 commit dd7be4e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/util/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public String get(String arg) {
.limit(2)
.toList();
if (option.size() != 2) {
throw new NoSuchElementException("Cannot find argument named: " + argName);
throw new NoSuchElementException("Cannot find value for argument named: " + argName);
}

return option.get(1);
Expand Down
4 changes: 2 additions & 2 deletions test/main/util/OptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public void test_throws_when_argument_is_not_present() {
Options options = new Options(args);

NoSuchElementException exception = assertThrows(NoSuchElementException.class, () -> options.get("not-arg"));
assertEquals("Cannot find argument named: --not-arg", exception.getMessage());
assertEquals("Cannot find value for argument named: --not-arg", exception.getMessage());
exception = assertThrows(NoSuchElementException.class, () -> options.get("incomplete"));
assertEquals("Cannot find argument named: --incomplete", exception.getMessage());
assertEquals("Cannot find value for argument named: --incomplete", exception.getMessage());
}

@Test
Expand Down

0 comments on commit dd7be4e

Please sign in to comment.