Examples of MessageInterpolatorContext


Examples of org.hibernate.validator.internal.engine.MessageInterpolatorContext

      elContext.setVariable( entry.getKey(), valueExpression );
    }

    // check for custom parameters provided by HibernateConstraintValidatorContext
    if ( messageInterpolatorContext instanceof MessageInterpolatorContext ) {
      MessageInterpolatorContext internalContext = (MessageInterpolatorContext) messageInterpolatorContext;
      for ( Map.Entry<String, Object> entry : internalContext.getMessageParameters().entrySet() ) {
        valueExpression = expressionFactory.createValueExpression( entry.getValue(), Object.class );
        elContext.setVariable( entry.getKey(), valueExpression );
      }
    }
View Full Code Here

Examples of org.hibernate.validator.internal.engine.MessageInterpolatorContext

    // prepare the mock interpolator to expect the right interpolate call
    String validatedValue = "value";
    expect(
        mock.interpolate(
            MESSAGE,
            new MessageInterpolatorContext(
                constraintDescriptors.iterator().next(),
                validatedValue,
                TestBean.class,
                Collections.<String, Object>emptyMap()
            )
View Full Code Here

Examples of org.hibernate.validator.internal.engine.MessageInterpolatorContext

    verify( mock );
  }

  @Test(expectedExceptions = ValidationException.class)
  public void testUnwrapToImplementationCausesValidationException() {
    Context context = new MessageInterpolatorContext( null, null, null, Collections.<String, Object>emptyMap() );
    context.unwrap( MessageInterpolatorContext.class );
  }
View Full Code Here

Examples of org.hibernate.validator.internal.engine.MessageInterpolatorContext

    context.unwrap( MessageInterpolatorContext.class );
  }

  @Test
  public void testUnwrapToInterfaceTypesSucceeds() {
    Context context = new MessageInterpolatorContext( null, null, null, Collections.<String, Object>emptyMap() );

    MessageInterpolator.Context asMessageInterpolatorContext = context.unwrap( MessageInterpolator.Context.class );
    assertSame( asMessageInterpolatorContext, context );

    HibernateMessageInterpolatorContext asHibernateMessageInterpolatorContext = context.unwrap(
        HibernateMessageInterpolatorContext.class
    );
    assertSame( asHibernateMessageInterpolatorContext, context );

    Object asObject = context.unwrap( Object.class );
    assertSame( asObject, context );
  }
View Full Code Here

Examples of org.hibernate.validator.internal.engine.MessageInterpolatorContext

  }

  @Test
  public void testGetRootBeanType() {
    Class<Object> rootBeanType = Object.class;
    MessageInterpolator.Context context = new MessageInterpolatorContext(
        null,
        null,
        rootBeanType,
        Collections.<String, Object>emptyMap()
    );

    assertSame( context.unwrap( HibernateMessageInterpolatorContext.class ).getRootBeanType(), rootBeanType );
  }
View Full Code Here

Examples of org.hibernate.validator.internal.engine.MessageInterpolatorContext

  @Test
  public void testExpressionLanguageGraphNavigation() {
    User user = new User();
    user.setAge( 18 );
    MessageInterpolator.Context context = new MessageInterpolatorContext(
        notNullDescriptor,
        user,
        null,
        Collections.<String, Object>emptyMap()
    );
View Full Code Here

Examples of org.hibernate.validator.internal.engine.MessageInterpolatorContext

    assertEquals( actual, expected, "Wrong substitution" );
  }

  @Test
  public void testUnknownPropertyInExpressionLanguageGraphNavigation() {
    MessageInterpolator.Context context = new MessageInterpolatorContext(
        notNullDescriptor,
        new User(),
        null,
        Collections.<String, Object>emptyMap()
    );
View Full Code Here

Examples of org.hibernate.validator.internal.engine.MessageInterpolatorContext

    assertEquals( actual, expected, "Wrong substitution" );
  }

  @Test
  public void testLocaleBasedFormatting() {
    MessageInterpolator.Context context = new MessageInterpolatorContext(
        notNullDescriptor,
        42.00000d,
        null,
        Collections.<String, Object>emptyMap()
    );
View Full Code Here

Examples of org.hibernate.validator.internal.engine.MessageInterpolatorContext

    assertEquals( actual, expected, "Calling of String#substring should work" );
  }

  @Test
  public void testCallingWrongFormatterMethod() {
    MessageInterpolator.Context context = new MessageInterpolatorContext(
        notNullDescriptor,
        42.00000d,
        null,
        Collections.<String, Object>emptyMap()
    );
View Full Code Here

Examples of org.hibernate.validator.internal.engine.MessageInterpolatorContext

        "If single quotes are used in EL expression literal single quotes need to be escaped"
    );
  }

  private MessageInterpolatorContext createMessageInterpolatorContext(ConstraintDescriptorImpl<?> descriptor) {
    return new MessageInterpolatorContext(
        descriptor,
        null,
        null,
        Collections.<String, Object>emptyMap()
    );
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.