### Question:
DefaultCodeVerifier implements CodeVerifier { @Override public boolean isValidCode(String secret, String code) { long currentBucket = Math.floorDiv(timeProvider.getTime(), timePeriod); boolean success = false; for (int i = -allowedTimePeriodDiscrepancy; i <= allowedTimePeriodDiscrepancy; i++) { success = checkCode(secret, currentBucket + i, code) || success; } return success; } DefaultCodeVerifier(CodeGenerator codeGenerator, TimeProvider timeProvider); void setTimePeriod(int timePeriod); void setAllowedTimePeriodDiscrepancy(int allowedTimePeriodDiscrepancy); @Override boolean isValidCode(String secret, String code);  }### Answer:
@Test public void testCodeIsValid() { String secret = "EX47GINFPBK5GNLYLILGD2H6ZLGJNNWB"; long timeToRunAt = 1567975936; String correctCode = "862707"; int timePeriod = 30; assertTrue(isValidCode(secret, correctCode, timeToRunAt - timePeriod, timePeriod)); assertTrue(isValidCode(secret, correctCode, timeToRunAt, timePeriod)); assertTrue(isValidCode(secret, correctCode, timeToRunAt + timePeriod, timePeriod)); assertFalse(isValidCode(secret, correctCode, timeToRunAt + timePeriod + 15, timePeriod)); assertFalse(isValidCode(secret, "123", timeToRunAt, timePeriod)); }