Examples of ConstructorDescriptor


Examples of javax.validation.metadata.ConstructorDescriptor

  }

  @Test
  @SpecAssertion(section = "6.7", id = "g")
  public void testGetConstraintsForConstructor() {
    ConstructorDescriptor parameterConstrainedDescriptor = Executables.parameterConstrainedConstructor();
    assertTrue(
        parameterConstrainedDescriptor.getConstraintDescriptors().isEmpty(),
        "Should have no constraints"
    );

    ConstructorDescriptor returnValueConstrainedDescriptor = Executables.returnValueConstrainedConstructor();
    assertTrue(
        returnValueConstrainedDescriptor.getConstraintDescriptors().isEmpty(),
        "Should have no constraints"
    );
    ConstructorDescriptor crossParameterConstrainedDescriptor = Executables.crossParameterConstrainedConstructor();
    assertTrue(
        crossParameterConstrainedDescriptor.getConstraintDescriptors().isEmpty(),
        "Should have no constraints"
    );
  }
View Full Code Here

Examples of javax.validation.metadata.ConstructorDescriptor

  @SpecAssertions({
      @SpecAssertion(section = "6.2", id = "d"),
      @SpecAssertion(section = "6.7", id = "g")
  })
  public void testFindConstraintsForConstructor() {
    ConstructorDescriptor parameterConstrainedDescriptor = Executables.parameterConstrainedConstructor();
    assertTrue(
        parameterConstrainedDescriptor.findConstraints()
            .getConstraintDescriptors()
            .isEmpty(),
        "Should have no constraints"
    );

    ConstructorDescriptor returnValueConstrainedDescriptor = Executables.returnValueConstrainedConstructor();
    assertTrue(
        returnValueConstrainedDescriptor.findConstraints()
            .getConstraintDescriptors()
            .isEmpty(),
        "Should have no constraints"
    );
    ConstructorDescriptor crossParameterConstrainedDescriptor = Executables.crossParameterConstrainedConstructor();
    assertTrue(
        crossParameterConstrainedDescriptor.findConstraints()
            .getConstraintDescriptors()
            .isEmpty(),
        "Should have no constraints"
    );
  }
View Full Code Here

Examples of javax.validation.metadata.ConstructorDescriptor

            .getBootstrapConfiguration()
            .getDefaultValidatedExecutableTypes(),
        Collections.emptySet()
    );

    ConstructorDescriptor descriptor = getConstructorDescriptor(
        StockItem.class,
        String.class
    );

    assertNotNull( descriptor );
    assertEquals( descriptor.getName(), "StockItem" );
    assertEquals( descriptor.getParameterDescriptors().get( 0 ).getConstraintDescriptors().size(), 1 );
  }
View Full Code Here

Examples of javax.validation.metadata.ConstructorDescriptor

  }

  @Test
  @SpecAssertion(section = "6.3", id = "g")
  public void testGetConstraintsForParameterConstrainedConstructor() {
    ConstructorDescriptor constructorDescriptor = Executables.parameterConstrainedConstructor();
    assertNotNull( constructorDescriptor, "Descriptor should not be null" );
  }
View Full Code Here

Examples of javax.validation.metadata.ConstructorDescriptor

  }

  @Test
  @SpecAssertion(section = "6.3", id = "g")
  public void testGetConstraintsForCrossParameterConstrainedConstructor() {
    ConstructorDescriptor constructorDescriptor = Executables.crossParameterConstrainedConstructor();
    assertNotNull( constructorDescriptor, "Descriptor should not be null" );
  }
View Full Code Here

Examples of javax.validation.metadata.ConstructorDescriptor

  }

  @Test
  @SpecAssertion(section = "6.3", id = "g")
  public void testGetConstraintsForCascadedParameterConstructor() {
    ConstructorDescriptor constructorDescriptor = Executables.cascadedParameterConstructor();
    assertNotNull( constructorDescriptor, "Descriptor should not be null" );
  }
View Full Code Here

Examples of javax.validation.metadata.ConstructorDescriptor

  }

  @Test
  @SpecAssertion(section = "6.3", id = "g")
  public void testGetConstraintsForReturnValueConstrainedConstructor() {
    ConstructorDescriptor constructorDescriptor = Executables.returnValueConstrainedConstructor();
    assertNotNull( constructorDescriptor, "Descriptor should not be null" );
  }
View Full Code Here

Examples of javax.validation.metadata.ConstructorDescriptor

  }

  @Test
  @SpecAssertion(section = "6.3", id = "g")
  public void testGetConstraintsForCascadedReturnValueConstructor() {
    ConstructorDescriptor constructorDescriptor = Executables.cascadedReturnValueConstructor();
    assertNotNull( constructorDescriptor, "Descriptor should not be null" );
  }
View Full Code Here

Examples of javax.validation.metadata.ConstructorDescriptor

  @Test
  @SpecAssertion(section = "6.3", id = "g")
  public void testGetConstraintsForNonExistingConstructorConstructor() {
    BeanDescriptor beanDescriptor = validator.getConstraintsForClass( CustomerService.class );
    ConstructorDescriptor constructorDescriptor = beanDescriptor.getConstraintsForConstructor(
        Short.class
    );
    assertNull( constructorDescriptor, "Descriptor should be null" );
  }
View Full Code Here

Examples of javax.validation.metadata.ConstructorDescriptor

        }
        return list;
    }

    public ConstructorDescriptor getConstraintsForConstructor(final Class<?>... parameterTypes) {
        final ConstructorDescriptor descriptor = meta.contructorConstraints.get(Arrays.toString(parameterTypes));
        if (descriptor != null && (descriptor.hasConstrainedParameters() || descriptor.hasConstrainedReturnValue())) {
            return descriptor;
        }

        return null;
    }
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.