Search in sources :

Example 36 with ValidationError

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

the class ErrorCreationServiceTest method testCheckRiskAlleleSynthax.

@Test
public void testCheckRiskAlleleSynthax() throws Exception {
    when(validationChecks.checkSynthax("rsTEST-? x rs123-A", ";")).thenReturn("Value does not contain correct separator");
    ValidationError error1 = errorCreationService.checkRiskAlleleSynthax("rsTEST-? x rs123-A", ";");
    assertThat(error1).extracting("field", "error", "warning").contains("Risk Allele", "Value does not contain correct separator", false);
    when(validationChecks.checkSynthax("rs2981579; rs123", ";")).thenReturn(null);
    ValidationError error2 = errorCreationService.checkRiskAlleleSynthax("rs2981579; rs123", ";");
    assertThat(error2).extracting("field", "error", "warning").contains(null, null, false);
}
Also used : ValidationError(uk.ac.ebi.spot.goci.model.ValidationError) Test(org.junit.Test)

Example 37 with ValidationError

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

the class ErrorCreationServiceTest method testCheckSnpGeneLocation.

@Test
public void testCheckSnpGeneLocation() throws Exception {
    when(validationChecks.checkSnpGeneLocation("rsTEST", "TEST", "")).thenReturn("Gene TEST and SNP rsTEST are not on the same chromosome");
    ValidationError error1 = errorCreationService.checkSnpGeneLocation("rsTEST", "TEST", "");
    assertThat(error1).extracting("field", "error", "warning").contains("Gene", "Gene TEST and SNP rsTEST are not on the same chromosome", true);
    when(validationChecks.checkSnpGeneLocation("rs2981579", "FGFR2", "")).thenReturn(null);
    ValidationError error2 = errorCreationService.checkSnpGeneLocation("rs2981579", "FGFR2", "");
    assertThat(error2).extracting("field", "error", "warning").contains(null, null, false);
    when(validationChecks.checkSnpGeneLocation("rs99", "FGFR2", "")).thenReturn("SNP rs99 has no location details, cannot check if gene is on same chromosome as SNP");
    ValidationError error3 = errorCreationService.checkSnpGeneLocation("rs99", "FGFR2", "");
    assertThat(error3).extracting("field", "error", "warning").contains("SNP", "SNP rs99 has no location details, cannot check if gene is on same chromosome as SNP", true);
}
Also used : ValidationError(uk.ac.ebi.spot.goci.model.ValidationError) Test(org.junit.Test)

Example 38 with ValidationError

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

the class ErrorCreationServiceTest method testCheckSnpValueIsPresent.

@Test
public void testCheckSnpValueIsPresent() throws Exception {
    when(validationChecks.checkValueIsPresent("")).thenReturn("Value is empty");
    ValidationError error1 = errorCreationService.checkSnpValueIsPresent("");
    assertThat(error1).extracting("field", "error", "warning").contains("SNP", "Value is empty", false);
    when(validationChecks.checkValueIsPresent("rs123")).thenReturn(null);
    ValidationError error2 = errorCreationService.checkSnpValueIsPresent("rs123");
    assertThat(error2).extracting("field", "error", "warning").contains(null, null, false);
}
Also used : ValidationError(uk.ac.ebi.spot.goci.model.ValidationError) Test(org.junit.Test)

Example 39 with ValidationError

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

the class ErrorCreationServiceTest method testCheckOrRecipIsPresentAndLessThanOne.

@Test
public void testCheckOrRecipIsPresentAndLessThanOne() throws Exception {
    when(validationChecks.checkOrRecipIsPresentAndLessThanOne((float) 10.23)).thenReturn("Value is more than 1");
    ValidationError error1 = errorCreationService.checkOrRecipIsPresentAndLessThanOne((float) 10.23);
    assertThat(error1).extracting("field", "error", "warning").contains("OR reciprocal", "Value is more than 1", false);
    when(validationChecks.checkOrRecipIsPresentAndLessThanOne((float) 0.5)).thenReturn(null);
    ValidationError error2 = errorCreationService.checkOrRecipIsPresentAndLessThanOne((float) 0.5);
    assertThat(error2).extracting("field", "error", "warning").contains(null, null, false);
}
Also used : ValidationError(uk.ac.ebi.spot.goci.model.ValidationError) Test(org.junit.Test)

Example 40 with ValidationError

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

the class ErrorCreationServiceTest method testCheckBetaUnitIsEmpty.

@Test
public void testCheckBetaUnitIsEmpty() throws Exception {
    when(validationChecks.checkValueIsEmpty(Matchers.anyString())).thenReturn("Value is not empty");
    ValidationError error1 = errorCreationService.checkBetaUnitIsEmpty(Matchers.anyString());
    assertThat(error1).extracting("field", "error", "warning").contains("Beta Unit", "Value is not empty", false);
    when(validationChecks.checkValueIsEmpty("")).thenReturn(null);
    ValidationError error2 = errorCreationService.checkBetaUnitIsEmpty("");
    assertThat(error2).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