@Test
 public void shouldValidateValidFormattedNIT() {
   NITValidator validator = new NITValidator(true);
   // VALID NIT = 123.45678.91-9
   String value = "123.45678.91-9";
   validator.assertValid(value);
 }
  @Test
  public void shouldValidateValidNIT() {
    NITValidator validator = new NITValidator();

    validator.assertValid("12345678919");
    validator.assertValid("34608514300");
    validator.assertValid("47393545608");
  }
 @Test
 public void shouldNotValidateNITWithMoreDigitsThanAlowed() {
   NITValidator validator = new NITValidator();
   String value = "123456789012";
   try {
     validator.assertValid(value);
     fail();
   } catch (InvalidStateException e) {
     assertTrue(e.getInvalidMessages().size() == 1);
     assertMessage(e, INVALID_DIGITS);
   }
 }
 @Test
 public void shouldNotValidateNITWithInvalidCharacter() {
   NITValidator validator = new NITValidator();
   String value = "1111111a111";
   try {
     validator.assertValid(value);
     fail();
   } catch (InvalidStateException e) {
     assertTrue(e.getInvalidMessages().size() == 1);
     assertMessage(e, INVALID_DIGITS);
   }
 }
 @Test
 public void shouldNotValidateValidUnformattedNIT() {
   NITValidator validator = new NITValidator(true);
   // VALID NIT = 12.34567.891-9
   String value = "12345678919";
   try {
     validator.assertValid(value);
     fail();
   } catch (InvalidStateException e) {
     assertTrue(e.getInvalidMessages().size() == 1);
     assertMessage(e, INVALID_FORMAT);
   }
 }
 @Test
 public void shouldNotValidateNITCheckDigitsWithCheckDigitWrong() {
   NITValidator validator = new NITValidator();
   // VALID NIT = 24.84380.348-0
   String value = "24843803470";
   try {
     validator.assertValid(value);
     fail();
   } catch (InvalidStateException e) {
     assertTrue(e.getInvalidMessages().size() == 1);
     assertMessage(e, INVALID_CHECK_DIGITS);
   }
 }
 @Test
 public void shouldValidateNullNIT() {
   NITValidator validator = new NITValidator();
   String value = null;
   validator.assertValid(value);
 }