Skip to content

Commit

Permalink
isNotCommonlyUsed method fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlo-bystrytskyi committed Sep 3, 2024
1 parent 89368d1 commit 37265b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/example/PasswordValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class PasswordValidator {
static int MINIMUM_PASSWORD_LENGTH = 8;
private static String[] COMMONLY_USED = {"Password1!", "Aa345678"};
private static final String[] COMMONLY_USED = {"Password1!", "Aa345678"};

public static boolean isValid(String password) {
return isLengthCorrect(password)
Expand All @@ -25,8 +25,8 @@ public static boolean containsUppercaseLowercase(String password) {
}

public static boolean isNotCommonlyUsed(String password) {
for (String commonlyUsed : COMMONLY_USED) {
if (commonlyUsed.contains(password)) {
for (String commonlyUsedPassword : COMMONLY_USED) {
if (commonlyUsedPassword.equals(password)) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/example/PasswordGeneratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

class PasswordGeneratorTest {
private static int GENERATIONS_NUMBER = 50;
private static final int GENERATIONS_NUMBER = 50;

@Test
void generatePassword() {
Expand Down

0 comments on commit 37265b9

Please sign in to comment.