Examples of ReturnValueDescriptor


Examples of javax.validation.metadata.ReturnValueDescriptor

        CustomerRepository.class,
        String.class
    );
    assertNotNull( descriptor, "the specified constructor should be configured in xml" );

    ReturnValueDescriptor returnValueDescriptor = descriptor.getReturnValueDescriptor();
    Set<ConstraintDescriptor<?>> constraintDescriptors = returnValueDescriptor.getConstraintDescriptors();
    assertTrue( constraintDescriptors.size() == 1 );

    ConstraintDescriptor<?> constraintDescriptor = constraintDescriptors.iterator().next();
    assertEquals(
        constraintDescriptor.getAnnotation().annotationType(),
View Full Code Here

Examples of javax.validation.metadata.ReturnValueDescriptor

        CustomerRepository.class,
        CustomerRepository.class
    );
    assertNotNull( descriptor, "the specified constructor should be configured in xml" );

    ReturnValueDescriptor returnValueDescriptor = descriptor.getReturnValueDescriptor();
    assertTrue( returnValueDescriptor.isCascaded(), "<valid/> is used to configure cascading" );


    List<ParameterDescriptor> parameterDescriptors = descriptor.getParameterDescriptors();
    assertTrue( parameterDescriptors.size() == 1 );
View Full Code Here

Examples of javax.validation.metadata.ReturnValueDescriptor

        CustomerRepository.class,
        CustomerRepository.class
    );
    assertNotNull( descriptor, "the specified constructor should be configured in xml" );

    ReturnValueDescriptor returnValueDescriptor = descriptor.getReturnValueDescriptor();
    Set<GroupConversionDescriptor> groupConversionDescriptors = returnValueDescriptor.getGroupConversions();
    assertTrue( groupConversionDescriptors.size() == 1 );

    GroupConversionDescriptor groupConversionDescriptor = groupConversionDescriptors.iterator().next();
    assertEquals( groupConversionDescriptor.getFrom(), Default.class, "Wrong from class for group conversion" );
View Full Code Here

Examples of javax.validation.metadata.ReturnValueDescriptor

  @SpecAssertion(section = "8.1.1.5", id = "o")
  public void testValidaAnnotationIsApplied() throws Exception {
    MethodDescriptor descriptor = TestUtil.getMethodDescriptor( Cascaded.class, "cascade", String.class );
    assertNotNull( descriptor, "the specified method should be configured in xml" );

    ReturnValueDescriptor returnValueDescriptor = descriptor.getReturnValueDescriptor();
    assertTrue( returnValueDescriptor.isCascaded(), "Cascaded validation should be applied" );

    ParameterDescriptor parameterDescriptor = descriptor.getParameterDescriptors().get( 0 );
    assertTrue( parameterDescriptor.isCascaded(), "Cascaded validation should be applied" );
  }
View Full Code Here

Examples of javax.validation.metadata.ReturnValueDescriptor

  @SpecAssertion(section = "8.1.1.4", id = "n")
  public void testValidaAnnotationIsApplied() throws Exception {
    ConstructorDescriptor descriptor = TestUtil.getConstructorDescriptor( Cascaded.class, String.class );
    assertNotNull( descriptor, "the specified constructor should be configured in xml" );

    ReturnValueDescriptor returnValueDescriptor = descriptor.getReturnValueDescriptor();
    assertTrue( returnValueDescriptor.isCascaded(), "Cascaded validation should be applied" );

    ParameterDescriptor parameterDescriptor = descriptor.getParameterDescriptors().get( 0 );
    assertTrue( parameterDescriptor.isCascaded(), "Cascaded validation should be applied" );
  }
View Full Code Here

Examples of javax.validation.metadata.ReturnValueDescriptor

        private void ensureNoReturnValueAddedInChild(final ReturnValueDescriptor returnValueDescriptor, final MethodDescriptor parentMtdDesc, final String msg) {
            if (parentMtdDesc == null) {
                return;
            }

            final ReturnValueDescriptor parentReturnDesc = parentMtdDesc.getReturnValueDescriptor();
            if (parentReturnDesc.isCascaded() && !returnValueDescriptor.isCascaded() || parentReturnDesc.getConstraintDescriptors().size() > returnValueDescriptor.getConstraintDescriptors().size()) {
                throw new ConstraintDeclarationException(msg);
            }
        }
View Full Code Here

Examples of javax.validation.metadata.ReturnValueDescriptor

    return theValue;
  }

  private ReturnValueDescriptor returnValueAsDescriptor(boolean defaultGroupSequenceRedefined, List<Class<?>> defaultGroupSequence) {
    ReturnValueDescriptor returnValueDescriptor = new ReturnValueDescriptorImpl(
        getType(),
        asDescriptors( getConstraints() ),
        isCascading(),
        defaultGroupSequenceRedefined,
        defaultGroupSequence
View Full Code Here

Examples of javax.validation.metadata.ReturnValueDescriptor

        "getDriver"
    );
    assertFalse( getDriverDescriptor.hasConstrainedParameters() );
    assertTrue( getDriverDescriptor.hasConstrainedReturnValue() );

    ReturnValueDescriptor returnValueDescriptor = getDriverDescriptor.getReturnValueDescriptor();
    assertTrue( returnValueDescriptor.getConstraintDescriptors().isEmpty() );
    assertTrue( returnValueDescriptor.isCascaded() );
    assertEquals( 1, returnValueDescriptor.getGroupConversions().size() );

    //load(List<Person>, List<PieceOfLuggage>) has one cross-parameter constraint
    MethodDescriptor loadDescriptor = carDescriptor.getConstraintsForMethod(
        "load",
        List.class,
View Full Code Here

Examples of javax.validation.metadata.ReturnValueDescriptor

*/
public class ReturnValueDescriptorTest {

  @Test
  public void testIsCascaded() {
    ReturnValueDescriptor elementDescriptor = getMethodReturnValueDescriptor(
        CustomerRepository.class,
        "foo"
    );
    assertTrue( elementDescriptor.isCascaded() );
  }
View Full Code Here

Examples of javax.validation.metadata.ReturnValueDescriptor

    assertTrue( elementDescriptor.isCascaded() );
  }

  @Test
  public void testIsNotCascaded() {
    ReturnValueDescriptor elementDescriptor = getMethodReturnValueDescriptor(
        CustomerRepository.class,
        "bar"
    );
    assertFalse( elementDescriptor.isCascaded() );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.