![Known Vulnerabilities](https://camo.githubusercontent.com/ffd8993c1f9c1ddf55c2a41035d66ffa2fea89138f4b8bca7517735b0c32a49b/68747470733a2f2f736e796b2e696f2f746573742f6769746875622f66616261736f61642f706f6a6f2f62616467652e737667)
- Add GitHub Packages
maven server to
pom.xml
- Import
pojo
dependency.
<dependency>
<groupId>io.fabasoad</groupId>
<artifactId>pojo</artifactId>
<version>0.2.1</version>
</dependency>
public class PojoTest {
// The package to test
private static final String PACKAGE_NAME = "io.fabasoad.pojo";
@Test
public void testPojoStructureAndBehavior() {
final PojoValidator validator = PojoValidatorBuilder.create(PACKAGE_NAME)
.with(new GettersTester(new GettersMustExistRule()))
.with(new FieldsTester(
new FieldsMustBeFinalRule(),
new FieldsMustBePrivateRule()))
.build();
validator.validate();
}
}
class PojoSpec extends Specification {
// The package to test
def PACKAGE_NAME = "io.fabasoad.pojo";
def "Getters and fields must follow the rules"() {
given:
def builder = PojoValidatorBuilder.create(PACKAGE_NAME)
when:
def validator = builder
.with(new GettersTester(new GettersMustExistRule()))
.with(new FieldsTester(
new FieldsMustBeFinalRule(),
new FieldsMustBePrivateRule()))
.build()
then:
validator.validate()
}
}