private void addError(final SAMValidationError error) { // Just ignore an error if it's of a type we're not interested in if (this.errorsToIgnore.contains(error.getType())) return; if (this.ignoreWarnings && error.getType().severity == SAMValidationError.Severity.WARNING) return; this.errorsByType.increment(error.getType()); if (verbose) { out.println(error); out.flush(); if (this.errorsByType.getCount() >= maxVerboseOutput) { throw new MaxOutputExceededException(); } } }
private void addError(final SAMValidationError error) { // Just ignore an error if it's of a type we're not interested in if (this.errorsToIgnore.contains(error.getType())) return; switch (error.getType().severity) { case WARNING: if (this.ignoreWarnings) { return; } this.numWarnings++; break; case ERROR: this.numErrors++; break; default: throw new SAMException("Unknown SAM validation error severity: " + error.getType().severity); } this.errorsByType.increment(error.getType()); if (verbose) { out.println(error); out.flush(); if (this.errorsByType.getCount() >= maxVerboseOutput) { throw new MaxOutputExceededException(); } } }
private void addError(final SAMValidationError error) { // Just ignore an error if it's of a type we're not interested in if (this.errorsToIgnore.contains(error.getType())) return; switch (error.getType().severity) { case WARNING: if (this.ignoreWarnings) { return; } this.numWarnings++; break; case ERROR: this.numErrors++; break; default: throw new SAMException("Unknown SAM validation error severity: " + error.getType().severity); } this.errorsByType.increment(error.getType()); if (verbose) { out.println(error); out.flush(); if (this.errorsByType.getCount() >= maxVerboseOutput) { throw new MaxOutputExceededException(); } } }
@Test(dataProvider = "negativeTestsData") public void testNegative(final String cigar, final SAMValidationError.Type type) { final List<SAMValidationError> errors = TextCigarCodec.decode(cigar).isValid(null, -1); Assert.assertEquals(errors.size(), 1, String.format("Got %d error, expected exactly one error.", errors.size())); Assert.assertEquals(errors.get(0).getType(), type); }
@Test public void testValidateNonsenseCigar(){ // Create nonsense record SAMRecord rec = createTestRecordHelper(); rec.setCigarString("nonsense"); //The default validationStringency of a sam record is SILENT. rec.setValidationStringency(ValidationStringency.STRICT); // Validate record List<SAMValidationError> err = rec.validateCigar(-1); Assert.assertNotNull(err); Assert.assertEquals(err.size(), 1); Assert.assertEquals(err.get(0).getType(), SAMValidationError.Type.INVALID_CIGAR); }