Skip to content

Commit

Permalink
Add exception message to Throws test #1453
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier B. OURA committed Apr 17, 2021
1 parent 1143ab3 commit 3772a2f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/test/java/org/cactoos/bytes/HexOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,27 @@ public void validHex() throws Exception {
).affirm();
}

@Test
public void invalidHexLength() throws Exception {
new Assertion<>(
"Must invalid hex length",
() -> new HexOf(new TextOf("ABF")).asBytes(),
new Throws<>(IOException.class)
new Throws<>(
"Length of hexadecimal text is odd",
IOException.class
)
).affirm();
}

@Test
public void invalidHex() throws Exception {
new Assertion<>(
"Must invalid hex",
() -> new HexOf(new TextOf("ABG!")).asBytes(),
new Throws<>(IOException.class)
new Throws<>(
"Unexpected character 'G'",
IOException.class
)
).affirm();
}
}

0 comments on commit 3772a2f

Please sign in to comment.