本文整理汇总了Java中com.openpojo.validation.PojoValidator类的典型用法代码示例。如果您正苦于以下问题:Java PojoValidator类的具体用法?Java PojoValidator怎么用?Java PojoValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PojoValidator类属于com.openpojo.validation包,在下文中一共展示了PojoValidator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import com.openpojo.validation.PojoValidator; //导入依赖的package包/类
@Before
public void setup() {
pojoClasses = PojoClassFactory.getPojoClassesRecursively(POJO_PACKAGE, new PojoClassFilter() {
@Override
public boolean include(PojoClass pojoClass) {
if(pojoClass.getName().contains("abstract")) {
return false;
}
if(!pojoClass.getName().contains("pocketmedia")) {
return false;
}
return true;
}
});
pojoValidator = new PojoValidator();
// Create Testers to validate behavior for POJO_PACKAGE
pojoValidator.addTester(new SetterTester());
pojoValidator.addTester(new GetterTester());
}
开发者ID:Pocketbrain,项目名称:androidnativeadslib,代码行数:25,代码来源:PojosTest.java
示例2: setup
import com.openpojo.validation.PojoValidator; //导入依赖的package包/类
@BeforeTest
public void setup() {
this.pojoClasses = PojoClassFactory.getPojoClasses(POJO_PACKAGE, new PojoClassFilter() {
@Override
public boolean include(final PojoClass pojoClass) {
System.out.println(pojoClass.getName());
return pojoClass.getName().endsWith("Style");
}
});
this.pojoValidator = new PojoValidator();
// Create Testers to validate behavior for POJO_PACKAGE
this.pojoValidator.addTester(new SetterTester());
this.pojoValidator.addTester(new GetterTester());
}
开发者ID:eFaps,项目名称:Data-Exporter,代码行数:18,代码来源:TestPojos.java
示例3: 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
示例4: 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
示例5: 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
示例6: init
import com.openpojo.validation.PojoValidator; //导入依赖的package包/类
@Before
public void init() {
pojoValidator = new PojoValidator();
pojoValidator.addRule(new NoPublicFieldsRule());
pojoValidator.addRule(new NoStaticExceptFinalRule());
pojoValidator.addRule(new NoFieldShadowingRule());
pojoValidator.addRule(new GetterMustExistRule());
pojoValidator.addRule(new SetterMustExistRule());
pojoValidator.addTester(new SetterTester());
pojoValidator.addTester(new GetterTester());
pojoValidator.addTester(new Tester() {
@Override
public void run(PojoClass pojoClass) {
List<PojoMethod> list = pojoClass.getPojoConstructors();
for (PojoMethod method : list) {
Class<?>[] types = method.getParameterTypes();
int count = types.length;
Object[] values = new Object[count];
for (int i = 0; i < count; i++) {
values[i] = RandomFactory.getRandomValue(types[i]);
}
method.invoke(null, values);
}
}
});
}
开发者ID:ttwd80,项目名称:qir,代码行数:30,代码来源:AbstractPojoTest.java
示例7: 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
示例8: 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
示例9: 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
示例10: 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
示例11: 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
示例12: 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
示例13: 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
示例14: 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
示例15: 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
示例16: 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
示例17: 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
示例18: testPojo
import com.openpojo.validation.PojoValidator; //导入依赖的package包/类
@Test
public void testPojo() {
final PojoValidator pv = new PojoValidator();
pv.addRule(new NoPublicFieldsRule());
pv.addRule(new NoFieldShadowingRule());
pv.addRule(new GetterMustExistRule());
}
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:8,代码来源:DefaultFileMarkerTest.java
示例19: 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
示例20: testPojoStructureAndBehavior
import com.openpojo.validation.PojoValidator; //导入依赖的package包/类
@Test
public final void testPojoStructureAndBehavior() {
final PojoClass pc = PojoClassFactory.getPojoClass(Target.class);
final PojoValidator pv = new PojoValidator();
pv.addRule(new NoPublicFieldsRule());
pv.addRule(new NoFieldShadowingRule());
pv.addTester(new DefaultValuesNullTester());
pv.addTester(new SetterTester());
pv.addTester(new GetterTester());
pv.runValidation(pc);
}
开发者ID:fuinorg,项目名称:srcgen4j-commons,代码行数:18,代码来源:TargetTest.java
注:本文中的com.openpojo.validation.PojoValidator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论