Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/challenges/FundamentalsPractice.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static boolean stringsAreSame(String a, String b) {
// If strings are equal, return true. Else, return false
// Hint: use .equals() to compare strings not ==
// Do not care about capitals HI is equal to hi look up how to do.
return null;
return false;
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method implementation returns a hardcoded false value, which doesn't implement the expected string comparison logic described in the comments. Based on the comments, this should compare strings ignoring case using .equals() method.

Suggested change
return false;
return a.equalsIgnoreCase(b);

Copilot uses AI. Check for mistakes.
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/challenges/PasswordChecker.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package challenges;
import java.util.Scanner;

/*
Expand All @@ -22,7 +23,7 @@
*/


public class PasswordStrengthChecker {
public class PasswordChecker {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

Expand Down
22 changes: 11 additions & 11 deletions src/test/java/challenges/PasswordCheckerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,41 @@ public class PasswordCheckerTest {

@Test
public void testWeakPasswordShort() {
assertEquals("Weak", PasswordStrengthChecker.checkPasswordStrength("abc"));
assertEquals("Weak", PasswordChecker.checkPasswordStrength("abc"));
}

@Test
public void testWeakPasswordMissingTypes() {
// Only lowercase, length >= 8
assertEquals("Weak", PasswordStrengthChecker.checkPasswordStrength("abcdefgh"));
assertEquals("Weak", PasswordChecker.checkPasswordStrength("abcdefgh"));
// Only digits, length >= 8
assertEquals("Weak", PasswordStrengthChecker.checkPasswordStrength("12345678"));
assertEquals("Weak", PasswordChecker.checkPasswordStrength("12345678"));
}

@Test
public void testModeratePassword() {
// Missing symbol
assertEquals("Moderate", PasswordStrengthChecker.checkPasswordStrength("Abcdefg1"));
assertEquals("Moderate", PasswordChecker.checkPasswordStrength("Abcdefg1"));
// Missing digit
assertEquals("Moderate", PasswordStrengthChecker.checkPasswordStrength("Abcdefg!"));
assertEquals("Moderate", PasswordChecker.checkPasswordStrength("Abcdefg!"));
// Missing uppercase
assertEquals("Moderate", PasswordStrengthChecker.checkPasswordStrength("abcdef1!"));
assertEquals("Moderate", PasswordChecker.checkPasswordStrength("abcdef1!"));
// Missing lowercase
assertEquals("Moderate", PasswordStrengthChecker.checkPasswordStrength("ABCDEF1!"));
assertEquals("Moderate", PasswordChecker.checkPasswordStrength("ABCDEF1!"));
}

@Test
public void testStrongPassword() {
assertEquals("Strong", PasswordStrengthChecker.checkPasswordStrength("Abcdef1!"));
assertEquals("Strong", PasswordStrengthChecker.checkPasswordStrength("A1b2c3d4!"));
assertEquals("Strong", PasswordChecker.checkPasswordStrength("Abcdef1!"));
assertEquals("Strong", PasswordChecker.checkPasswordStrength("A1b2c3d4!"));
}

@Test
public void testEdgeCases() {
// Exactly 8 chars, all types
assertEquals("Strong", PasswordStrengthChecker.checkPasswordStrength("A1b2c3!d"));
assertEquals("Strong", PasswordChecker.checkPasswordStrength("A1b2c3!d"));
// 8 chars, missing 2 types
assertEquals("Weak", PasswordStrengthChecker.checkPasswordStrength("Abcdefgh"));
assertEquals("Weak", PasswordChecker.checkPasswordStrength("Abcdefgh"));
}

}
Loading