AbstractValidationErrorHandler implements
                                                    ValidationErrorHandler { @Override public ValidateErrorStatus handleValidationError( DataValueObject dataValueObject, Errors errors) { errorFieldCount++; if (errors != null) { errorsQueue.add(errors); } outputLog(dataValueObject, errors); return getValidateStatus(dataValueObject, errors); } AbstractValidationErrorHandler();  AbstractValidationErrorHandler(ValidationErrorLoglevel logLevel); @Override ValidateErrorStatus handleValidationError(
            DataValueObject dataValueObject, Errors errors); static List<FieldError> getFieldErrorList(Errors errors); int getErrorFieldCount(); Errors[] getErrors(); void setLogLevel(ValidationErrorLoglevel logLevel);  }
@Test public void testHandleValidationError001() { AbstractValidationErrorHandler handler = new AbstractValidationErrorHandler( ValidationErrorLoglevel.DEBUG) { @Override protected ValidateErrorStatus getValidateStatus( DataValueObject dataValueObject, Errors errors) { return null; } }; DataValueObject dataValueObject = null; Errors errors = null; handler.handleValidationError(dataValueObject, errors); assertNotNull(handler); assertEquals(ValidationErrorLoglevel.DEBUG, handler.logLevel); }
@Test public void testHandleValidationError002() { AbstractValidationErrorHandler handler = new AbstractValidationErrorHandler( ValidationErrorLoglevel.DEBUG) { @Override protected ValidateErrorStatus getValidateStatus( DataValueObject dataValueObject, Errors errors) { return ValidateErrorStatus.SKIP; } }; DataValueObject dataValueObject = new DataValueObject((Object) null); HogeBean value = new HogeBean(); String objectName = "object"; Errors errors = new BindException(value, objectName); ValidationUtils.rejectIfEmpty(errors, "hoge", "error.hoge"); ValidateErrorStatus status = handler.handleValidationError( dataValueObject, errors); assertNotNull(handler); assertEquals(ValidationErrorLoglevel.DEBUG, handler.logLevel); assertEquals(ValidateErrorStatus.SKIP, status); }
@Test public void testHandleValidationError003() { AbstractValidationErrorHandler handler = new AbstractValidationErrorHandler( ValidationErrorLoglevel.INFO) { @Override protected ValidateErrorStatus getValidateStatus( DataValueObject dataValueObject, Errors errors) { return ValidateErrorStatus.SKIP; } }; DataValueObject dataValueObject = new DataValueObject((Object) null); HogeBean value = new HogeBean(); String objectName = "object"; Errors errors = new BindException(value, objectName); ValidationUtils.rejectIfEmpty(errors, "hoge", "error.hoge"); ValidateErrorStatus status = handler.handleValidationError( dataValueObject, errors); assertNotNull(handler); assertEquals(ValidationErrorLoglevel.INFO, handler.logLevel); assertEquals(ValidateErrorStatus.SKIP, status); }
@Test public void testHandleValidationError004() { AbstractValidationErrorHandler handler = new AbstractValidationErrorHandler( ValidationErrorLoglevel.TRACE) { @Override protected ValidateErrorStatus getValidateStatus( DataValueObject dataValueObject, Errors errors) { return ValidateErrorStatus.SKIP; } }; DataValueObject dataValueObject = new DataValueObject((Object) null); HogeBean value = new HogeBean(); String objectName = "object"; Errors errors = new BindException(value, objectName); ValidationUtils.rejectIfEmpty(errors, "hoge", "error.hoge"); ValidateErrorStatus status = handler.handleValidationError( dataValueObject, errors); assertNotNull(handler); assertEquals(ValidationErrorLoglevel.TRACE, handler.logLevel); assertEquals(ValidateErrorStatus.SKIP, status); }
@Test public void testHandleValidationError005() { AbstractValidationErrorHandler handler = new AbstractValidationErrorHandler( ValidationErrorLoglevel.WARN) { @Override protected ValidateErrorStatus getValidateStatus( DataValueObject dataValueObject, Errors errors) { return ValidateErrorStatus.SKIP; } }; DataValueObject dataValueObject = new DataValueObject((Object) null); HogeBean value = new HogeBean(); String objectName = "object"; Errors errors = new BindException(value, objectName); ValidationUtils.rejectIfEmpty(errors, "hoge", "error.hoge"); ValidateErrorStatus status = handler.handleValidationError( dataValueObject, errors); assertNotNull(handler); assertEquals(ValidationErrorLoglevel.WARN, handler.logLevel); assertEquals(ValidateErrorStatus.SKIP, status); }
@Test public void testHandleValidationError006() { AbstractValidationErrorHandler handler = new AbstractValidationErrorHandler( ValidationErrorLoglevel.ERROR) { @Override protected ValidateErrorStatus getValidateStatus( DataValueObject dataValueObject, Errors errors) { return ValidateErrorStatus.SKIP; } }; DataValueObject dataValueObject = new DataValueObject((Object) null); HogeBean value = new HogeBean(); String objectName = "object"; Errors errors = new BindException(value, objectName); ValidationUtils.rejectIfEmpty(errors, "hoge", "error.hoge"); ValidateErrorStatus status = handler.handleValidationError( dataValueObject, errors); assertNotNull(handler); assertEquals(ValidationErrorLoglevel.ERROR, handler.logLevel); assertEquals(ValidateErrorStatus.SKIP, status); }
@Test public void testHandleValidationError007() { AbstractValidationErrorHandler handler = new AbstractValidationErrorHandler( ValidationErrorLoglevel.FATAL) { @Override protected ValidateErrorStatus getValidateStatus( DataValueObject dataValueObject, Errors errors) { return ValidateErrorStatus.SKIP; } }; DataValueObject dataValueObject = new DataValueObject((Object) null); HogeBean value = new HogeBean(); String objectName = "object"; Errors errors = new BindException(value, objectName); ValidationUtils.rejectIfEmpty(errors, "hoge", "error.hoge"); ValidateErrorStatus status = handler.handleValidationError( dataValueObject, errors); assertNotNull(handler); assertEquals(ValidationErrorLoglevel.FATAL, handler.logLevel); assertEquals(ValidateErrorStatus.SKIP, status); }
@Test public void testHandleValidationError008() { AbstractValidationErrorHandler handler = new AbstractValidationErrorHandler( null) { @Override protected ValidateErrorStatus getValidateStatus( DataValueObject dataValueObject, Errors errors) { return ValidateErrorStatus.SKIP; } }; DataValueObject dataValueObject = new DataValueObject((Object) null); HogeBean value = new HogeBean(); String objectName = "object"; Errors errors = new BindException(value, objectName); ValidationUtils.rejectIfEmpty(errors, "hoge", "error.hoge"); ValidateErrorStatus status = handler.handleValidationError( dataValueObject, errors); assertNotNull(handler); assertEquals(null, handler.logLevel); assertEquals(ValidateErrorStatus.SKIP, status); }