Package org.hibernate.validator.internal.metadata.raw

Examples of org.hibernate.validator.internal.metadata.raw.ConstrainedExecutable


  @Test
  public void noGroupConversionOnMethod() throws Exception {
    //when
    List<BeanConfiguration<? super User>> beanConfigurations = provider.getBeanConfigurationForHierarchy( User.class );
    ConstrainedExecutable method = findConstrainedMethod( beanConfigurations, User.class, "getMail1" );

    //then
    assertThat( method.getGroupConversions() ).isEmpty();
  }
View Full Code Here


  @Test
  public void singleGroupConversionOnMethod() throws Exception {
    //when
    List<BeanConfiguration<? super User>> beanConfigurations = provider.getBeanConfigurationForHierarchy( User.class );
    ConstrainedExecutable method = findConstrainedMethod( beanConfigurations, User.class, "getPhone1" );

    //then
    Map<Class<?>, Class<?>> expected = newHashMap();
    expected.put( Default.class, BasicNumber.class );

    assertThat( method.getGroupConversions() ).isEqualTo( expected );
  }
View Full Code Here

  @Test
  public void multipleGroupConversionsOnMethod() throws Exception {
    //when
    List<BeanConfiguration<? super User>> beanConfigurations = provider.getBeanConfigurationForHierarchy( User.class );
    ConstrainedExecutable method = findConstrainedMethod( beanConfigurations, User.class, "getAddress1" );

    //then
    Map<Class<?>, Class<?>> expected = newHashMap();
    expected.put( Default.class, BasicPostal.class );
    expected.put( Complete.class, FullPostal.class );

    assertThat( method.getGroupConversions() ).isEqualTo( expected );
  }
View Full Code Here

  @Test
  public void noGroupConversionOnParameter() throws Exception {
    //when
    List<BeanConfiguration<? super User>> beanConfigurations = provider.getBeanConfigurationForHierarchy( User.class );
    ConstrainedExecutable method = findConstrainedMethod(
        beanConfigurations,
        User.class,
        "setMail1",
        String.class
    );

    //then
    assertThat( method.getParameterMetaData( 0 ).getGroupConversions() ).isEmpty();
  }
View Full Code Here

  @Test
  public void singleGroupConversionOnParameter() throws Exception {
    //when
    List<BeanConfiguration<? super User>> beanConfigurations = provider.getBeanConfigurationForHierarchy( User.class );
    ConstrainedExecutable method = findConstrainedMethod(
        beanConfigurations,
        User.class,
        "setPhone1",
        PhoneNumber.class
    );

    //then
    Map<Class<?>, Class<?>> expected = newHashMap();
    expected.put( Default.class, BasicNumber.class );

    assertThat( method.getParameterMetaData( 0 ).getGroupConversions() ).isEqualTo( expected );
  }
View Full Code Here

  @Test
  public void multipleGroupConversionsOnParameter() throws Exception {
    //when
    List<BeanConfiguration<? super User>> beanConfigurations = provider.getBeanConfigurationForHierarchy( User.class );
    ConstrainedExecutable method = findConstrainedMethod(
        beanConfigurations,
        User.class,
        "setAddress1",
        Address.class
    );

    //then
    Map<Class<?>, Class<?>> expected = newHashMap();
    expected.put( Default.class, BasicPostal.class );
    expected.put( Complete.class, FullPostal.class );

    assertThat( method.getParameterMetaData( 0 ).getGroupConversions() ).isEqualTo( expected );
  }
View Full Code Here

  @Test
  public void singleGroupConversionOnConstructor() throws Exception {
    //when
    List<BeanConfiguration<? super User>> beanConfigurations = provider.getBeanConfigurationForHierarchy( User.class );
    ConstrainedExecutable constructor = findConstrainedConstructor( beanConfigurations, User.class );

    //then
    Map<Class<?>, Class<?>> expected = newHashMap();
    expected.put( Default.class, BasicNumber.class );

    assertThat( constructor.getGroupConversions() ).isEqualTo( expected );
  }
View Full Code Here

  @Test
  public void multipleGroupConversionsOnConstructorParameter() throws Exception {
    //when
    List<BeanConfiguration<? super User>> beanConfigurations = provider.getBeanConfigurationForHierarchy( User.class );
    ConstrainedExecutable constructor = findConstrainedConstructor( beanConfigurations, User.class, Address.class );

    //then
    Map<Class<?>, Class<?>> expected = newHashMap();
    expected.put( Default.class, BasicPostal.class );
    expected.put( Complete.class, FullPostal.class );

    assertThat( constructor.getParameterMetaData( 0 ).getGroupConversions() ).isEqualTo( expected );
  }
View Full Code Here

  public void unwrapValidatedValueOnProperty() throws Exception {
    List<BeanConfiguration<? super GolfPlayer>> beanConfigurations = provider.getBeanConfigurationForHierarchy(
        GolfPlayer.class
    );

    ConstrainedExecutable constrainedMethod = findConstrainedMethod(
        beanConfigurations,
        GolfPlayer.class,
        "getHandicap"
    );

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

  public void testSkipUnwrapValidatedValueOnProperty() throws Exception {
    List<BeanConfiguration<? super GolfPlayer>> beanConfigurations = provider.getBeanConfigurationForHierarchy(
        GolfPlayer.class
    );

    ConstrainedExecutable constrainedMethod = findConstrainedMethod(
        beanConfigurations,
        GolfPlayer.class,
        "getScore"
    );

    assertEquals( constrainedMethod.unwrapMode(), UnwrapMode.SKIP_UNWRAP );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.validator.internal.metadata.raw.ConstrainedExecutable

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.