com.openpojo.validation.rule.impl.NoStaticExceptFinalRule Java Examples
The following examples show how to use
com.openpojo.validation.rule.impl.NoStaticExceptFinalRule.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestEntityTest.java From openpojo with Apache License 2.0 | 6 votes |
@Before public void setup() { pojoClasses = PojoClassFactory.getPojoClasses(POJO_PACKAGE); ValidatorBuilder validatorBuilder = ValidatorBuilder.create(); // Create Rules to validate structure for POJO_PACKAGE validatorBuilder.with(new NoPublicFieldsRule()); validatorBuilder.with(new NoPrimitivesRule()); validatorBuilder.with(new NoStaticExceptFinalRule()); validatorBuilder.with(new GetterMustExistRule()); validatorBuilder.with(new NoNestedClassRule()); validatorBuilder.with(new BusinessKeyMustExistRule()); // Create Testers to validate behavior for POJO_PACKAGE validatorBuilder.with(new SetterTester()); validatorBuilder.with(new GetterTester()); validatorBuilder.with(new BusinessIdentityTester()); pojoValidator = validatorBuilder.build(); }
Example #2
Source File: BeanTest.java From openpojo with Apache License 2.0 | 6 votes |
@Before public void setup() { LogHelper.initializeLoggers(); PojoClassFilter pojoClassFilter = new FilterChain(new FilterEnum(), new FilterPackageInfo()); pojoClasses = PojoClassFactory.getPojoClassesRecursively(this.getClass().getPackage().getName() + ".sampleclasses", pojoClassFilter); ValidatorBuilder validatorBuilder = ValidatorBuilder.create(); // Create Rules to validate structure for POJO_PACKAGE validatorBuilder.with(new NoPublicFieldsRule()); validatorBuilder.with(new NoStaticExceptFinalRule()); validatorBuilder.with(new GetterMustExistRule()); validatorBuilder.with(new SetterMustExistRule()); // Create Testers to validate behaviour for POJO_PACKAGE validatorBuilder.with(new DefaultValuesNullTester()); validatorBuilder.with(new SetterTester()); validatorBuilder.with(new GetterTester()); pojoValidator = validatorBuilder.build(); }
Example #3
Source File: DomainTest.java From cloudbreak with Apache License 2.0 | 6 votes |
@Test void testPojoStructureAndBehavior() { List<PojoClass> pojoClasses = new ArrayList<>(); pojoClasses.add(PojoClassFactory.getPojoClass(Region.class)); pojoClasses.add(PojoClassFactory.getPojoClass(CompactView.class)); pojoClasses.add(PojoClassFactory.getPojoClass(EnvironmentAuthentication.class)); Validator validator = ValidatorBuilder.create() .with(new SetterMustExistRule(), new GetterMustExistRule()) .with(new GetterTester()) .with(new NoPublicFieldsExceptStaticFinalRule()) .with(new NoStaticExceptFinalRule()) .with(new NoNestedClassRule()) .with(new NoFieldShadowingRule()) .build(); validator.validate(pojoClasses); validator = ValidatorBuilder.create() .with(new SetterTester()) .build(); validator.validate(pojoClasses); // openpojo will do for now (seems buggy) but later would worth experimenting with pojo-tester (https://www.pojo.pl/) }
Example #4
Source File: ModelTest.java From cloudbreak with Apache License 2.0 | 6 votes |
@Test public void testPojoStructureAndBehavior() { List<PojoClass> pojoClasses = PojoClassFactory.getPojoClassesRecursively(MODEL_PACKAGE, BASE_CLASS_FILTER); Validator validator = ValidatorBuilder.create() .with(new SetterMustExistRule(), new GetterMustExistRule()) .with(new GetterTester()) .with(new NoPublicFieldsExceptStaticFinalRule()) .with(new NoStaticExceptFinalRule()) .with(new NoNestedClassRule()) .with(new NoFieldShadowingRule()) .build(); validator.validate(pojoClasses); validator = ValidatorBuilder.create() .with(new SetterTester()) .build(); validator.validate(pojoClasses); // openpojo will do for now (seems buggy) but later would worth experimenting with pojo-tester (https://www.pojo.pl/) }
Example #5
Source File: PojoTest.java From taskana with Apache License 2.0 | 5 votes |
@TestFactory Collection<DynamicTest> validateNoStaticExceptFinalFields() { return getPojoClasses() .map( cl -> DynamicTest.dynamicTest( "Check static fields for " + cl.getSimpleName(), () -> validateWithRules(cl, new NoStaticExceptFinalRule()))) .collect(Collectors.toList()); }
Example #6
Source File: ModelTest.java From cloudbreak with Apache License 2.0 | 5 votes |
@Test public void testPojoStructureAndBehavior() { List<PojoClass> pojoClasses = PojoClassFactory.getPojoClassesRecursively(DOMAIN_PACKAGE, POJO_CLASS_FILTER); Validator validator = ValidatorBuilder.create() .with(new SetterMustExistRule(), new GetterMustExistRule()) .with(new SetterTester(), new GetterTester()) .with(new NoStaticExceptFinalRule()) .with(new NoNestedClassRule()) .build(); validator.validate(pojoClasses); }
Example #7
Source File: ModelTest.java From cloudbreak with Apache License 2.0 | 5 votes |
@Test public void testImmutableStructureAndBehavior() { List<PojoClass> pojoClasses = PojoClassFactory.getPojoClassesRecursively(DOMAIN_PACKAGE, IMMUTABLE_CLASS_FILTER); Validator validator = ValidatorBuilder.create() .with(new GetterMustExistRule()) .with(new GetterTester()) .with(new NoStaticExceptFinalRule()) .with(new NoNestedClassRule()) .build(); validator.validate(pojoClasses); }
Example #8
Source File: ModelTest.java From cloudbreak with Apache License 2.0 | 5 votes |
@Test public void testGetterTypeChangerPojoStructureAndBehavior() { List<PojoClass> pojoClasses = PojoClassFactory.getPojoClassesRecursively(DOMAIN_PACKAGE, GETTER_TYPE_CHANGER_CLASS_FILTER); Validator validator = ValidatorBuilder.create() .with(new SetterMustExistRule()) .with(new SetterTester(), new GetterTester()) .with(new NoStaticExceptFinalRule()) .with(new NoNestedClassRule()) .build(); validator.validate(pojoClasses); }
Example #9
Source File: ModelTest.java From cloudbreak with Apache License 2.0 | 5 votes |
@Test public void testSetterTypeChangerPojoStructureAndBehavior() { List<PojoClass> pojoClasses = PojoClassFactory.getPojoClassesRecursively(DOMAIN_PACKAGE, SETTER_TYPE_CHANGER_CLASS_FILTER); Validator validator = ValidatorBuilder.create() .with(new GetterMustExistRule()) .with(new SetterTester(), new GetterTester()) .with(new NoStaticExceptFinalRule()) .with(new NoNestedClassRule()) .build(); validator.validate(pojoClasses); }
Example #10
Source File: ModelTest.java From cloudbreak with Apache License 2.0 | 5 votes |
@Test public void testPojoStructureAndBehavior() { Validator validator = ValidatorBuilder.create() .with(new SetterMustExistRule(), new GetterMustExistRule()) .with(new SetterTester(), new GetterTester()) .with(new NoStaticExceptFinalRule()) .with(new NoNestedClassRule()) .build(); validator.validate(DOMAIN_PACKAGE, new FilterPackageInfo()); }