CodeGenerator { public static boolean isValidUid( String code ) { return code != null && CODE_PATTERN.matcher( code ).matches(); }  static String generateUid(); static String generateCode( int codeSize ); static boolean isValidUid( String code ); static String getRandomUrlToken(); static final String letters; static final String ALLOWED_CHARS; static final int NUMBER_OF_CODEPOINTS; static final int CODESIZE; }
@Test public void testUidIsValid() { assertTrue( CodeGenerator.isValidUid( "mq4jAnN6fg3" ) ); assertTrue( CodeGenerator.isValidUid( "QX4LpiTZmUH" ) ); assertTrue( CodeGenerator.isValidUid( "rT1hdSWjfDC" ) ); assertFalse( CodeGenerator.isValidUid( "1T1hdSWjfDC" ) ); assertFalse( CodeGenerator.isValidUid( "QX4LpiTZmUHg" ) ); assertFalse( CodeGenerator.isValidUid( "1T1hdS_WjfD" ) ); }