https://github.com/randjelaa/junit-calculator
This project involves creating a Calculator and CalculatorAdvanced class in Java with full unit testing using JUnit5. Tests must be parameterized, use Hamcrest matchers, and cover all code paths to achieve 100% coverage.
https://github.com/randjelaa/junit-calculator
hamcrest java junit unit-testing
Last synced: 12 months ago
JSON representation
This project involves creating a Calculator and CalculatorAdvanced class in Java with full unit testing using JUnit5. Tests must be parameterized, use Hamcrest matchers, and cover all code paths to achieve 100% coverage.
- Host: GitHub
- URL: https://github.com/randjelaa/junit-calculator
- Owner: randjelaa
- Created: 2025-07-01T17:23:51.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-01T17:27:42.000Z (about 1 year ago)
- Last Synced: 2025-07-01T18:29:41.165Z (about 1 year ago)
- Topics: hamcrest, java, junit, unit-testing
- Language: HTML
- Homepage:
- Size: 213 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JUnit Calculator Project
## Project Summary
This project requires implementing a `Calculator` class and an extended `CalculatorAdvanced` class in Java, accompanied by comprehensive unit testing using JUnit5.
## Testing Requirements
* **Unit Tests:** Write JUnit5 tests for all implemented methods and constructors.
* **Parameterized Tests:** Wherever possible, tests must be parameterized to cover multiple input scenarios efficiently.
* **Test Coverage:** Achieve 100% code coverage, ensuring every method and branch is tested.
* **Hamcrest Matchers:** Use Hamcrest for expressive and readable assertions.
* **Mutational Testing:** After running mutation testing, address any identified weaknesses or missing test cases.
* **Test Organization:** Place all test classes in a dedicated test folder within the project structure.
* **Exception Testing:** Thoroughly test all custom exceptions, including:
* `DivisionByZeroException`
* `NotSupportedOperationException`
* `NumberNotInAreaException`
* **Edge Cases:** Include boundary and edge cases, such as:
* Division by zero
* Invalid operators or actions
* Factorial inputs outside allowed range
* Armstrong and perfect number validations for valid and invalid inputs