use of uk.ac.ebi.spot.goci.model.ValidationError in project goci by EBISPOT.
the class ErrorCreationServiceTest method testCheckRiskAllele.
@Test
public void testCheckRiskAllele() throws Exception {
when(validationChecks.checkRiskAllele("CHR4456:89")).thenReturn("Value does not start with rs or contain -");
ValidationError error1 = errorCreationService.checkRiskAllele("CHR4456:89");
assertThat(error1).extracting("field", "error", "warning").contains("Risk Allele", "Value does not start with rs or contain -", true);
when(validationChecks.checkRiskAllele("")).thenReturn("Value is empty");
ValidationError error2 = errorCreationService.checkRiskAllele("");
assertThat(error2).extracting("field", "error", "warning").contains("Risk Allele", "Value is empty", false);
when(validationChecks.checkRiskAllele("rs1234-?")).thenReturn(null);
ValidationError error3 = errorCreationService.checkRiskAllele("rs1234-?");
assertThat(error3).extracting("field", "error", "warning").contains(null, null, false);
}
use of uk.ac.ebi.spot.goci.model.ValidationError in project goci by EBISPOT.
the class ValidationChecksBuilder method runAuthorLevelBetaChecks.
/**
* Run author level beta checks on a row
*
* @param association row to be checked
*/
public Collection<ValidationError> runAuthorLevelBetaChecks(Association association) {
Collection<ValidationError> validationErrors = new ArrayList<>();
ValidationError betaIsPresent = errorCreationService.checkBetaIsPresentAndIsNotNegative(association.getBetaNum());
validationErrors.add(betaIsPresent);
ValidationError betaUnitNotFound = errorCreationService.checkBetaUnitIsPresent(association.getBetaUnit());
validationErrors.add(betaUnitNotFound);
ValidationError betaDirectionNotFound = errorCreationService.checkBetaDirectionIsPresent(association.getBetaDirection());
validationErrors.add(betaDirectionNotFound);
ValidationError orFound = errorCreationService.checkOrEmpty(association.getOrPerCopyNum());
validationErrors.add(orFound);
ValidationError rangeNotFound = errorCreationService.checkRangeIsPresent(association.getRange());
validationErrors.add(rangeNotFound);
return ErrorProcessingService.checkForValidErrors(validationErrors);
}
use of uk.ac.ebi.spot.goci.model.ValidationError in project goci by EBISPOT.
the class ErrorCreationServiceTest method testCheckAssociationRiskFrequency.
@Test
public void testCheckAssociationRiskFrequency() throws Exception {
when(validationChecks.checkRiskFrequency("10")).thenReturn("Value is invalid, value is not between 0 and 1");
ValidationError error1 = errorCreationService.checkAssociationRiskFrequency("10");
assertThat(error1).extracting("field", "error", "warning").contains("Risk element (allele, haplotype or SNPxSNP interaction) frequency in controls", "Value is invalid, value is not between 0 and 1", true);
when(validationChecks.checkRiskFrequency("")).thenReturn("Value is empty");
ValidationError error2 = errorCreationService.checkAssociationRiskFrequency("");
assertThat(error2).extracting("field", "error", "warning").contains("Risk element (allele, haplotype or SNPxSNP interaction) frequency in controls", "Value is empty", true);
when(validationChecks.checkRiskFrequency("0.78")).thenReturn(null);
ValidationError error3 = errorCreationService.checkAssociationRiskFrequency("0.78");
assertThat(error3).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 testCheckMantissaIsLessThan10.
@Test
public void testCheckMantissaIsLessThan10() throws Exception {
when(validationChecks.checkMantissaIsLessThan10(25)).thenReturn("Value not valid i.e. greater than 9");
ValidationError error1 = errorCreationService.checkMantissaIsLessThan10(25);
assertThat(error1).extracting("field", "error", "warning").contains("P-value mantissa", "Value not valid i.e. greater than 9", false);
when(validationChecks.checkMantissaIsLessThan10(6)).thenReturn(null);
ValidationError error2 = errorCreationService.checkMantissaIsLessThan10(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 testCheckBetaValuesIsEmpty.
@Test
public void testCheckBetaValuesIsEmpty() throws Exception {
when(validationChecks.checkValueIsEmpty(Matchers.anyFloat())).thenReturn("Value is not empty");
ValidationError error1 = errorCreationService.checkBetaValuesIsEmpty(Matchers.anyFloat());
assertThat(error1).extracting("field", "error", "warning").contains("Beta", "Value is not empty", false);
Float nullValue = null;
when(validationChecks.checkValueIsEmpty(nullValue)).thenReturn(null);
ValidationError error2 = errorCreationService.checkBetaValuesIsEmpty(nullValue);
assertThat(error2).extracting("field", "error", "warning").contains(null, null, false);
}
Aggregations