【发布时间】:2021-07-09 07:39:49
【问题描述】:
我有一个TOTP Authenticator 项目,它使用TOTP (RFC 6238) 生成一个六位数的一次性密码。在内部它使用来自 Apache Commons Codec 的 Base32 类:
Base32 base32 = new Base32();
在commons-codec 升级1.14 -> 1.15之后,单元测试开始失败:
@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.
如何修复测试?
【问题讨论】:
标签: java totp apache-commons-codec