Source:
<code>public void testNoIntevalsNoFragPercentage(final File rRnaIntervalsFile) throws Exception { final SAMRecordSetBuilder builder = new SAMRecordSetBuilder(true, SAMFileHeader.SortOrder.coordinate); if ( rRnaIntervalsFile != null ) { final IntervalList rRnaIntervalList = new IntervalList(builder.getHeader()); rRnaIntervalList.write(rRnaIntervalsFile); rRnaIntervalsFile.deleteOnExit(); } final String sequence = "chr1"; final String ignoredSequence = "chrM"; builder.setRandomSeed(0); final int sequenceIndex = builder.getHeader().getSequenceIndex(sequence); builder.addPair("pair1", sequenceIndex, 45, 475); builder.addFrag("ignoredFrag", builder.getHeader().getSequenceIndex(ignoredSequence), 1, false); final File samFile = File.createTempFile("tmp.collectRnaSeqMetrics.", ".sam"); samFile.deleteOnExit(); final SAMFileWriter samWriter = new SAMFileWriterFactory().makeSAMWriter(builder.getHeader(), false, samFile); for (final SAMRecord rec : builder.getRecords()) samWriter.addAlignment(rec); samWriter.close(); final File metricsFile = File.createTempFile("tmp.", ".rna_metrics"); metricsFile.deleteOnExit(); final String rRnaIntervalsPath = rRnaIntervalsFile != null ? rRnaIntervalsFile.getAbsolutePath() : null; final String[] args = new String[]{ "INPUT=" + samFile.getAbsolutePath(), "OUTPUT=" + metricsFile.getAbsolutePath(), "REF_FLAT=" + getRefFlatFile(sequence).getAbsolutePath(), "RIBOSOMAL_INTERVALS=" + rRnaIntervalsPath, "RRNA_FRAGMENT_PERCENTAGE=" + 0.0, "STRAND_SPECIFICITY=SECOND_READ_TRANSCRIPTION_STRAND", "IGNORE_SEQUENCE=" + ignoredSequence }; Assert.assertEquals(runPicardCommandLine(args), 0); <START> } <END></code><technical_language>I a test fails if intervals file is empty RRNA_FRAGMENT_PERCENTAGE=0</technical_language>

Target:
public void testNoIntevalsNoFragPercentage(final File rRnaIntervalsFile) throws Exception { final SAMRecordSetBuilder builder = new SAMRecordSetBuilder(true, SAMFileHeader.SortOrder.coordinate); if ( rRnaIntervalsFile != null ) { final IntervalList rRnaIntervalList = new IntervalList(builder.getHeader()); rRnaIntervalList.write(rRnaIntervalsFile); rRnaIntervalsFile.deleteOnExit(); } final String sequence = "chr1"; final String ignoredSequence = "chrM"; builder.setRandomSeed(0); final int sequenceIndex = builder.getHeader().getSequenceIndex(sequence); builder.addPair("pair1", sequenceIndex, 45, 475); builder.addFrag("ignoredFrag", builder.getHeader().getSequenceIndex(ignoredSequence), 1, false); final File samFile = File.createTempFile("tmp.collectRnaSeqMetrics.", ".sam"); samFile.deleteOnExit(); final SAMFileWriter samWriter = new SAMFileWriterFactory().makeSAMWriter(builder.getHeader(), false, samFile); for (final SAMRecord rec : builder.getRecords()) samWriter.addAlignment(rec); samWriter.close(); final File metricsFile = File.createTempFile("tmp.", ".rna_metrics"); metricsFile.deleteOnExit(); final String rRnaIntervalsPath = rRnaIntervalsFile != null ? rRnaIntervalsFile.getAbsolutePath() : null; final String[] args = new String[]{ "INPUT=" + samFile.getAbsolutePath(), "OUTPUT=" + metricsFile.getAbsolutePath(), "REF_FLAT=" + getRefFlatFile(sequence).getAbsolutePath(), "RIBOSOMAL_INTERVALS=" + rRnaIntervalsPath, "RRNA_FRAGMENT_PERCENTAGE=" + 0.0, "STRAND_SPECIFICITY=SECOND_READ_TRANSCRIPTION_STRAND", "IGNORE_SEQUENCE=" + ignoredSequence }; try { Assert.assertEquals(runPicardCommandLine(args), 0); } catch(final Exception e) { if (rRnaIntervalsFile != null) { Assert.assertEquals(e.getCause().getClass(), PicardException.class); } } }