Package javax.validation.constraints

Examples of javax.validation.constraints.NotNull


    FrenchAddress address = getFrenchAddressWithoutZipCode();
    Set<ConstraintViolation<FrenchAddress>> constraintViolations = validator.validate( address );
    assertCorrectNumberOfViolations( constraintViolations, 1 );
    ConstraintViolation<FrenchAddress> constraintViolation = constraintViolations.iterator().next();
    assertCorrectConstraintTypes( constraintViolations, NotNull.class );
    NotNull notNull = ( NotNull ) constraintViolation.getConstraintDescriptor().getAnnotation();
    List<Class<?>> groups = Arrays.asList( notNull.groups() );
    assertTrue( groups.size() == 2, "There should be two groups" );
    assertTrue( groups.contains( Default.class ), "The default group should be in the list." );
    assertTrue(
        groups.contains( FrenchAddress.FullAddressCheck.class ),
        "The FrenchAddress.FullAddressCheck group should be inherited."
View Full Code Here


*/
public class GetAnnotationsParameterTest {

  @Test
  public void testGetMessageParameter() {
    NotNull testAnnotation = new NotNull() {
      @Override
      public String message() {
        return "test";
      }

View Full Code Here

  @BeforeTest
  public void setUp() {
    // Create some annotations for testing using AnnotationProxies
    AnnotationDescriptor<NotNull> descriptor = new AnnotationDescriptor<NotNull>( NotNull.class );
    NotNull notNull = AnnotationFactory.create( descriptor );
    notNullDescriptor = new ConstraintDescriptorImpl<NotNull>(
        new ConstraintHelper(),
        null,
        notNull,
        java.lang.annotation.ElementType.FIELD
View Full Code Here

        }
    }

    @Override
    public Boolean hasRequiredMarker(AnnotatedMember m) {
        NotNull annotation = m.getAnnotation(NotNull.class);
        if (annotation == null) {
            return null;
        }
        return Boolean.TRUE;
    }
View Full Code Here

            return dataType;
        }

        public boolean notNull()
        {
            final NotNull n = mMethod.getAnnotation(NotNull.class);
            return n != null;
        }
View Full Code Here

TOP

Related Classes of javax.validation.constraints.NotNull

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.