com.openpojo.reflection.filters.FilterPackageInfo Java Examples

The following examples show how to use com.openpojo.reflection.filters.FilterPackageInfo. 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: BeanTest.java    From openpojo with Apache License 2.0 6 votes vote down vote up
@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 #2
Source File: PojoPackageTestBase.java    From spring-batch-lightmin with Apache License 2.0 5 votes vote down vote up
@Test
public void ensureExpectedPojoCount() {
    if (this.withExpectedCount) {
        final List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses(this.pojoPackage,
                new FilterPackageInfo());
        Affirm.affirmEquals("Classes added / removed?", this.expectedClassCount, pojoClasses.size());
    } else {
        log.debug("WithExpectedCount is disbabled");
    }
}
 
Example #3
Source File: ModelTest.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example #4
Source File: AbstractUnitTest.java    From cia with Apache License 2.0 4 votes vote down vote up
public boolean include(final PojoClass pojoClass) {
	return !(pojoClass.getSourcePath().contains("/test-classes/")
			|| pojoClass.getClazz().getName().contains("_") || pojoClass.isEnum() || pojoClass.isAbstract())
			&& FilterPackageInfo.include(pojoClass);
}
 
Example #5
Source File: AbstractUnitTest.java    From cia with Apache License 2.0 4 votes vote down vote up
public boolean include(final PojoClass pojoClass) {
	return pojoClass.isEnum() && FilterPackageInfo.include(pojoClass);
}
 
Example #6
Source File: ModelTest.java    From cloudbreak with Apache License 2.0 4 votes vote down vote up
@Test
public void ensureExpectedPojoCount() {
    List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses(DOMAIN_PACKAGE, new FilterPackageInfo());
    Affirm.affirmEquals("Classes added / removed?", EXPECTED_CLASS_COUNT, pojoClasses.size());
}