https://github.com/joutvhu/model-tester
Model Tester is a utility for automatically testing model classes.
https://github.com/joutvhu/model-tester
model model-testing tester
Last synced: 2 months ago
JSON representation
Model Tester is a utility for automatically testing model classes.
- Host: GitHub
- URL: https://github.com/joutvhu/model-tester
- Owner: joutvhu
- License: mit
- Created: 2023-03-13T08:00:17.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-28T07:00:38.000Z (over 1 year ago)
- Last Synced: 2025-01-02T04:28:45.029Z (4 months ago)
- Topics: model, model-testing, tester
- Language: Java
- Homepage:
- Size: 125 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Model Tester
Model Tester is a utility for automatically testing model classes.
## Installation
- If you are using Gradle just add the following dependency to your `build.gradle`.
```groovy
testImplementation "com.github.joutvhu:model-tester:1.0.5"
```- Or add the following dependency to your `pom.xml` if you are using Maven.
```xml
com.github.joutvhu
model-tester
1.0.5
test```
## How to use?
- Provide model class to be used for testing.
- Set up test options.
- Use method `test()` or `testAndThrows()` to execute the tester.```java
public class UserTest {
@Test
public void test_all() {
Assertions.assertTrue(ModelTester.allOf(User.class).test());
}@Test
public void test_and_throws() {
ModelTester.allOf(User.class).testAndThrows();
}@Test
public void test_safe() {
ModelTester.safeOf(User.class).testAndThrows();
}@Test
public void test_custom() {
ModelTester.of(User.class)
.constructors()
.exclude("getId", "setId")
.equalsMethod()
.hashCodeMethod()
.toStringMethod()
.testAndThrows();
}
}
```