Search in sources :

Example 41 with ValidationError

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

the class ErrorCreationServiceTest method testCheckSnpSynthax.

@Test
public void testCheckSnpSynthax() throws Exception {
    when(validationChecks.checkSynthax("rsTEST x rs123", ";")).thenReturn("Value does not contain correct separator");
    ValidationError error1 = errorCreationService.checkSnpSynthax("rsTEST x rs123", ";");
    assertThat(error1).extracting("field", "error", "warning").contains("SNP", "Value does not contain correct separator", false);
    when(validationChecks.checkSynthax("rs2981579; rs123", ";")).thenReturn(null);
    ValidationError error2 = errorCreationService.checkSnpSynthax("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 42 with ValidationError

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

the class ErrorCreationServiceTest method testCheckSnpStatusIsPresent.

@Test
public void testCheckSnpStatusIsPresent() throws Exception {
    when(validationChecks.checkSnpStatus(false, false)).thenReturn("No status selected");
    ValidationError error1 = errorCreationService.checkSnpStatusIsPresent(false, false);
    assertThat(error1).extracting("field", "error", "warning").contains("SNP Status", "No status selected", true);
    when(validationChecks.checkSnpStatus(true, true)).thenReturn(null);
    ValidationError error2 = errorCreationService.checkSnpStatusIsPresent(true, true);
    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 43 with ValidationError

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

the class ErrorCreationServiceTest method testCheckBetaUnitIsPresent.

@Test
public void testCheckBetaUnitIsPresent() throws Exception {
    when(validationChecks.checkValueIsPresent("")).thenReturn("Value is empty");
    ValidationError error1 = errorCreationService.checkBetaUnitIsPresent("");
    assertThat(error1).extracting("field", "error", "warning").contains("Beta Unit", "Value is empty", false);
    when(validationChecks.checkValueIsPresent("cm")).thenReturn(null);
    ValidationError error2 = errorCreationService.checkBetaUnitIsPresent("cm");
    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 44 with ValidationError

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

the class ErrorCreationServiceTest method testCheckBetaIsPresentAndIsNotNegative.

@Test
public void testCheckBetaIsPresentAndIsNotNegative() throws Exception {
    when(validationChecks.checkBetaIsPresentAndIsNotNegative((float) -0.8)).thenReturn("Value is less than 0");
    ValidationError error1 = errorCreationService.checkBetaIsPresentAndIsNotNegative((float) -0.8);
    assertThat(error1).extracting("field", "error", "warning").contains("Beta", "Value is less than 0", false);
    when(validationChecks.checkBetaIsPresentAndIsNotNegative((float) 0.6)).thenReturn(null);
    ValidationError error2 = errorCreationService.checkBetaIsPresentAndIsNotNegative((float) 0.6);
    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 45 with ValidationError

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

the class ErrorCreationServiceTest method testCheckExponentIsPresent.

@Test
public void testCheckExponentIsPresent() throws Exception {
    when(validationChecks.checkExponentIsPresentAndNegative(null)).thenReturn("Value is empty");
    ValidationError error1 = errorCreationService.checkExponentIsPresentAndNegative(null);
    assertThat(error1).extracting("field", "error", "warning").contains("P-value exponent", "Value is empty", false);
    when(validationChecks.checkExponentIsPresentAndNegative(-8)).thenReturn(null);
    ValidationError error2 = errorCreationService.checkExponentIsPresentAndNegative(Matchers.anyInt());
    assertThat(error2).extracting("field", "error", "warning").contains(null, null, false);
    when(validationChecks.checkExponentIsPresentAndNegative(10)).thenReturn("Value is greater than or equal to zero");
    ValidationError error3 = errorCreationService.checkExponentIsPresentAndNegative(10);
    assertThat(error3).extracting("field", "error", "warning").contains("P-value exponent", "Value is greater than or equal to zero", 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