@Test @Disabled("TODO") public void testValidate() throws Exception { System.out.println("validate"); TextInputControl control = null; FXString annotation = null; StringValidator instance = new StringValidator(); instance.validate(control, annotation); fail("The test case is a prototype."); }
@Override public void validate(TextInputControl control, FXString annotation) throws ValidationException { if (control.isDisabled()) { this.isValid.set(true); return; } if (!control.isVisible()) { this.isValid.set(true); return; } boolean valid = true; if (annotation.minLength() > 0) { valid = valid && control.getText().length() >= annotation.minLength(); this.isValid.set(valid); if (!valid) { String msg = annotation.messageMinLength(); if (annotation.messageMinLength().contains("%d")) { msg = String.format(annotation.messageMinLength(), annotation.minLength()); } throw new ValidationException(msg); } } if (annotation.maxLength() > 0) { valid = valid && control.getText().length() <= annotation.maxLength(); this.isValid.set(valid); if (!valid) { String msg = annotation.messageMaxLength(); if (annotation.messageMaxLength().contains("%d")) { msg = String.format(annotation.messageMaxLength(), annotation.maxLength()); } throw new ValidationException(msg); } } if (annotation.pattern().length() > 0) { if (this.pattern == null) { this.createRegex(annotation); } valid = valid && this.pattern.matcher(control.getText()).matches(); this.isValid.set(valid); if (!valid) { String msg = annotation.messagePattern(); throw new ValidationException(msg); } } }
StringValidator extends FXAbstractValidator<TextInputControl, FXString> { @Override public void validate(TextInputControl control, FXString annotation) throws ValidationException { if (control.isDisabled()) { this.isValid.set(true); return; } if (!control.isVisible()) { this.isValid.set(true); return; } boolean valid = true; if (annotation.minLength() > 0) { valid = valid && control.getText().length() >= annotation.minLength(); this.isValid.set(valid); if (!valid) { String msg = annotation.messageMinLength(); if (annotation.messageMinLength().contains("%d")) { msg = String.format(annotation.messageMinLength(), annotation.minLength()); } throw new ValidationException(msg); } } if (annotation.maxLength() > 0) { valid = valid && control.getText().length() <= annotation.maxLength(); this.isValid.set(valid); if (!valid) { String msg = annotation.messageMaxLength(); if (annotation.messageMaxLength().contains("%d")) { msg = String.format(annotation.messageMaxLength(), annotation.maxLength()); } throw new ValidationException(msg); } } if (annotation.pattern().length() > 0) { if (this.pattern == null) { this.createRegex(annotation); } valid = valid && this.pattern.matcher(control.getText()).matches(); this.isValid.set(valid); if (!valid) { String msg = annotation.messagePattern(); throw new ValidationException(msg); } } } }
StringValidator extends FXAbstractValidator<TextInputControl, FXString> { @Override public void validate(TextInputControl control, FXString annotation) throws ValidationException { if (control.isDisabled()) { this.isValid.set(true); return; } if (!control.isVisible()) { this.isValid.set(true); return; } boolean valid = true; if (annotation.minLength() > 0) { valid = valid && control.getText().length() >= annotation.minLength(); this.isValid.set(valid); if (!valid) { String msg = annotation.messageMinLength(); if (annotation.messageMinLength().contains("%d")) { msg = String.format(annotation.messageMinLength(), annotation.minLength()); } throw new ValidationException(msg); } } if (annotation.maxLength() > 0) { valid = valid && control.getText().length() <= annotation.maxLength(); this.isValid.set(valid); if (!valid) { String msg = annotation.messageMaxLength(); if (annotation.messageMaxLength().contains("%d")) { msg = String.format(annotation.messageMaxLength(), annotation.maxLength()); } throw new ValidationException(msg); } } if (annotation.pattern().length() > 0) { if (this.pattern == null) { this.createRegex(annotation); } valid = valid && this.pattern.matcher(control.getText()).matches(); this.isValid.set(valid); if (!valid) { String msg = annotation.messagePattern(); throw new ValidationException(msg); } } } StringValidator();  StringValidator(TextInputControl control, FXString annotation); }
StringValidator extends FXAbstractValidator<TextInputControl, FXString> { @Override public void validate(TextInputControl control, FXString annotation) throws ValidationException { if (control.isDisabled()) { this.isValid.set(true); return; } if (!control.isVisible()) { this.isValid.set(true); return; } boolean valid = true; if (annotation.minLength() > 0) { valid = valid && control.getText().length() >= annotation.minLength(); this.isValid.set(valid); if (!valid) { String msg = annotation.messageMinLength(); if (annotation.messageMinLength().contains("%d")) { msg = String.format(annotation.messageMinLength(), annotation.minLength()); } throw new ValidationException(msg); } } if (annotation.maxLength() > 0) { valid = valid && control.getText().length() <= annotation.maxLength(); this.isValid.set(valid); if (!valid) { String msg = annotation.messageMaxLength(); if (annotation.messageMaxLength().contains("%d")) { msg = String.format(annotation.messageMaxLength(), annotation.maxLength()); } throw new ValidationException(msg); } } if (annotation.pattern().length() > 0) { if (this.pattern == null) { this.createRegex(annotation); } valid = valid && this.pattern.matcher(control.getText()).matches(); this.isValid.set(valid); if (!valid) { String msg = annotation.messagePattern(); throw new ValidationException(msg); } } } StringValidator();  StringValidator(TextInputControl control, FXString annotation); @Override void validate(TextInputControl control, FXString annotation); }
StringValidator extends FXAbstractValidator<TextInputControl, FXString> { @Override public void validate(TextInputControl control, FXString annotation) throws ValidationException { if (control.isDisabled()) { this.isValid.set(true); return; } if (!control.isVisible()) { this.isValid.set(true); return; } boolean valid = true; if (annotation.minLength() > 0) { valid = valid && control.getText().length() >= annotation.minLength(); this.isValid.set(valid); if (!valid) { String msg = annotation.messageMinLength(); if (annotation.messageMinLength().contains("%d")) { msg = String.format(annotation.messageMinLength(), annotation.minLength()); } throw new ValidationException(msg); } } if (annotation.maxLength() > 0) { valid = valid && control.getText().length() <= annotation.maxLength(); this.isValid.set(valid); if (!valid) { String msg = annotation.messageMaxLength(); if (annotation.messageMaxLength().contains("%d")) { msg = String.format(annotation.messageMaxLength(), annotation.maxLength()); } throw new ValidationException(msg); } } if (annotation.pattern().length() > 0) { if (this.pattern == null) { this.createRegex(annotation); } valid = valid && this.pattern.matcher(control.getText()).matches(); this.isValid.set(valid); if (!valid) { String msg = annotation.messagePattern(); throw new ValidationException(msg); } } } StringValidator();  StringValidator(TextInputControl control, FXString annotation); @Override void validate(TextInputControl control, FXString annotation);  }