Package org.hibernate.validator.cfg.defs

Examples of org.hibernate.validator.cfg.defs.NotNullDef


  @Test
  public void testDefaultGroupSequence() {
    mapping.type( Marathon.class )
        .defaultGroupSequence( Foo.class, Marathon.class )
        .property( "name", METHOD )
        .constraint( new NotNullDef().groups( Foo.class ) )
        .property( "runners", METHOD )
        .constraint( new NotEmptyDef() );
    config.addMapping( mapping );
    Validator validator = config.buildValidatorFactory().getValidator();
View Full Code Here


  @Test
  public void testDefaultGroupSequenceProvider() {
    mapping.type( Marathon.class )
        .defaultGroupSequenceProviderClass( MarathonDefaultGroupSequenceProvider.class )
        .property( "name", METHOD )
        .constraint( new NotNullDef().groups( Foo.class ) )
        .property( "runners", METHOD )
        .constraint( new NotEmptyDef() );
    config.addMapping( mapping );
    Validator validator = config.buildValidatorFactory().getValidator();
View Full Code Here

  public void testProgrammaticDefaultGroupSequenceAndDefaultGroupSequenceProviderDefinedOnSameClass() {
    mapping.type( Marathon.class )
        .defaultGroupSequence( Foo.class, Marathon.class )
        .defaultGroupSequenceProviderClass( MarathonDefaultGroupSequenceProvider.class )
        .property( "name", METHOD )
        .constraint( new NotNullDef().groups( Foo.class ) )
        .property( "runners", METHOD )
        .constraint( new NotEmptyDef() );
    config.addMapping( mapping );
    Validator validator = config.buildValidatorFactory().getValidator();
    validator.validate( new Marathon() );
View Full Code Here

  )
  public void testProgrammaticDefaultGroupSequenceDefinedOnClassWithGroupProviderAnnotation() {
    mapping.type( B.class )
        .defaultGroupSequence( Foo.class, B.class )
        .property( "b", FIELD )
        .constraint( new NotNullDef() );
    config.addMapping( mapping );
    Validator validator = config.buildValidatorFactory().getValidator();
    validator.validate( new B() );
  }
View Full Code Here

  )
  public void testProgrammaticDefaultGroupSequenceProviderDefinedOnClassWithGroupSequenceAnnotation() {
    mapping.type( A.class )
        .defaultGroupSequenceProviderClass( ADefaultGroupSequenceProvider.class )
        .property( "a", FIELD )
        .constraint( new NotNullDef() );
    config.addMapping( mapping );
    Validator validator = config.buildValidatorFactory().getValidator();
    validator.validate( new A() );
  }
View Full Code Here

  @Test(description = "HV-444")
  public void testDefaultGroupSequenceDefinedOnClassWithNoConstraints() {
    mapping.type( Marathon.class )
        .property( "name", METHOD )
        .constraint( new NotNullDef().groups( Foo.class ) )
        .property( "runners", METHOD )
        .constraint( new NotEmptyDef() )
        .type( ExtendedMarathon.class )
        .defaultGroupSequence( Foo.class, ExtendedMarathon.class );
    config.addMapping( mapping );
View Full Code Here

  public void testProgrammaticCascadingValidationFieldAccess() {
    ConstraintMapping newMapping = config.createConstraintMapping();
    newMapping
        .type( C.class )
        .property( "string", FIELD )
        .constraint( new NotNullDef() )
        .type( A.class )
        .property( "c", FIELD )
        .valid();
    config.addMapping( newMapping );
    Validator validator = config.buildValidatorFactory().getValidator();
View Full Code Here

  public void testProgrammaticCascadingValidationMethodAccess() {
    ConstraintMapping newMapping = config.createConstraintMapping();
    newMapping
        .type( C.class )
        .property( "string", METHOD )
        .constraint( new NotNullDef() )
        .type( A.class )
        .property( "c", METHOD )
        .valid();
    config.addMapping( newMapping );
    Validator validator = config.buildValidatorFactory().getValidator();
View Full Code Here

  public void testProgrammaticCascadingMethodValidation() {
    ConstraintMapping newMapping = config.createConstraintMapping();
    newMapping
        .type( C.class )
        .property( "string", METHOD )
        .constraint( new NotNullDef() )
        .type( A.class )
        .property( "c", METHOD )
        .valid();
    config.addMapping( newMapping );
    Validator validator = config.buildValidatorFactory().getValidator();
View Full Code Here

        .valid()
        .convertGroup( Default.class ).to( TestGroup.class )
        .type( Message.class )
        .property( "message", ElementType.FIELD )
        .constraint(
            new NotNullDef()
                .message( "message must not be null" )
                .groups( TestGroup.class )
        );

    config.addMapping( mapping );
View Full Code Here

TOP

Related Classes of org.hibernate.validator.cfg.defs.NotNullDef

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.