package org.innovateuk.ifs.validator;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.innovateuk.ifs.form.domain.FormInputResponse;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;

import static org.innovateuk.ifs.commons.rest.ValidationMessages.rejectValue;

/**
 * This class validates the FormInputResponse, it checks that if the response is for scope then that field is not empty
 *
 */
@Component
public class AssessorScopeValidator extends BaseValidator {
    private static final Log LOG = LogFactory.getLog(AssessorScopeValidator.class);

    @Override
    public void validate(Object target, Errors errors) {
        FormInputResponse response = (FormInputResponse) target;

        if (response.getValue().equals("none")) {
            rejectValue(errors, "value", "validation.assessor.scope.invalidScope", response.getFormInput().getId());
        }
    }
}

@@ -347,16 +347,108 @@
 ctValue;
+%0Aimport static org.innovateuk.ifs.form.resource.FormInputType.ASSESSOR_APPLICATION_IN_SCOPE;
 %0A%0A/**%0A *
@@ -646,92 +646,8 @@
 or %7B
-%0A    private static final Log LOG = LogFactory.getLog(AssessorScopeValidator.class);
 %0A%0A  
@@ -797,46 +797,197 @@
 if (
-response.getValue().equals(%22non
+ASSESSOR_APPLICATION_IN_SCOPE == response.getFormInput().getType()) %7B%0A            String value = response.getValue();%0A            if (!value.equals(%22true%22) && !value.equals(%22fals
 e%22)) %7B%0A
+    
     
@@ -1099,16 +1099,30 @@
 tId());%0A
+            %7D%0A
         

Tidy up validator