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

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


  }

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

    assertThat( methodMetaData.getParameterTypes() ).isEqualTo( method.getParameterTypes() );
  }
View Full Code Here


  }

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

    assertThat( methodMetaData.getParameterTypes() ).isEqualTo( method.getParameterTypes() );
  }
View Full Code Here

  }

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

    assertThat( methodMetaData.getKind() ).isEqualTo( ElementKind.METHOD );
  }
View Full Code Here

  @Test
  public void getKindForConstructor() throws Exception {

    Constructor<CustomerRepositoryExt> constructor = CustomerRepositoryExt.class.getConstructor( String.class );
    ExecutableMetaData constructorMetaData = beanMetaData.getMetaDataFor(
        ExecutableElement.forConstructor(
            constructor
        )
    );

    assertThat( constructorMetaData.getKind() ).isEqualTo( ElementKind.CONSTRUCTOR );
  }
View Full Code Here

  }

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

    assertThat( methodMetaData.getIdentifier() ).isEqualTo(
        "createCustomer[interface java.lang.CharSequence, class java.lang.String]"
    );
  }
View Full Code Here

  }

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

    assertThat( methodMetaData.getIdentifier() ).isEqualTo( "foo[]" );
  }
View Full Code Here

  }

  @Test
  public void getIdentifierForConstructor() throws Exception {
    Constructor<CustomerRepositoryExt> constructor = CustomerRepositoryExt.class.getConstructor( String.class );
    ExecutableMetaData constructorMetaData = beanMetaData.getMetaDataFor(
        ExecutableElement.forConstructor(
            constructor
        )
    );

    assertThat( constructorMetaData.getIdentifier() ).isEqualTo( "CustomerRepositoryExt[class java.lang.String]" );
  }
View Full Code Here

  }

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

    assertEquals( methodMetaData.unwrapMode(), UnwrapMode.UNWRAP );
  }
View Full Code Here

  }

  @Test
  public void requiresUnwrappingForConstructor() throws Exception {
    Constructor<CustomerRepositoryExt> constructor = CustomerRepositoryExt.class.getConstructor( long.class );
    ExecutableMetaData constructorMetaData = beanMetaData.getMetaDataFor(
        ExecutableElement.forConstructor(
            constructor
        )
    );

    assertEquals( constructorMetaData.unwrapMode(), UnwrapMode.UNWRAP );
  }
View Full Code Here

  }

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

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

    assertFalse( methodMetaData.getParameterMetaData( 0 ).isConstrained() );
    assertFalse( methodMetaData.getParameterMetaData( 0 ).isCascading() );

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

    assertThat( methodMetaData ).isEmpty();
    assertThat( methodMetaData.getCrossParameterConstraints() ).isEmpty();
  }
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.