Package org.hibernate.validator.internal.metadata.aggregated

Examples of org.hibernate.validator.internal.metadata.aggregated.ExecutableMetaData


  }

  @Test
  public void methodWithCascadedParameter() throws Exception {
    Method method = CustomerRepositoryExt.class.getMethod( "saveCustomer", Customer.class );
    ExecutableMetaData methodMetaData = beanMetaData.getMetaDataFor(
        ExecutableElement.forMethod(
            method
        )
    );

    assertFalse( methodMetaData.isCascading() );
    assertTrue( methodMetaData.isConstrained() );
    assertThat( methodMetaData ).isEmpty();

    assertTrue( methodMetaData.getParameterMetaData( 0 ).isConstrained() );
    assertTrue( methodMetaData.getParameterMetaData( 0 ).isCascading() );
    assertThat( methodMetaData.getParameterMetaData( 0 ) ).isEmpty();

    assertThat( methodMetaData ).isEmpty();
    assertThat( methodMetaData.getCrossParameterConstraints() ).isEmpty();
  }
View Full Code Here


    Method method = CustomerRepositoryExt.class.getMethod(
        "methodWithCrossParameterConstraint",
        DateMidnight.class,
        DateMidnight.class
    );
    ExecutableMetaData methodMetaData = beanMetaData.getMetaDataFor(
        ExecutableElement.forMethod(
            method
        )
    );

    assertFalse( methodMetaData.isCascading() );
    assertTrue( methodMetaData.isConstrained() );
    assertThat( methodMetaData ).isEmpty();

    assertThat( methodMetaData.getCrossParameterConstraints() ).hasSize( 1 );
    assertThat(
        methodMetaData.getCrossParameterConstraints()
            .iterator()
            .next()
            .getDescriptor()
            .getAnnotation()
            .annotationType()
View Full Code Here

  }

  @Test
  public void methodWithConstrainedReturnValue() throws Exception {
    Method method = CustomerRepositoryExt.class.getMethod( "bar" );
    ExecutableMetaData methodMetaData = beanMetaData.getMetaDataFor(
        ExecutableElement.forMethod(
            method
        )
    );

    assertFalse( methodMetaData.isCascading() );
    assertTrue( methodMetaData.isConstrained() );
    assertThat( methodMetaData ).hasSize( 1 );
    assertEquals(
        methodMetaData.iterator().next().getDescriptor().getAnnotation().annotationType(), NotNull.class
    );

    assertThat( methodMetaData.getCrossParameterConstraints() ).isEmpty();
  }
View Full Code Here

  }

  @Test
  public void returnValueConstraintFromSuperType() throws Exception {
    Method method = CustomerRepositoryExt.class.getMethod( "bar" );
    ExecutableMetaData methodMetaData = beanMetaData.getMetaDataFor(
        ExecutableElement.forMethod(
            method
        )
    );

    assertThat( methodMetaData ).hasSize( 1 );
    assertFalse( methodMetaData.isCascading() );

    ConstraintDescriptorImpl<? extends Annotation> descriptor = methodMetaData.iterator()
        .next()
        .getDescriptor();
    assertEquals( descriptor.getAnnotation().annotationType(), NotNull.class );
  }
View Full Code Here

  }

  @Test
  public void returnValueConstraintsAddUpInHierarchy() throws Exception {
    Method method = CustomerRepositoryExt.class.getMethod( "baz" );
    ExecutableMetaData methodMetaData = beanMetaData.getMetaDataFor(
        ExecutableElement.forMethod(
            method
        )
    );

    assertFalse( methodMetaData.isCascading() );
    assertTrue( methodMetaData.isConstrained() );
    assertThat( methodMetaData ).hasSize( 2 );
  }
View Full Code Here

  }

  @Test
  public void methodWithCascadedReturnValue() throws Exception {
    Method method = CustomerRepositoryExt.class.getMethod( "foo" );
    ExecutableMetaData methodMetaData = beanMetaData.getMetaDataFor(
        ExecutableElement.forMethod(
            method
        )
    );

    assertTrue( methodMetaData.isCascading() );
    assertTrue( methodMetaData.isConstrained() );
    assertThat( methodMetaData ).isEmpty();
    assertThat( methodMetaData.getCrossParameterConstraints() ).isEmpty();
  }
View Full Code Here

  }

  @Test
  public void locallyDefinedGroupConversion() throws Exception {
    Method method = CustomerRepositoryExt.class.getMethod( "methodWithReturnValueGroupConversion" );
    ExecutableMetaData methodMetaData = beanMetaData.getMetaDataFor(
        ExecutableElement.forMethod(
            method
        )
    );

    assertThat(
        methodMetaData.getReturnValueMetaData()
            .getCascadables()
            .iterator()
            .next()
            .convertGroup( Default.class )
    ).isEqualTo( ValidationGroup.class );
View Full Code Here

  }

  @Test
  public void unconstrainedMethod() throws Exception {
    Method method = CustomerRepositoryExt.class.getMethod( "updateCustomer", Customer.class );
    ExecutableMetaData methodMetaData = beanMetaData.getMetaDataFor(
        ExecutableElement.forMethod(
            method
        )
    );

    assertFalse( methodMetaData.isCascading() );
    assertFalse( methodMetaData.isConstrained() );
    assertThat( methodMetaData ).isEmpty();
    assertThat( methodMetaData.getCrossParameterConstraints() ).isEmpty();
    assertEquals( methodMetaData.unwrapMode(), UnwrapMode.AUTOMATIC );

    assertThat( methodMetaData.getParameterMetaData( 0 ).isConstrained() ).isFalse();
    assertThat( methodMetaData.getParameterMetaData( 0 ).isCascading() ).isFalse();
    assertThat( methodMetaData.getParameterMetaData( 0 ) ).isEmpty();
  }
View Full Code Here

  }

  @Test
  public void constrainedParameterMetaData() throws Exception {
    Method method = CustomerRepository.class.getMethod( "createCustomer", CharSequence.class, String.class );
    ExecutableMetaData methodMetaData = beanMetaData.getMetaDataFor( ExecutableElement.forMethod( method ) );

    ParameterMetaData parameterMetaData = methodMetaData.getParameterMetaData( 1 );

    assertFalse( parameterMetaData.isCascading() );
    assertTrue( parameterMetaData.isConstrained() );
    assertEquals( parameterMetaData.getIndex(), 1 );
    assertEquals( parameterMetaData.getName(), "arg1" );
View Full Code Here

  }

  @Test
  public void cascadingParameterMetaData() throws Exception {
    Method method = CustomerRepository.class.getMethod( "saveCustomer", Customer.class );
    ExecutableMetaData methodMetaData = beanMetaData.getMetaDataFor( ExecutableElement.forMethod( method ) );

    ParameterMetaData parameterMetaData = methodMetaData.getParameterMetaData( 0 );

    assertTrue( parameterMetaData.isCascading() );
    assertTrue( parameterMetaData.isConstrained() );
    assertEquals( parameterMetaData.getIndex(), 0 );
    assertEquals( parameterMetaData.getName(), "arg0" );
View Full Code Here

TOP

Related Classes of org.hibernate.validator.internal.metadata.aggregated.ExecutableMetaData

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.