use of uk.ac.ebi.spot.goci.model.ValidationError in project goci by EBISPOT.
the class ErrorCreationServiceTest method testCheckGeneSynthax.
@Test
public void testCheckGeneSynthax() throws Exception {
when(validationChecks.checkSynthax("SFRP1 x SFRP2", ";")).thenReturn("Value does not contain correct separator");
ValidationError error1 = errorCreationService.checkGeneSynthax("SFRP1 x SFRP2", ";");
assertThat(error1).extracting("field", "error", "warning").contains("Gene", "Value does not contain correct separator", false);
when(validationChecks.checkSynthax("rs2981579; rs123", ";")).thenReturn(null);
ValidationError error2 = errorCreationService.checkGeneSynthax("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 testCheckOrIsPresent.
@Test
public void testCheckOrIsPresent() throws Exception {
when(validationChecks.checkOrIsPresent(null)).thenReturn("Value is empty");
ValidationError error1 = errorCreationService.checkOrIsPresent((null));
assertThat(error1).extracting("field", "error", "warning").contains("OR", "Value is empty", false);
when(validationChecks.checkOrIsPresent((float) 1.23)).thenReturn(null);
ValidationError error2 = errorCreationService.checkOrIsPresent((float) 1.23);
assertThat(error2).extracting("field", "error", "warning").contains(null, null, false);
Float f1 = (float) (0.0 / 0.0);
when(validationChecks.checkOrIsPresent(f1)).thenReturn("Value is not number");
ValidationError error3 = errorCreationService.checkOrIsPresent((f1));
assertThat(error3).extracting("field", "error", "warning").contains("OR", "Value is not number", false);
}
use of uk.ac.ebi.spot.goci.model.ValidationError in project goci by EBISPOT.
the class ErrorCreationServiceTest method testCheckDescriptionIsEmpty.
@Test
public void testCheckDescriptionIsEmpty() throws Exception {
when(validationChecks.checkValueIsEmpty(Matchers.anyString())).thenReturn("Value is not empty");
ValidationError error1 = errorCreationService.checkDescriptionIsEmpty(Matchers.anyString());
assertThat(error1).extracting("field", "error", "warning").contains("OR/Beta description", "Value is not empty", false);
String nullValue = null;
when(validationChecks.checkValueIsEmpty(nullValue)).thenReturn(null);
ValidationError error2 = errorCreationService.checkDescriptionIsEmpty(nullValue);
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 testCheckRangeIsEmpty.
@Test
public void testCheckRangeIsEmpty() throws Exception {
when(validationChecks.checkValueIsEmpty(Matchers.anyString())).thenReturn("Value is not empty");
ValidationError error1 = errorCreationService.checkRangeIsEmpty(Matchers.anyString());
assertThat(error1).extracting("field", "error", "warning").contains("Range", "Value is not empty", false);
String nullRange = null;
when(validationChecks.checkValueIsEmpty(nullRange)).thenReturn(null);
ValidationError error2 = errorCreationService.checkRangeIsEmpty(nullRange);
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 AssociationFileUploadService method createRowValidationSummary.
/**
* Return a list of syntax errors. These error checks will look for things that would prevent creation of an
* association which could then be carried forward to full validation
*
* @param row Row to validate
*/
private RowValidationSummary createRowValidationSummary(AssociationUploadRow row, String eRelease) {
getLog().info("Creating row summary for row " + row.getRowNumber());
Collection<ValidationError> errors = validationService.runRowValidation(row, eRelease);
RowValidationSummary rowValidationSummary = new RowValidationSummary();
rowValidationSummary.setRow(row);
rowValidationSummary.setErrors(errors);
return rowValidationSummary;
}
Aggregations