Question: Question 1 : Consider the attached code for the PasswordChecker class to ensure the isStrongPassword and isSpecialcharacter methods are correctly implemented. | public class PasswordChecker

Question 1:
Consider the attached code for the PasswordChecker class to ensure the isStrongPassword and isSpecialcharacter methods are correctly implemented.|
public class PasswordChecker {
public boolean isstrongPassword(String password){
boolean hasUpperCase = false;
boolean hasLowerCase = false;
boolean hasDigit = false;
boolean hasSpecialchar = false;
for (char ch : password.toCharArray()){
if (Character.isUpperCase(ch)){
hasUpperCase = true;
} else if (Character.isLowerCase(ch)){
hasLowerCase = true;
} else if (Character.isDigit(ch)){
hasDigit = true;
} else if (isSpecialCharacter(ch)){
hasSpecialchar = true;
}
}
return password. length()8&& hasUpperCase && hasLowerCase && hasDigit &&
hasSpecialChar;
}
private boolean isSpecialcharacter(char ch){
return ICharacter.isLetterOrDigit(ch);
}
}
In this lab assignment, you are asked to create JUnit test cases for the isStrongPassword method in the PasswordChecker class. Test the method with different inputs, including valid and invalid passwords. Include cases for common password requirements such as length, presence of uppercase letters, lowercase letters, digits, and special characters.
Run the test cases and include a printout of the JUnit results.
Submit the JUnit Java code.
 Question 1: Consider the attached code for the PasswordChecker class to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!