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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations