package uk.ac.ebi.quickgo.annotation.model;

import uk.ac.ebi.quickgo.common.validator.GeneProductDbXRefIDFormat;
import uk.ac.ebi.quickgo.common.validator.GeneProductDbXRefIDFormats;

import java.util.ArrayList;
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.validation.Validator;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;

/**
 * @author Tony Wardell
 * Date: 29/06/2016
 * Time: 14:24
 * Created with IntelliJ IDEA.
 */
public class AnnotationRequestConfig {
    private static final String EXAMPLE_REGEX="([OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z]([0-9][A-Z][A-Z0-9]{2}){1,2}[0-9])" +
            "((-[0-9]+)|:PRO_[0-9]{10}|:VAR_[0-9]{6}){0,1}";

    public AnnotationRequestConfig() {}

    @Bean
    public GeneProductDbXRefIDFormats geneProductValidator() {

        List<GeneProductDbXRefIDFormat> entities = new ArrayList<>();
        GeneProductDbXRefIDFormat entity1 = new GeneProductDbXRefIDFormat("UniProtKB", "PR:000000001", "protein",
                EXAMPLE_REGEX, "http://www.uniprot.org/uniprot/[example_id]/");
        entities.add(entity1);

        GeneProductDbXRefIDFormats
                dbXrefEntities = GeneProductDbXRefIDFormats.createWithData(entities);

        return dbXrefEntities;
    }


    @Bean
    public Validator validator(){
        return new LocalValidatorFactoryBean();
    }

}

@@ -463,16 +463,139 @@
 n;%0A%0A/**%0A
+ * Configuration class mimics %7B@link uk.ac.ebi.quickgo.annotation.service.search.SearchServiceConfig%7D used for testing.%0A *%0A
  * @auth
@@ -943,16 +943,193 @@
 g() %7B%7D%0A%0A
+    /**%0A     * Create test validator%0A     * @return A hardcoded example of a GeneProductDbXRefIDFormats containing a validating regular expression for%0A     * UniProtKB.%0A     */%0A
     @Bea
@@ -1502,160 +1502,173 @@
     
-GeneProductDbXRefIDFormats%0A                dbXrefEntities = GeneProductDbXRefIDFormats.createWithData(entities);%0A%0A        return dbXrefEntities;
+return GeneProductDbXRefIDFormats.createWithData(entities);%0A    %7D%0A%0A    /**%0A     *%0A     * @return instance used to run validation against the validated class.
 %0A    
-%7D%0A%0A
+ */
 %0A   

Add javadoc.