I have a TOTP Authenticator project which generates a six-digit one-time password using TOTP (RFC 6238). Internally it uses Base32 class from Apache Commons Codec:
Base32 base32 = new Base32();
Following the commons-codec upgrade 1.14 -> 1.15, a unit test started to fail:
@Test
void testInvalidBase32Value() {
String secretKey = "AHXQ2W5P6AGKYVK";
Executable when = () -> generator.generateOtp(secretKey);
assertThrows(IllegalArgumentException.class, when);
}
org.opentest4j.AssertionFailedError: Expected java.lang.IllegalArgumentException to be thrown, but nothing was thrown.
How do I fix the test?