当前位置: 首页>>代码示例>>Java>>正文


Java PojoValidator.runValidation方法代码示例

本文整理汇总了Java中com.openpojo.validation.PojoValidator.runValidation方法的典型用法代码示例。如果您正苦于以下问题:Java PojoValidator.runValidation方法的具体用法?Java PojoValidator.runValidation怎么用?Java PojoValidator.runValidation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.openpojo.validation.PojoValidator的用法示例。


在下文中一共展示了PojoValidator.runValidation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testPojoStructureAndBehavior

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
/**
 * Unit Test the POJO classes.
 *
 * @throws ClassNotFoundException
 *             the class not found exception
 * @throws InstantiationException
 *             the instantiation exception
 * @throws IllegalAccessException
 *             the illegal access exception
 */

@Test
public void testPojoStructureAndBehavior() throws ClassNotFoundException,
        InstantiationException, IllegalAccessException {
    final PojoValidator pojoValidator = new PojoValidator();
    for (final Class<? extends Rule> ruleClass : getValidationRules()) {
        final Rule rule = ruleClass.newInstance();
        pojoValidator.addRule(rule);
    }

    // Load tester classes
    for (Class<? extends Tester> testerClass : getTesters()) {
        final Tester testerInstance = testerClass.newInstance();
        pojoValidator.addTester(testerInstance);
    }

    for (final Class<?> c : getPOJOClasses()) {
        final PojoClass pojoClass = PojoClassFactory.getPojoClass(c);

        pojoValidator.runValidation(pojoClass);
    }
}
 
开发者ID:eBay,项目名称:parallec,代码行数:33,代码来源:ParallecPojoClassTest.java

示例2: testPojoStructureAndBehavior

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
@Test
@Category(UnitTest.class)
@SuppressWarnings("unchecked")
public void testPojoStructureAndBehavior() {
    if (this.getClass() == PojoTest.class) {
        return;
    }
    Class<T> typeParameterClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
    
    PojoValidator pojoValidator = new PojoValidator();

    // Create Rules to validate structure for POJO_PACKAGE
    pojoValidator.addRule(new NoPublicFieldsRule());
    pojoValidator.addRule(new NoPrimitivesRule());
    pojoValidator.addRule(new NoStaticExceptFinalRule());
    pojoValidator.addRule(new GetterMustExistRule());
    pojoValidator.addRule(new SetterMustExistRule());
    pojoValidator.addRule(new NoNestedClassRule());

    // Create Testers to validate behaviour for POJO_PACKAGE
    pojoValidator.addTester(new SetterTester());
    pojoValidator.addTester(new GetterTester());
    
    PojoClass pojoClass = PojoClassFactory.getPojoClass(typeParameterClass);
    pojoValidator.runValidation(pojoClass);
}
 
开发者ID:Livefyre,项目名称:livefyre-java-utils,代码行数:27,代码来源:PojoTest.java

示例3: testPojo

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
@Test
public void testPojo() {
	PojoValidator pojoValidator = new PojoValidator();

	// Create Rules to validate structure for POJO_PACKAGE
	pojoValidator.addRule(new NoPublicFieldsRule());
	pojoValidator.addRule(new NoPrimitivesRule());
	pojoValidator.addRule(new NoStaticExceptFinalRule());
	pojoValidator.addRule(new GetterMustExistRule());
	pojoValidator.addRule(new SetterMustExistRule());
	pojoValidator.addRule(new NoNestedClassRule());
	pojoValidator.addRule(new NoPublicFieldsExceptStaticFinalRule());
	pojoValidator.addRule(new NoStaticExceptFinalRule());
	pojoValidator.addRule(new SerializableMustHaveSerialVersionUIDRule());

	// Create Testers to validate behaviour for POJO_PACKAGE
	pojoValidator.addTester(new SetterTester());
	pojoValidator.addTester(new GetterTester());
	PojoClass pojoClass = PojoClassFactory.getPojoClass(getPojoClass());
	pojoValidator.runValidation(pojoClass);
}
 
开发者ID:aracrown,项目名称:ara-commons,代码行数:22,代码来源:AbstractSinglePojoClassTest.java

