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