Examples of ParanamerParameterNameProvider


Examples of org.hibernate.validator.parameternameprovider.ParanamerParameterNameProvider

@TestForIssue(jiraKey = "HV-802")
public class ParanamerParameterNameProviderTest {

  @Test
  public void shouldReturnParameterNamesFromDebugSymbolsForMethod() throws Exception {
    ParanamerParameterNameProvider parameterNameProvider = new ParanamerParameterNameProvider();
    Method method = ComputerGame.class.getMethod( "startGame", String.class, int.class );

    List<String> parameterNames = parameterNameProvider.getParameterNames( method );
    assertThat( parameterNames ).containsExactly( "level", "numberOfPlayers" );
  }
View Full Code Here

Examples of org.hibernate.validator.parameternameprovider.ParanamerParameterNameProvider

    assertThat( parameterNames ).containsExactly( "level", "numberOfPlayers" );
  }

  @Test
  public void shouldReturnParameterNamesFromDebugSymbolsForConstructor() throws Exception {
    ParanamerParameterNameProvider parameterNameProvider = new ParanamerParameterNameProvider();
    Constructor<ComputerGame> constructor = ComputerGame.class.getConstructor( String.class );

    List<String> parameterNames = parameterNameProvider.getParameterNames( constructor );
    assertThat( parameterNames ).containsExactly( "title" );
  }
View Full Code Here

Examples of org.hibernate.validator.parameternameprovider.ParanamerParameterNameProvider

    assertThat( parameterNames ).containsExactly( "title" );
  }

  @Test
  public void shouldReturnParameterNamesFromCustomParanamer() throws Exception {
    ParanamerParameterNameProvider parameterNameProvider = new ParanamerParameterNameProvider( new CustomAnnotationParanamer() );

    Constructor<ComputerGame> constructor = ComputerGame.class.getConstructor( String.class );
    List<String> parameterNames = parameterNameProvider.getParameterNames( constructor );
    assertThat( parameterNames ).containsExactly( "gameTitle" );

    Method method = ComputerGame.class.getMethod( "pauseGame", int.class );
    parameterNames = parameterNameProvider.getParameterNames( method );
    assertThat( parameterNames ).containsExactly( "durationInSeconds" );
  }
View Full Code Here

Examples of org.hibernate.validator.parameternameprovider.ParanamerParameterNameProvider

    assertThat( parameterNames ).containsExactly( "durationInSeconds" );
  }

  @Test
  public void shouldReturnDefaultValuesAsFallBack() throws Exception {
    ParanamerParameterNameProvider parameterNameProvider = new ParanamerParameterNameProvider( new CustomAnnotationParanamer() );

    Method method = ComputerGame.class.getMethod( "startGame", String.class, int.class );
    List<String> parameterNames = parameterNameProvider.getParameterNames( method );
    assertThat( parameterNames ).containsExactly( "arg0", "arg1" );
  }
View Full Code Here

Examples of org.hibernate.validator.parameternameprovider.ParanamerParameterNameProvider

  }

  @Test
  public void shouldUseParanamerProviderDuringValidation() throws Exception {
    ExecutableValidator executableValidator = getConfiguration()
        .parameterNameProvider( new ParanamerParameterNameProvider( new CustomAnnotationParanamer() ) )
        .buildValidatorFactory()
        .getValidator()
        .forExecutables();

    Object object = new ComputerGame( "Giovanni Brothers" );
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.