Skip to content

Commit

Permalink
fix erroneous validation failure of VID major-version zero (#335)
Browse files Browse the repository at this point in the history
* remove bad instantiation test

* fix majorVersion validation in PdsVid
  • Loading branch information
alexdunnjpl authored May 15, 2023
1 parent 7523d54 commit ac0685e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ public class PdsVid implements Comparable<PdsVid> {
private final int minorVersion;

public PdsVid(int majorVersion, int minorVersion) {
if (majorVersion < 1) {
String errMsg = String.format("majorVersion must be 1 or higher (got '%d'))", majorVersion);
if (majorVersion < 0) {
String errMsg = String.format("majorVersion must be 0 or higher (got '%d'))", majorVersion);
throw new IllegalArgumentException(errMsg);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ public void testValidInstantiations() {

@Test
public void testInvalidInstantiations() {
Assert.assertThrows(IllegalArgumentException.class, () -> {
PdsVid.fromString("0.1");
});

Assert.assertThrows(IllegalArgumentException.class, () -> {
PdsVid.fromString("1.-1");
});
Expand Down

0 comments on commit ac0685e

Please sign in to comment.