Skip to content

Commit f2a5ecd

Browse files
committed
Assert that UncheckedNoSuchAlgorithmException instances have a non-null cause
1 parent a8dc8dd commit f2a5ecd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/test/java/com/eatthepath/otp/HmacOneTimePasswordGeneratorTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
import java.util.Locale;
3232
import java.util.stream.Stream;
3333

34-
import static org.junit.jupiter.api.Assertions.assertEquals;
35-
import static org.junit.jupiter.api.Assertions.assertThrows;
34+
import static org.junit.jupiter.api.Assertions.*;
3635
import static org.junit.jupiter.params.provider.Arguments.arguments;
3736

3837
public class HmacOneTimePasswordGeneratorTest {
@@ -53,8 +52,10 @@ void testHmacOneTimePasswordGeneratorWithLongPasswordLength() {
5352

5453
@Test
5554
void testHmacOneTimePasswordGeneratorWithBogusAlgorithm() {
56-
assertThrows(UncheckedNoSuchAlgorithmException.class, () ->
55+
final UncheckedNoSuchAlgorithmException exception = assertThrows(UncheckedNoSuchAlgorithmException.class, () ->
5756
new HmacOneTimePasswordGenerator(6, "Definitely not a real algorithm"));
57+
58+
assertNotNull(exception.getCause());
5859
}
5960

6061
@Test

0 commit comments

Comments
 (0)