test/org/ohmage/test/ParameterSets.java
private static void initUsernames() {
    // Too short.
    invalidUsernames.add("123");
    // Too long.
    invalidUsernames.add("12345678901234567890123456");
    // Contains valid characters, but none of the required ones.
    invalidUsernames.add("....");

    // Check the minimum length.
    validUsernames.add("aaaa");
    // Check the maximum length.
    validUsernames.add("aaaaaaaaaaaaaaaaaaaaaaaaa");
    // Check all of the valid characters.
    validUsernames.add("abcdefghijklmnopqrstuvwxy");
    validUsernames.add("z0123456789._@+-");
    // Check that the username may begin with a valid, but not required
    // character.
    validUsernames.add("_Bob");

    System.out.println("Valid usernames generated:");
    for (String validUsername : validUsernames) {
      System.out.println("\t" + validUsername);
    }
    System.out.println();

    System.out.println("Invalid usernames generated:");
    for (String invalidUsername : invalidUsernames) {
      System.out.println("\t" + invalidUsername);
    }
    System.out.println();

    // Create the username lists.
    initUsernameLists();

    // Create the username-role lists.
    initUsernameRoleLists();
  }
/**
   * Populates the valid and invalid username lists.
   */
Populates the valid and invalid username lists.
Populates the valid and invalid username lists .
private static void initUsernames() {
    invalidUsernames.add("123");
    invalidUsernames.add("12345678901234567890123456");
    invalidUsernames.add("....");
    validUsernames.add("aaaa");
    validUsernames.add("aaaaaaaaaaaaaaaaaaaaaaaaa");
    validUsernames.add("abcdefghijklmnopqrstuvwxy");
    validUsernames.add("z0123456789._@+-");
    validUsernames.add("_Bob");
    System.out.println("Valid usernames generated:");
    for (String validUsername : validUsernames) {
      System.out.println("\t" + validUsername);
    }
    System.out.println();
    System.out.println("Invalid usernames generated:");
    for (String invalidUsername : invalidUsernames) {
      System.out.println("\t" + invalidUsername);
    }
    System.out.println();
    initUsernameLists();
    initUsernameRoleLists();
  }
private static void initUsernames ( ) { invalidUsernames . add ( "123" ) ; invalidUsernames . add ( "12345678901234567890123456" ) ; invalidUsernames . add ( "...." ) ; validUsernames . add ( "aaaa" ) ; validUsernames . add ( "aaaaaaaaaaaaaaaaaaaaaaaaa" ) ; validUsernames . add ( "abcdefghijklmnopqrstuvwxy" ) ; validUsernames . add ( "z0123456789._@+-" ) ; validUsernames . add ( "_Bob" ) ; System . out . println ( "Valid usernames generated:" ) ; for ( String validUsername : validUsernames ) { System . out . println ( "\t" + validUsername ) ; } System . out . println ( ) ; System . out . println ( "Invalid usernames generated:" ) ; for ( String invalidUsername : invalidUsernames ) { System . out . println ( "\t" + invalidUsername ) ; } System . out . println ( ) ; initUsernameLists ( ) ; initUsernameRoleLists ( ) ; }
Populates the valid and invalid username lists.
Populates the valid and invalid username lists .
// Too short. // Too long. // Contains valid characters, but none of the required ones. // Check the minimum length. // Check the maximum length. // Check all of the valid characters. // Check that the username may begin with a valid, but not required // character. // Create the username lists. // Create the username-role lists.