Search in sources :

Example 46 with ValidationError

use of uk.ac.ebi.spot.goci.model.ValidationError in project goci by EBISPOT.

the class ErrorCreationServiceTest method testCheckAlleleRiskFrequency.

@Test
public void testCheckAlleleRiskFrequency() throws Exception {
    when(validationChecks.checkRiskFrequency("10")).thenReturn("Value is invalid, value is not between 0 and 1");
    ValidationError error1 = errorCreationService.checkAlleleRiskFrequency("10");
    assertThat(error1).extracting("field", "error", "warning").contains("Independent SNP risk allele frequency in controls", "Value is invalid, value is not between 0 and 1", true);
    when(validationChecks.checkRiskFrequency("")).thenReturn("Value is empty");
    ValidationError error2 = errorCreationService.checkAlleleRiskFrequency("");
    assertThat(error2).extracting("field", "error", "warning").contains("Independent SNP risk allele frequency in controls", "Value is empty", true);
    when(validationChecks.checkRiskFrequency("0.78")).thenReturn(null);
    ValidationError error3 = errorCreationService.checkAlleleRiskFrequency("0.78");
    assertThat(error3).extracting("field", "error", "warning").contains(null, null, false);
}
Also used : ValidationError(uk.ac.ebi.spot.goci.model.ValidationError) Test(org.junit.Test)

Aggregations

ValidationError (uk.ac.ebi.spot.goci.model.ValidationError)46 Test (org.junit.Test)32 ArrayList (java.util.ArrayList)11 Locus (uk.ac.ebi.spot.goci.model.Locus)3 Association (uk.ac.ebi.spot.goci.model.Association)2 AssociationSummary (uk.ac.ebi.spot.goci.model.AssociationSummary)2 RowValidationSummary (uk.ac.ebi.spot.goci.model.RowValidationSummary)2 File (java.io.File)1 IOException (java.io.IOException)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 XSSFCell (org.apache.poi.xssf.usermodel.XSSFCell)1 XSSFRow (org.apache.poi.xssf.usermodel.XSSFRow)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1