### Question:
TokenGenerator { public static String generateToken(int length) { byte[] verifierBytes = new byte[length]; random.nextBytes(verifierBytes); return getAuthorizationCodeString(verifierBytes); }  static String generateToken(int length);  }### Answer:
@Test public void testIdGeneratorZeroLength() { String string = TokenGenerator.generateToken(0); assertEquals("", string); }
@Test public void testIdGeneratorLargeLength() { String string = TokenGenerator.generateToken(1000); assertEquals(1000, string.length()); for (int i = 0; i < string.length(); i++) { assertTrue(Character.isDigit(string.charAt(i)) || Character.isLetter(string.charAt(i))); } }
@Test public void testEdgeCharacters() { boolean foundChars = false; for (int i = 0; i < 25; i++) { String token = TokenGenerator.generateToken(10000); foundChars = token.indexOf('a') > -1 && token.indexOf('u') > -1 && token.indexOf('z') > -1 && token.indexOf('w') > -1 && token.indexOf('0') > -1 && token.indexOf('9') > -1; if (foundChars) break; } assertTrue(foundChars); }