}
protected void test() {
try {
final SamFileValidator validator = new SamFileValidator(new PrintWriter(System.out), 8000);
// Validate it has the expected cigar
validator.setIgnoreWarnings(true);
validator.setVerbose(true, 1000);
validator.setErrorsToIgnore(Arrays.asList(SAMValidationError.Type.MISSING_READ_GROUP));
SAMFileReader samReader = new SAMFileReader(getOutput());
samReader.setValidationStringency(ValidationStringency.LENIENT);
final SAMRecordIterator iterator = samReader.iterator();
while (iterator.hasNext()) {
final SAMRecord rec = iterator.next();
Assert.assertEquals(rec.getCigarString(), expectedCigar);
if (SAMUtils.hasMateCigar(rec)) {
Assert.assertEquals(SAMUtils.getMateCigarString(rec), expectedCigar);
}
}
samReader.close();
// Run validation on the output file
samReader = new SAMFileReader(getOutput());
final boolean validated = validator.validateSamFileVerbose(samReader, null);
samReader.close();
Assert.assertTrue(validated, "ValidateSamFile failed");
} finally {
TestUtil.recursiveDelete(getOutputDir());
}