Added new test case, for potential crash

This commit is contained in:
TheArrayser 2023-09-24 13:54:27 +02:00
parent 55cdd506fb
commit 30aca3702c

View File

@ -98,6 +98,20 @@ public class OTPTest {
});
});
}
@Test
public void meeemstersCrashTest() {
assertDoesNotThrow(() -> {
String secret = "s3ydtxo35tz3n3ob5dehlh76ciokhmsbbae5zusz4vm3k6wxmt6lsfvt";
//String base32secret = Base32.encode(hexStr2Bytes(secret));
OTP testOTP1 = OTP.createNewOTP(OTPType.HOTP, secret, OTPAlgorithm.MD5, 12, 0, 1, true);
assertDoesNotThrow(() -> testOTP1.getPin());
//OTP testOTP2 = OTP.createNewOTP(OTPType.HOTP, Base32.encode(hexStr2Bytes(secret)), OTPAlgorithm.MD5, 12, 0, 1, true);
//assertDoesNotThrow(() -> testOTP2.getPin());
});
}
private static byte[] hexStr2Bytes(String hex) {
// Adding one byte to get the right conversion