Search in sources :

Example 31 with ValidationError

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

the class ErrorCreationServiceTest method testCheckRangeIsPresent.

@Test
public void testCheckRangeIsPresent() throws Exception {
    when(validationChecks.checkValueIsPresent("")).thenReturn("Value is empty");
    ValidationError error1 = errorCreationService.checkRangeIsPresent("");
    assertThat(error1).extracting("field", "error", "warning").contains("Range", "Value is empty", true);
    when(validationChecks.checkValueIsPresent(Matchers.anyString())).thenReturn(null);
    ValidationError error2 = errorCreationService.checkRangeIsPresent(Matchers.anyString());
    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 32 with ValidationError

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

the class ErrorCreationServiceTest method testCheckOrPerCopyRecipRangeIsEmpty.

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

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

the class ErrorCreationServiceTest method testCheckOrPerCopyRecipRangeIsPresent.

@Test
public void testCheckOrPerCopyRecipRangeIsPresent() throws Exception {
    when(validationChecks.checkValueIsPresent("")).thenReturn("Value is empty");
    ValidationError error1 = errorCreationService.checkOrPerCopyRecipRangeIsPresent("");
    assertThat(error1).extracting("field", "error", "warning").contains("OR reciprocal range", "Value is empty", true);
    when(validationChecks.checkValueIsPresent(Matchers.anyString())).thenReturn(null);
    ValidationError error2 = errorCreationService.checkAlleleRiskFrequency(Matchers.anyString());
    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 34 with ValidationError

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

the class ErrorCreationServiceTest method testCheckOrRecipEmpty.

@Test
public void testCheckOrRecipEmpty() throws Exception {
    when(validationChecks.checkValueIsEmpty(Matchers.anyFloat())).thenReturn("Value is not empty");
    ValidationError error1 = errorCreationService.checkOrRecipEmpty(Matchers.anyFloat());
    assertThat(error1).extracting("field", "error", "warning").contains("OR reciprocal", "Value is not empty", false);
    Float nullValue = null;
    when(validationChecks.checkValueIsEmpty(nullValue)).thenReturn(null);
    ValidationError error2 = errorCreationService.checkOrRecipEmpty(nullValue);
    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 35 with ValidationError

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

the class ErrorCreationServiceTest method testCheckStandardErrorIsEmpty.

@Test
public void testCheckStandardErrorIsEmpty() throws Exception {
    when(validationChecks.checkValueIsEmpty(Matchers.anyFloat())).thenReturn("Value is not empty");
    ValidationError error1 = errorCreationService.checkStandardErrorIsEmpty(Matchers.anyFloat());
    assertThat(error1).extracting("field", "error", "warning").contains("Standard Error", "Value is not empty", false);
    Float nullNum = null;
    when(validationChecks.checkValueIsEmpty(nullNum)).thenReturn(null);
    ValidationError error2 = errorCreationService.checkStandardErrorIsEmpty(nullNum);
    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