This project is a Java Maven application that validates passwords according to a defined password policy. The project was developed using Test-Driven Development (TDD) with JUnit 5 and is automatically tested using GitHub Actions.
A valid password must:
- Be at least 8 characters long.
- Contain at least one digit (0-9).
- Contain at least one uppercase letter.
- Contain at least one lowercase letter.
- Not be a common password.
Allowed special characters:
!@#$%^&*()-_+=?.,;:
- Minimum length validation
- Digit validation
- Uppercase and lowercase validation
- Common password detection
- Contain at least one allowed special character.
- Overall password validation (isValid)
- Java 25
- Maven
- JUnit 5
- Git
- GitHub
- GitHub Actions
src
├── main
│ └── PasswordValidator.java
└── test
└── PasswordValidatorTest.java
Run all tests:
mvn clean verifyCreate the JAR file:
mvn packageGitHub Actions automatically builds and tests the project on every push and pull request to the main branch.
boolean valid = PasswordValidator.isValid("Password1!");
System.out.println(valid);Output:
true
The project was implemented using the Red-Green-Refactor cycle:
- Write a failing test.
- Implement the minimum code.
- Refactor while keeping all tests green.
Mohammad Aziz