Package org.hibernate.validator.internal.constraintvalidators.hv

Examples of org.hibernate.validator.internal.constraintvalidators.hv.Mod11CheckValidator


    assertTrue( validator.isValid( "1234575X", null ) );
  }

  @Test
  public void testInvalidMod11CharCheckDigit() throws Exception {
    Mod11CheckValidator validator = new Mod11CheckValidator();
    Mod11Check modCheck = createMod11CheckAnnotation(
        0,
        Integer.MAX_VALUE,
        -1,
        false,
        'X',
        'Z',
        ProcessingDirection.RIGHT_TO_LEFT
    );
    validator.initialize( modCheck );

    assertFalse( validator.isValid( "123458Z", null ) );
    assertFalse( validator.isValid( "1234557X", null ) );
  }
View Full Code Here


    assertFalse( validator.isValid( "1234557X", null ) );
  }

  @Test
  public void testValidMod11ReverseOrder() throws Exception {
    Mod11CheckValidator validator = new Mod11CheckValidator();
    Mod11Check modCheck = createMod11CheckAnnotation(
        0,
        Integer.MAX_VALUE,
        -1,
        false,
        'X',
        'Z',
        ProcessingDirection.LEFT_TO_RIGHT
    );
    validator.initialize( modCheck );

    assertTrue( validator.isValid( "059697873Z", null ) );
    assertTrue( validator.isValid( "5754321X", null ) );
  }
View Full Code Here

    assertTrue( validator.isValid( "5754321X", null ) );
  }

  @Test
  public void testInvalidMod11ReverseOrder() throws Exception {
    Mod11CheckValidator validator = new Mod11CheckValidator();
    Mod11Check modCheck = createMod11CheckAnnotation(
        0,
        Integer.MAX_VALUE,
        -1,
        false,
        'X',
        'Z',
        ProcessingDirection.LEFT_TO_RIGHT
    );
    validator.initialize( modCheck );

    assertFalse( validator.isValid( "378796950Z", null ) );
    assertFalse( validator.isValid( "1234557X", null ) );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.validator.internal.constraintvalidators.hv.Mod11CheckValidator

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.