本文整理汇总了Java中com.openpojo.validation.ValidatorBuilder类的典型用法代码示例。如果您正苦于以下问题:Java ValidatorBuilder类的具体用法?Java ValidatorBuilder怎么用?Java ValidatorBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ValidatorBuilder类属于com.openpojo.validation包,在下文中一共展示了ValidatorBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPojoStructureAndBehavior
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Test
public void testPojoStructureAndBehavior() {
final Validator validator = ValidatorBuilder.create()
// Add Rules to validate structure for POJO_PACKAGE
// See com.openpojo.validation.rule.impl for more ...
// .with(new GetterMustExistRule())
// .with(new SetterMustExistRule())
.with(new NoFieldShadowingRule())
// Add Testers to validate behaviour for POJO_PACKAGE
// See com.openpojo.validation.test.impl for more ...
// .with(new SetterTester())
// .with(new GetterTester())
.build();
final List<PojoClass> pojoClasses = new ArrayList<>();
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core",
new FilterClassName("\\w*PaymentRequest\\w*$")));
validator.validate(pojoClasses); }
示例2: setUp
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Before
public void setUp() {
AttributeHelper.registerFieldPrefix("_");
_validator = ValidatorBuilder.create(
).with(
new GetterMustExistRule()
).with(
new NoStaticExceptFinalRule()
).with(
new NoFieldShadowingRule()
).with(
new NoPublicFieldsRule()
).with(
new GetterTester()
).with(
new DefaultValuesNullTester()
).build();
}
示例3: test_pojo_structure_and_behavior
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Test
public void test_pojo_structure_and_behavior() {
List<Class> classes = Lists.newArrayList(
AuthData.class,
AuthMfaDevice.class,
AuthResponse.class
);
List<PojoClass> pojoClasses = classes.stream().map(PojoClassFactory::getPojoClass).collect(Collectors.toList());
Validator validator = ValidatorBuilder.create()
.with(new GetterMustExistRule())
.with(new SetterMustExistRule())
.with(new SetterTester())
.with(new GetterTester())
.build();
validator.validate(pojoClasses);
}
示例4: test_pojo_structure_and_behavior
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Test
public void test_pojo_structure_and_behavior() {
List<Class> classes = Lists.newArrayList(
CreateSessionLoginTokenRequest.class,
CreateSessionLoginTokenResponse.class,
GenerateTokenRequest.class,
GenerateTokenResponse.class,
GenerateTokenResponseData.class,
GetUserResponse.class,
MfaDevice.class,
ResponseStatus.class,
SessionLoginTokenData.class,
SessionUser.class,
UserData.class,
VerifyFactorRequest.class,
VerifyFactorResponse.class
);
List<PojoClass> pojoClasses = classes.stream().map(PojoClassFactory::getPojoClass).collect(Collectors.toList());
Validator validator = ValidatorBuilder.create()
.with(new GetterMustExistRule())
.with(new SetterMustExistRule())
.with(new SetterTester())
.with(new GetterTester())
.build();
validator.validate(pojoClasses);
}
示例5: test_pojo_structure_and_behavior
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Test
public void test_pojo_structure_and_behavior() {
List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses("com.nike.cerberus.record");
Assert.assertEquals(10, pojoClasses.size());
Validator validator = ValidatorBuilder.create()
.with(new GetterMustExistRule())
.with(new SetterMustExistRule())
.with(new SetterTester())
.with(new GetterTester())
.build();
validator.validate(pojoClasses);
}
示例6: test_pojo_structure_and_behavior
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Test
public void test_pojo_structure_and_behavior() {
List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses("com.nike.cerberus.domain");
// exclude this class because it does not need getters and setters for every constructor parameter
pojoClasses.remove(PojoClassFactory.getPojoClass(AssetResourceFile.class));
Assert.assertEquals(19, pojoClasses.size());
Validator validator = ValidatorBuilder.create()
.with(new GetterMustExistRule())
.with(new SetterMustExistRule())
.with(new SetterTester())
.with(new GetterTester())
.build();
validator.validate(pojoClasses);
}
示例7: testPojoStructureAndBehavior
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Test
public void testPojoStructureAndBehavior() {
Validator validator = ValidatorBuilder.create()
// Add Rules to validate structure for POJO_PACKAGE
// See com.openpojo.validation.rule.impl for more ...
.with(new GetterMustExistRule())
.with(new SetterMustExistRule())
// Add Testers to validate behaviour for POJO_PACKAGE
// See com.openpojo.validation.test.impl for more ...
.with(new SetterTester())
.with(new GetterTester())
// Static fields must be final
.with(new NoStaticExceptFinalRule())
// Don't shadow parent's field names.
.with(new NoFieldShadowingRule())
// What about public fields, use one of the following rules
// allow them only if they are static and final.
.with(new NoPublicFieldsExceptStaticFinalRule())
.build();
validator.validate(POJO_PACKAGE, filter);
}
示例8: testPojoStructureAndBehavior
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Test
public void testPojoStructureAndBehavior() {
Validator validator = ValidatorBuilder.create()
// Add Rules to validate structure for POJO_PACKAGE
// See com.openpojo.validation.rule.impl for more ...
.with(new GetterMustExistRule())
// Add Testers to validate behaviour for POJO_PACKAGE
// See com.openpojo.validation.test.impl for more ...
.with(new GetterTester())
.with(new DefaultValuesNullTester())
.build();
for (String pojoPackage : POJO_PACKAGE) {
LOGGER.info("Testing package: {}", pojoPackage);
validator.validate(pojoPackage, new FilterPackageInfo());
}
}
示例9: testPojoStructureAndBehavior
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Test
public void testPojoStructureAndBehavior() {
final Validator validator = ValidatorBuilder.create()
// Add Rules to validate structure for POJO_PACKAGE
// See com.openpojo.validation.rule.impl for more ...
// .with(new GetterMustExistRule())
// .with(new SetterMustExistRule())
.with(new NoFieldShadowingRule())
// Add Testers to validate behaviour for POJO_PACKAGE
// See com.openpojo.validation.test.impl for more ...
.with(new SetterTester())
.with(new GetterTester())
.build();
final List<PojoClass> pojoClasses = new ArrayList<>();
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
new FilterClassName("\\w*HttpClient\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
new FilterClassName("\\w*PaymentTrigger\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
new FilterClassName("\\w*TokenHttpClient\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
new FilterClassName("\\w*ModularPaymentMethods\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
new FilterClassName("\\w*ModuleAvailabilityUtil\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
new FilterClassName("\\w*PaymentMethodServiceFactory\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
new FilterClassName("\\w*InputFieldsServiceFactory\\w*$")));
validator.validate(pojoClasses);
}
示例10: testPojoStructureAndBehavior
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Test
public void testPojoStructureAndBehavior() {
Validator validator = ValidatorBuilder.create()
// Add Rules to validate structure for POJO_PACKAGE
// See com.openpojo.validation.rule.impl for more ...
.with(new GetterMustExistRule())
.with(new SetterMustExistRule())
// Add Testers to validate behaviour for POJO_PACKAGE
// See com.openpojo.validation.test.impl for more ...
.with(new SetterTester())
.with(new GetterTester())
.build();
validator.validate("com.adyen.core.exceptions", new FilterPackageInfo());
}
示例11: testPojoStructureAndBehavior
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Test
public void testPojoStructureAndBehavior() {
Validator validator = ValidatorBuilder.create()
// Add Rules to validate structure for POJO_PACKAGE
// See com.openpojo.validation.rule.impl for more ...
.with(new GetterMustExistRule())
.with(new SetterMustExistRule())
// Add Testers to validate behaviour for POJO_PACKAGE
// See com.openpojo.validation.test.impl for more ...
.with(new SetterTester())
.with(new GetterTester())
.build();
validator.validate("com.adyen.core.interfaces", new FilterPackageInfo());
}
示例12: testPojoStructureAndBehavior
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Test
public void testPojoStructureAndBehavior() {
Validator validator = ValidatorBuilder.create()
// Add Rules to validate structure for POJO_PACKAGE
// See com.openpojo.validation.rule.impl for more ...
// .with(new GetterMustExistRule())
// .with(new SetterMustExistRule())
// Add Testers to validate behaviour for POJO_PACKAGE
// See com.openpojo.validation.test.impl for more ...
.with(new SetterTester())
.with(new GetterTester())
.build();
final List<PojoClass> pojoClasses = new ArrayList<>();
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.utils",
new FilterClassName("\\w*AdyenRedirectHandlerActivity\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.utils",
new FilterClassName("\\w*AmountUtil\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.utils",
new FilterClassName("\\w*AsyncHttpClient\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.utils",
new FilterClassName("\\w*AsyncImageDownloader\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.utils",
new FilterClassName("\\w*PaymentResponse\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.utils",
new FilterClassName("\\w*ValidatorUtil\\w*$")));
validator.validate(pojoClasses);
}
示例13: testPojoStructureAndBehavior
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Ignore @Test
public void testPojoStructureAndBehavior() {
Validator validator = ValidatorBuilder.create()
// Add Rules to validate structure for POJO_PACKAGE
// See com.openpojo.validation.rule.impl for more ...
// .with(new GetterMustExistRule())
// .with(new SetterMustExistRule())
// Add Testers to validate behaviour for POJO_PACKAGE
// See com.openpojo.validation.test.impl for more ...
.with(new SetterTester())
.with(new GetterTester())
.build();
final List<PojoClass> pojoClasses = new ArrayList<>();
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.models",
new FilterClassName("\\w*Issuer\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.models",
new FilterClassName("\\w*PaymentRequestResult\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.models",
new FilterClassName("\\w*PaymentMethod\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.models",
new FilterClassName("\\w*Amount\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.models",
new FilterClassName("\\w*Payment\\w*$")));
pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.models",
new FilterClassName("\\w*PaymentModule\\w*$")));
validator.validate(pojoClasses);
}
示例14: testGetter
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Test(timeout = 1_000)
public void testGetter() {
final PojoClass activityPojo = PojoClassFactory.getPojoClass(VerificationToken.class);
final Validator validator = ValidatorBuilder.create()
.with(new GetterMustExistRule())
.build();
validator.validate(activityPojo);
}
示例15: testGetterAndSetter
import com.openpojo.validation.ValidatorBuilder; //导入依赖的package包/类
@Test(timeout = 1_000)
public void testGetterAndSetter() {
final PojoClass activityPojo = PojoClassFactory.getPojoClass(AccountUser.class);
final Validator validator = ValidatorBuilder.create()
.with(new SetterMustExistRule()).with(new GetterMustExistRule())
.with(new SetterTester()).with(new GetterTester()).build();
validator.validate(activityPojo);
}