@Test public void test_validate_all_properties_with_no_errors() throws Exception { errors = new MapBindingResult(new HashMap<>(), "OrgEnrollmentConfig"); when(request.getIdleDuration()).thenReturn("PT2M"); when(request.getExcludeSpacesFromAutoEnrollment()).thenReturn(".*correct_space"); when(request.getAutoEnrollment()).thenReturn("standard"); when(request.getState()).thenReturn("backoffice_enrolled"); enrollmentValidator.validate(request, errors); assertTrue(errors.getErrorCount() == 0); }
public void validate(Object target, Errors errors) { OrgEnrollmentConfigRequest orgEnrollmentConfig = (OrgEnrollmentConfigRequest) target; consumeParameter("idleDuration", orgEnrollmentConfig.getIdleDuration(), false, idleDurationReader, errors); consumeParameter("excludeSpacesFromAutoEnrollment", orgEnrollmentConfig.getExcludeSpacesFromAutoEnrollment(), false, excludeFromAutoEnrollmentReader, errors); consumeParameter("autoEnrollment", orgEnrollmentConfig.getAutoEnrollment(), false, autoEnrollmentReader, errors); consumeParameter("state", orgEnrollmentConfig.getState(), false, stateReader, errors); }
EnrollmentValidator implements Validator { public void validate(Object target, Errors errors) { OrgEnrollmentConfigRequest orgEnrollmentConfig = (OrgEnrollmentConfigRequest) target; consumeParameter("idleDuration", orgEnrollmentConfig.getIdleDuration(), false, idleDurationReader, errors); consumeParameter("excludeSpacesFromAutoEnrollment", orgEnrollmentConfig.getExcludeSpacesFromAutoEnrollment(), false, excludeFromAutoEnrollmentReader, errors); consumeParameter("autoEnrollment", orgEnrollmentConfig.getAutoEnrollment(), false, autoEnrollmentReader, errors); consumeParameter("state", orgEnrollmentConfig.getState(), false, stateReader, errors); } }
EnrollmentValidator implements Validator { public void validate(Object target, Errors errors) { OrgEnrollmentConfigRequest orgEnrollmentConfig = (OrgEnrollmentConfigRequest) target; consumeParameter("idleDuration", orgEnrollmentConfig.getIdleDuration(), false, idleDurationReader, errors); consumeParameter("excludeSpacesFromAutoEnrollment", orgEnrollmentConfig.getExcludeSpacesFromAutoEnrollment(), false, excludeFromAutoEnrollmentReader, errors); consumeParameter("autoEnrollment", orgEnrollmentConfig.getAutoEnrollment(), false, autoEnrollmentReader, errors); consumeParameter("state", orgEnrollmentConfig.getState(), false, stateReader, errors); }  }
EnrollmentValidator implements Validator { public void validate(Object target, Errors errors) { OrgEnrollmentConfigRequest orgEnrollmentConfig = (OrgEnrollmentConfigRequest) target; consumeParameter("idleDuration", orgEnrollmentConfig.getIdleDuration(), false, idleDurationReader, errors); consumeParameter("excludeSpacesFromAutoEnrollment", orgEnrollmentConfig.getExcludeSpacesFromAutoEnrollment(), false, excludeFromAutoEnrollmentReader, errors); consumeParameter("autoEnrollment", orgEnrollmentConfig.getAutoEnrollment(), false, autoEnrollmentReader, errors); consumeParameter("state", orgEnrollmentConfig.getState(), false, stateReader, errors); }  boolean supports(Class<?> clazz); void validate(Object target, Errors errors); }
EnrollmentValidator implements Validator { public void validate(Object target, Errors errors) { OrgEnrollmentConfigRequest orgEnrollmentConfig = (OrgEnrollmentConfigRequest) target; consumeParameter("idleDuration", orgEnrollmentConfig.getIdleDuration(), false, idleDurationReader, errors); consumeParameter("excludeSpacesFromAutoEnrollment", orgEnrollmentConfig.getExcludeSpacesFromAutoEnrollment(), false, excludeFromAutoEnrollmentReader, errors); consumeParameter("autoEnrollment", orgEnrollmentConfig.getAutoEnrollment(), false, autoEnrollmentReader, errors); consumeParameter("state", orgEnrollmentConfig.getState(), false, stateReader, errors); }  boolean supports(Class<?> clazz); void validate(Object target, Errors errors);  }