示例4: testPojoStructureAndBehavior

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
@Test
public final void testPojoStructureAndBehavior() {

    final PojoClass pc = PojoClassFactory.getPojoClass(ParserConfig.class);
    final PojoValidator pv = createPojoValidator();
    pv.runValidation(pc);

}
 
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:9,代码来源:ParserConfigTest.java

示例5: testPojoStructureAndBehavior

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
@Test
public final void testPojoStructureAndBehavior() {

    final PojoClass pc = PojoClassFactory.getPojoClass(Project.class);
    final PojoValidator pv = createPojoValidator();
    pv.runValidation(pc);

}
 
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:9,代码来源:ProjectTest.java

示例6: testPojoStructureAndBehavior

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
@Test
public final void testPojoStructureAndBehavior() {

    final PojoClass pc = PojoClassFactory.getPojoClass(Folder.class);
    final PojoValidator pv = createPojoValidator();
    pv.runValidation(pc);

}
 
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:9,代码来源:FolderTest.java

示例7: testPojoStructureAndBehavior

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
@Test
public final void testPojoStructureAndBehavior() {

    final PojoClass pc = PojoClassFactory
            .getPojoClass(GeneratedArtifact.class);
    final PojoValidator pv = createPojoValidator();
    pv.addRule(new SetterMustExistRule());
    pv.runValidation(pc);

}
 
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:11,代码来源:GeneratedArtifactTest.java

示例8: testStructureAndBehaviour

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
@Test
public void testStructureAndBehaviour() {

    final PojoClass pc = PojoClassFactory.getPojoClass(JaxbHelper.class);
    final PojoValidator pv = createPojoValidator();
    pv.addRule(new SetterMustExistRule());
    pv.runValidation(pc);

}
 
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:10,代码来源:JaxbHelperTest.java

示例9: testPojoStructureAndBehavior

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
@Test
public final void testPojoStructureAndBehavior() {

    final PojoClass pc = PojoClassFactory.getPojoClass(Generators.class);
    final PojoValidator pv = createPojoValidator();
    pv.runValidation(pc);

}
 
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:9,代码来源:GeneratorsTest.java

示例10: testPojoStructureAndBehavior

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
@Test
public final void testPojoStructureAndBehavior() {

    final PojoClass pc = PojoClassFactory.getPojoClass(Parsers.class);
    final PojoValidator pv = createPojoValidator();
    pv.runValidation(pc);

}
 
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:9,代码来源:ParsersTest.java

示例11: testPojoStructureAndBehavior

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
@Test
public final void testPojoStructureAndBehavior() {

    final PojoClass pc = PojoClassFactory.getPojoClass(Classpath.class);
    final PojoValidator pv = createPojoValidator();
    pv.runValidation(pc);

}
 
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:9,代码来源:ClasspathTest.java

示例12: testPojoStructureAndBehavior

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
@Test
public final void testPojoStructureAndBehavior() {

    final PojoClass pc = PojoClassFactory
            .getPojoClass(BinClasspathEntry.class);
    final PojoValidator pv = createPojoValidator();
    pv.runValidation(pc);

}
 
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:10,代码来源:BinClasspathEntryTest.java

示例13: testPojoStructureAndBehavior

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
@Test
public final void testPojoStructureAndBehavior() {

    final PojoClass pc = PojoClassFactory
            .getPojoClass(GeneratorConfig.class);
    final PojoValidator pv = createPojoValidator();
    pv.runValidation(pc);

}
 
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:10,代码来源:GeneratorConfigTest.java

示例14: testPojoStructureAndBehavior

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
@Test
public final void testPojoStructureAndBehavior() {

    final PojoClass pc = PojoClassFactory.getPojoClass(Config.class);
    final PojoValidator pv = createPojoValidator();
    pv.addRule(new SetterMustExistRule());
    pv.runValidation(pc);

}
 
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:10,代码来源:ConfigTest.java

示例15: testPojoStructureAndBehavior

import com.openpojo.validation.PojoValidator; //导入方法依赖的package包/类
/**
 * Basic POJO test.
 */
@Test
public final void testPojoStructureAndBehavior() {

    final PojoClass pc = PojoClassFactory.getPojoClass(Artifact.class);
    final PojoValidator pv = createPojoValidator();
    pv.runValidation(pc);

}
 
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:12,代码来源:ArtifactTest.java


注:本文中的com.openpojo.validation.PojoValidator.runValidation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。