test_class.file: utils/src/test/java/com/cloud/utils/PasswordGeneratorTest.java
test_class.identifier: PasswordGeneratorTest
test_case.body: @Test
      public void generateRandomPassword() {
          // actual length is requested length, minimum length is 3
          Assert.assertTrue(PasswordGenerator.generateRandomPassword(0).length() == 3);
          Assert.assertTrue(PasswordGenerator.generateRandomPassword(1).length() == 3);
          Assert.assertTrue(PasswordGenerator.generateRandomPassword(5).length() == 5);
          String password = PasswordGenerator.generateRandomPassword(8);
  
          Assert.assertTrue(containsDigit(password));
          Assert.assertTrue(containsLowercase(password));
          Assert.assertTrue(containsUppercase(password));
      }
test_case.class_method_signature: PasswordGeneratorTest.generateRandomPassword()
test_case.full_signature: @Test public void generateRandomPassword()
test_case.identifier: generateRandomPassword
test_case.invocations: assertTrue length generateRandomPassword assertTrue length generateRandomPassword assertTrue length generateRandomPassword generateRandomPassword assertTrue containsDigit assertTrue containsLowercase assertTrue containsUppercase
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void generateRandomPassword()
focal_class.declarator: lowerCase = new char[] {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}
focal_class.modifier: static private
focal_class.original_string: static private char[] lowerCase = new char[] {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
focal_class.type: char[]
focal_class.var_name: lowerCase
focal_class.declarator: upperCase = new char[] {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}
focal_class.modifier: static private
focal_class.original_string: static private char[] upperCase = new char[] {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
focal_class.type: char[]
focal_class.var_name: upperCase
focal_class.declarator: numeric = new char[] {'2', '3', '4', '5', '6', '7', '8', '9'}
focal_class.modifier: static private
focal_class.original_string: static private char[] numeric = new char[] {'2', '3', '4', '5', '6', '7', '8', '9'};
focal_class.type: char[]
focal_class.var_name: numeric
focal_class.declarator: alphaNumeric = new char[] {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
          'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '2', '3', '4', '5', '6', '7', '8', '9'}
focal_class.modifier: static private
focal_class.original_string: static private char[] alphaNumeric = new char[] {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
          'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '2', '3', '4', '5', '6', '7', '8', '9'};
focal_class.type: char[]
focal_class.var_name: alphaNumeric
focal_class.declarator: minLength = 3
focal_class.modifier: static private
focal_class.original_string: static private int minLength = 3;
focal_class.type: int
focal_class.var_name: minLength
focal_class.file: utils/src/main/java/com/cloud/utils/PasswordGenerator.java
focal_class.identifier: PasswordGenerator
focal_class.class_method_signature: PasswordGenerator.generateRandomPassword(int num)
focal_class.full_signature: public static String generateRandomPassword(int num)
focal_class.identifier: generateRandomPassword
focal_class.modifiers: public static
focal_class.parameters: (int num)
focal_class.return: String
focal_class.signature: String generateRandomPassword(int num)
focal_class.class_method_signature: PasswordGenerator.generateLowercaseChar(Random r)
focal_class.full_signature: private static char generateLowercaseChar(Random r)
focal_class.identifier: generateLowercaseChar
focal_class.modifiers: private static
focal_class.parameters: (Random r)
focal_class.return: char
focal_class.signature: char generateLowercaseChar(Random r)
focal_class.class_method_signature: PasswordGenerator.generateDigit(Random r)
focal_class.full_signature: private static char generateDigit(Random r)
focal_class.identifier: generateDigit
focal_class.modifiers: private static
focal_class.parameters: (Random r)
focal_class.return: char
focal_class.signature: char generateDigit(Random r)
focal_class.class_method_signature: PasswordGenerator.generateUppercaseChar(Random r)
focal_class.full_signature: private static char generateUppercaseChar(Random r)
focal_class.identifier: generateUppercaseChar
focal_class.modifiers: private static
focal_class.parameters: (Random r)
focal_class.return: char
focal_class.signature: char generateUppercaseChar(Random r)
focal_class.class_method_signature: PasswordGenerator.generateAlphaNumeric(Random r)
focal_class.full_signature: private static char generateAlphaNumeric(Random r)
focal_class.identifier: generateAlphaNumeric
focal_class.modifiers: private static
focal_class.parameters: (Random r)
focal_class.return: char
focal_class.signature: char generateAlphaNumeric(Random r)
focal_class.class_method_signature: PasswordGenerator.generatePresharedKey(int numChars)
focal_class.full_signature: public static String generatePresharedKey(int numChars)
focal_class.identifier: generatePresharedKey
focal_class.modifiers: public static
focal_class.parameters: (int numChars)
focal_class.return: String
focal_class.signature: String generatePresharedKey(int numChars)
focal_method.body: public static String generateRandomPassword(int num) {
          Random r = new SecureRandom();
          StringBuilder password = new StringBuilder();
  
          //Guard for num < minLength
          if (num < minLength) {
              //Add alphanumeric chars at random
              for (int i = 0; i < minLength; i++) {
                  password.append(generateAlphaNumeric(r));
              }
          } else {
              List<Character> passwordChars = new ArrayList<Character>();
              passwordChars.add(generateLowercaseChar(r));
              passwordChars.add(generateUppercaseChar(r));
              passwordChars.add(generateDigit(r));
  
              for (int i = passwordChars.size(); i < num; i++) {
                  passwordChars.add(generateAlphaNumeric(r));
              }
  
              Collections.shuffle(passwordChars, new SecureRandom());
  
              for (char c : passwordChars) {
                  password.append(c);
              }
          }
  
          return password.toString();
      }
focal_method.class_method_signature: PasswordGenerator.generateRandomPassword(int num)
focal_method.full_signature: public static String generateRandomPassword(int num)
focal_method.identifier: generateRandomPassword
focal_method.invocations: append generateAlphaNumeric add generateLowercaseChar add generateUppercaseChar add generateDigit size add generateAlphaNumeric shuffle append toString
focal_method.modifiers: public static
focal_method.parameters: (int num)
focal_method.return: String
focal_method.signature: String generateRandomPassword(int num)