Skip to content

Commit

Permalink
additional test case
Browse files Browse the repository at this point in the history
  • Loading branch information
BastiaanJansen committed Aug 4, 2021
1 parent 5f22cee commit bcfca82
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/test/java/com/bastiaanjansen/otp/TOTPGeneratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ void verify() {
assertTrue(generator.verify(generator.generate()));
}

@Test
void verifyOlderCode() {
TOTPGenerator generator = new TOTPGenerator.Builder(secret).build();
String code = generator.generate(Instant.now().minusSeconds(30));
assertFalse(generator.verify(code));
assertTrue(generator.verify(code, 1));
}

@Test
void generateWithPeriodOfZero() {
assertThrows(IllegalArgumentException.class, () -> {
Expand Down

0 comments on commit bcfca82

Please sign in to comment.