Package javax.validation.metadata

Examples of javax.validation.metadata.MethodDescriptor


    assertThat( methodDescriptor.hasConstrainedReturnValue() ).isFalse();
  }

  @Test
  public void testAreParametersConstrainedForParameterConstrainedMethod() {
    MethodDescriptor methodDescriptor = getMethodDescriptor(
        CustomerRepositoryExt.class,
        "createCustomer",
        CharSequence.class,
        String.class
    );
    assertThat( methodDescriptor.hasConstrainedParameters() ).isTrue();
  }
View Full Code Here


    assertThat( methodDescriptor.hasConstrainedParameters() ).isTrue();
  }

  @Test
  public void testAreParametersConstrainedForParameterCascadedMethod() {
    MethodDescriptor methodDescriptor = getMethodDescriptor(
        CustomerRepositoryExt.class,
        "saveCustomer",
        Customer.class
    );
    assertThat( methodDescriptor.hasConstrainedParameters() ).isTrue();
  }
View Full Code Here

    assertThat( methodDescriptor.hasConstrainedParameters() ).isTrue();
  }

  @Test
  public void testAreParametersConstrainedForCrossParameterConstrainedMethod() {
    MethodDescriptor methodDescriptor = getMethodDescriptor(
        CustomerRepositoryExt.class,
        "methodWithCrossParameterConstraint", DateMidnight.class, DateMidnight.class
    );
    assertThat( methodDescriptor.hasConstrainedParameters() ).isTrue();
  }
View Full Code Here

    assertThat( methodDescriptor.hasConstrainedParameters() ).isTrue();
  }

  @Test
  public void testAreParametersConstrainedForNonParameterConstrainedMethod() {
    MethodDescriptor methodDescriptor = getMethodDescriptor(
        CustomerRepositoryExt.class,
        "zip",
        int.class
    );
    assertThat( methodDescriptor.hasConstrainedParameters() ).isFalse();
  }
View Full Code Here

    assertThat( methodDescriptor.hasConstrainedParameters() ).isFalse();
  }

  @Test
  public void testAreParametersConstrainedForParameterlessMethod() {
    MethodDescriptor methodDescriptor = getMethodDescriptor(
        CustomerRepositoryExt.class,
        "zip"
    );
    assertThat( methodDescriptor.hasConstrainedParameters() ).isFalse();
  }
View Full Code Here

  }

  @Test
  public void testGetConstraintsForMethod() throws Exception {
    BeanDescriptor descriptor = getBeanDescriptor( CustomerRepository.class );
    MethodDescriptor methodDescriptor = descriptor.getConstraintsForMethod( "foo" );

    assertNotNull( methodDescriptor );
  }
View Full Code Here

  // A method descriptor can be retrieved by specifying an overridden method
  // from a base type.
  @Test
  public void testGetConstraintsForOverriddenMethod() throws Exception {
    BeanDescriptor descriptor = getBeanDescriptor( CustomerRepositoryExt.class );
    MethodDescriptor methodDescriptor = descriptor.getConstraintsForMethod( "foo" );

    assertNotNull( methodDescriptor );
  }
View Full Code Here

  // type (qax() is not defined on CustomerRepositoryExt, but only on
  // CustomerRepository).
  @Test
  public void testGetConstraintsForMethodFromBaseType() throws Exception {
    BeanDescriptor descriptor = getBeanDescriptor( CustomerRepositoryExt.class );
    MethodDescriptor methodDescriptor = descriptor.getConstraintsForMethod(
        "qax",
        Integer.class
    );

    assertNotNull( methodDescriptor );
View Full Code Here

  public void testGetConstraintMethods() {
    BeanDescriptor beanDescriptor = getBeanDescriptor( Mixed.class );

    Set<MethodDescriptor> methodDescriptors = beanDescriptor.getConstrainedMethods( MethodType.GETTER );
    assertEquals( methodDescriptors.size(), 1, "There should be only one getter" );
    MethodDescriptor methodDescriptor = methodDescriptors.iterator().next();
    assertEquals( methodDescriptor.getName(), "getFoo", "Unexpected method name" );

    methodDescriptors = beanDescriptor.getConstrainedMethods( MethodType.NON_GETTER );
    assertEquals( methodDescriptors.size(), 1, "There should be only one non-getter" );
    methodDescriptor = methodDescriptors.iterator().next();
    assertEquals( methodDescriptor.getName(), "foo", "Unexpected method name" );

    methodDescriptors = beanDescriptor.getConstrainedMethods( MethodType.NON_GETTER, MethodType.GETTER );
    assertEquals( methodDescriptors.size(), 2, "There should  be two methods" );

    // passing null as main argument
View Full Code Here

    constructorDescriptor = beanDescriptor.getConstraintsForConstructor( String.class );
    List<ParameterDescriptor> parameterDescriptors = constructorDescriptor.getParameterDescriptors();
    constraintDescriptors = parameterDescriptors.get( 0 ).getConstraintDescriptors();
    assertCorrectConstraintTypes( constraintDescriptors, NotNull.class );

    MethodDescriptor methodDescriptor = beanDescriptor.getConstraintsForMethod( "getCustomers" );
    returnValueDescriptor = methodDescriptor.getReturnValueDescriptor();
    constraintDescriptors = returnValueDescriptor.getConstraintDescriptors();
    assertCorrectConstraintTypes( constraintDescriptors, NotNull.class, Size.class );

    methodDescriptor = beanDescriptor.getConstraintsForMethod( "rentCar", Customer.class, Date.class, int.class );
    parameterDescriptors = methodDescriptor.getParameterDescriptors();

    constraintDescriptors = parameterDescriptors.get( 0 ).getConstraintDescriptors();
    assertCorrectConstraintTypes( constraintDescriptors, NotNull.class );

    constraintDescriptors = parameterDescriptors.get( 1 ).getConstraintDescriptors();
View Full Code Here

TOP

Related Classes of javax.validation.metadata.MethodDescriptor

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.