### Question:
CodeVerifierUtil { public static void checkCodeVerifier(String codeVerifier) { checkArgument(MIN_CODE_VERIFIER_LENGTH <= codeVerifier.length(), "codeVerifier length is shorter than allowed by the PKCE specification"); checkArgument(codeVerifier.length() <= MAX_CODE_VERIFIER_LENGTH, "codeVerifier length is longer than allowed by the PKCE specification"); checkArgument(REGEX_CODE_VERIFIER.matcher(codeVerifier).matches(), "codeVerifier string contains illegal characters"); } private  CodeVerifierUtil(); static void checkCodeVerifier(String codeVerifier); static String generateRandomCodeVerifier(); static String generateRandomCodeVerifier(SecureRandom entropySource, int entropyBytes); static String deriveCodeVerifierChallenge(String codeVerifier); static String getCodeVerifierChallengeMethod(); static String generateRandomState(); static final int MIN_CODE_VERIFIER_LENGTH; static final int MAX_CODE_VERIFIER_LENGTH; static final int DEFAULT_CODE_VERIFIER_ENTROPY; static final int MIN_CODE_VERIFIER_ENTROPY; static final int MAX_CODE_VERIFIER_ENTROPY; }### Answer:
@Test public void checkCodeVerifier_tooShort_throwsException() { String codeVerifier = createString(CodeVerifierUtil.MIN_CODE_VERIFIER_LENGTH - 1); try { CodeVerifierUtil.checkCodeVerifier(codeVerifier); fail("expected exception not thrown"); } catch (IllegalArgumentException ex) { assertThat(ex.getMessage()) .isEqualTo("codeVerifier length is shorter than allowed by the PKCE specification"); } }
@Test public void checkCodeVerifier_tooLong_throwsException() { String codeVerifier = createString(CodeVerifierUtil.MAX_CODE_VERIFIER_LENGTH + 1); try { CodeVerifierUtil.checkCodeVerifier(codeVerifier); fail("expected exception not thrown"); } catch (IllegalArgumentException ex) { assertThat(ex.getMessage()) .isEqualTo("codeVerifier length is longer than allowed by the PKCE specification"); } }