@Test
public void validate_notBefore_success() throws Exception {

  String algo = "HS256";
  Clock clock1 = Clock.systemUTC();
  // This token cannot be used until 1 minute in the future.
  Instant notBefore = clock1.instant().plus(Duration.ofMinutes(1));
  ToBeSignedJwt unverified =
      new ToBeSignedJwt.Builder().setAlgorithm(algo).setNotBefore(notBefore).build();
  // Move the clock to 2 minutes in the future.
  Clock clock2 = Clock.offset(clock1, Duration.ofMinutes(2));
  JwtValidator validator = new JwtValidator.Builder().setClock(clock2).build();
  Jwt token = validator.validate(algo, unverified);
  assertThat(token.getNotBefore().getEpochSecond()).isEqualTo(notBefore.getEpochSecond());
}