Package javax.validation

Examples of javax.validation.ConstraintValidatorContext


      final Iterator<Node> nodeIter = violation.getPropertyPath()
          .iterator();
      final ConstraintViolationBuilder builder = context
          .buildConstraintViolationWithTemplate(violation
              .getMessageTemplate());
            ConstraintValidatorContext nodeContext;

      if (nodeIter.hasNext()) {
        StringBuilder sb = new StringBuilder(nodeIter.next().getName());

        if (supportsConstraintComposition) {
View Full Code Here


    assertMessageAndPath( constraintViolationCreationContextList.get( 1 ), message2, "" );
  }

  @Test(expectedExceptions = ValidationException.class)
  public void testUnwrapToImplementationCausesValidationException() {
    ConstraintValidatorContext context = createEmptyConstraintValidatorContextImpl();
    context.unwrap( ConstraintValidatorContextImpl.class );
  }
View Full Code Here

    context.unwrap( ConstraintValidatorContextImpl.class );
  }

  @Test
  public void testUnwrapToPublicTypesSucceeds() {
    ConstraintValidatorContext context = createEmptyConstraintValidatorContextImpl();

    ConstraintValidatorContext asConstraintValidatorContext = context.unwrap( ConstraintValidatorContext.class );
    assertSame( asConstraintValidatorContext, context );

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

     * Domain.Validator accepts valid syslog entry.
     * @throws Exception If something goes wrong
     */
    @Test
    public void acceptsValidSyslog() throws Exception {
        final ConstraintValidatorContext ctx =
            Mockito.mock(ConstraintValidatorContext.class);
        final Domain domain = new DomainMocker()
            .withSyslog("sys-log.s3auth.com:514").mock();
        MatcherAssert.assertThat(
            new Domain.Validator().isValid(domain, ctx), Matchers.is(true)
View Full Code Here

     * Domain.Validator rejects invalid syslog entry.
     * @throws Exception If something goes wrong
     */
    @Test
    public void rejectsInvalidSyslog() throws Exception {
        final ConstraintValidatorContext ctx =
            Mockito.mock(ConstraintValidatorContext.class);
        final ConstraintViolationBuilder builder =
            Mockito.mock(ConstraintViolationBuilder.class);
        Mockito.doReturn(builder).when(ctx)
            .buildConstraintViolationWithTemplate(Mockito.anyString());
View Full Code Here

TOP

Related Classes of javax.validation.ConstraintValidatorContext

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.