Author: Olivier Sallou <osallou@debian.org>
Subject: disable network tests
Description: remove network related tests
 fixing bug 808593
Last-Updated: 2015-01-06
--- a/src/tests/java/htsjdk/tribble/util/ParsingUtilsTest.java
+++ b/src/tests/java/htsjdk/tribble/util/ParsingUtilsTest.java
@@ -117,47 +117,12 @@
         testSplitJoinRoundtrip("\ta\tb", '\t', Arrays.asList("", "a", "b"));
     }
 
-    @Test
-    public void testFTPDoesExist() throws IOException{
-        tstExists(AVAILABLE_FTP_URL, true);
-    }
-
-    @Test
-    public void testFTPNotExist() throws IOException{
-        tstExists(UNAVAILABLE_FTP_URL, false);
-    }
-
-    @Test
-    public void testHTTPDoesExist() throws IOException{
-        tstExists(AVAILABLE_HTTP_URL, true);
-    }
-
-    @Test
-    public void testHTTPNotExist() throws IOException{
-        tstExists(UNAVAILABLE_HTTP_URL, false);
-    }
-
     private void tstExists(String path, boolean expectExists) throws IOException{
         boolean exists = ParsingUtils.resourceExists(path);
         Assert.assertEquals(exists, expectExists);
     }
 
-    @Test
-    public void testFTPOpenInputStream() throws IOException{
-        tstStream(AVAILABLE_FTP_URL);
-    }
-
-    @Test
-    public void testHTTPOpenInputStream() throws IOException{
-        tstStream(AVAILABLE_HTTP_URL);
-    }
 
-    private void tstStream(String path) throws IOException{
-        InputStream is = ParsingUtils.openInputStream(path);
-        Assert.assertNotNull(is, "InputStream is null for " + path);
-        int b = is.read();
-        Assert.assertNotSame(b, -1);
-    }
 
 
 }
--- a/src/tests/java/htsjdk/tribble/AbstractFeatureReaderTest.java
+++ b/src/tests/java/htsjdk/tribble/AbstractFeatureReaderTest.java
@@ -21,30 +21,5 @@
     final static String HTTP_INDEXED_VCF_PATH = "http://www.broadinstitute.org/~picard/testdata/ex2.vcf";
     final static String LOCAL_MIRROR_HTTP_INDEXED_VCF_PATH = VariantBaseTest.variantTestDataRoot + "ex2.vcf";
 
-    /**
-     * Asserts readability and correctness of VCF over HTTP.  The VCF is indexed and requires and index.
-     */
-    @Test
-    public void testVcfOverHTTP() throws IOException {
-        final VCFCodec codec = new VCFCodec();
-        final AbstractFeatureReader<VariantContext, LineIterator> featureReaderHttp =
-                AbstractFeatureReader.getFeatureReader(HTTP_INDEXED_VCF_PATH, codec, true); // Require an index to
-        final AbstractFeatureReader<VariantContext, LineIterator> featureReaderLocal =
-                AbstractFeatureReader.getFeatureReader(LOCAL_MIRROR_HTTP_INDEXED_VCF_PATH, codec, false);
-        final CloseableTribbleIterator<VariantContext> localIterator = featureReaderLocal.iterator();
-        for (final Feature feat : featureReaderHttp.iterator()) {
-            assertEquals(feat.toString(), localIterator.next().toString());
-        }
-        assertFalse(localIterator.hasNext());
-    }
 
-    @Test
-    public void testLoadBEDFTP() throws Exception {
-        final String path = "ftp://ftp.broadinstitute.org/distribution/igv/TEST/cpgIslands with spaces.hg18.bed";
-        final BEDCodec codec = new BEDCodec();
-        final AbstractFeatureReader<BEDFeature, LineIterator> bfs = AbstractFeatureReader.getFeatureReader(path, codec, false);
-        for (final Feature feat : bfs.iterator()) {
-            assertNotNull(feat);
-        }
-    }
 }
--- a/src/tests/java/htsjdk/samtools/seekablestream/SeekableBufferedStreamTest.java
+++ b/src/tests/java/htsjdk/samtools/seekablestream/SeekableBufferedStreamTest.java
@@ -40,58 +40,7 @@
     private final String BAM_URL_STRING = "http://broadinstitute.github.io/picard/testdata/index_test.bam";
     private static File TestFile = new File("testdata/htsjdk/samtools/seekablestream/megabyteZeros.dat");
 
-    /**
-     * Test reading across a buffer boundary (buffer size is 512000).   The test first reads a range of
-     * bytes using an unbuffered stream file stream,  then compares this to results from a buffered http stream.
-     *
-     * @throws IOException
-     */
-    @Test
-    public void testRandomRead() throws IOException {
-
-        int startPosition = 500000;
-        int length = 50000;
-
-        byte[] buffer1 = new byte[length];
-        SeekableStream unBufferedStream = new SeekableFileStream(BAM_FILE);
-        unBufferedStream.seek(startPosition);
-        int bytesRead = unBufferedStream.read(buffer1, 0, length);
-        assertEquals(length, bytesRead);
-
-        byte[] buffer2 = new byte[length];
-        SeekableStream bufferedStream = new SeekableBufferedStream(new SeekableHTTPStream(new URL(BAM_URL_STRING)));
-        bufferedStream.seek(startPosition);
-        bytesRead = bufferedStream.read(buffer2, 0, length);
-        assertEquals(length, bytesRead);
-
-        assertEquals(buffer1, buffer2);
-    }
-
-    /**
-     * Test an attempt to read past the end of the file.  The test file is 594,149 bytes in length.  The test
-     * attempts to read a 1000 byte block starting at position 594000.  A correct result would return 149 bytes.
-     *
-     * @throws IOException
-     */
-    @Test
-    public void testEOF() throws IOException {
-
-        int remainder = 149;
-        long fileLength = BAM_FILE.length();
-        long startPosition = fileLength - remainder;
-        int length = 1000;
-
-
-        byte[] buffer = new byte[length];
-        SeekableStream bufferedStream = new SeekableBufferedStream(new SeekableHTTPStream(new URL(BAM_URL_STRING)));
-        bufferedStream.seek(startPosition);
-        int bytesRead = bufferedStream.read(buffer, 0, length);
-        assertEquals(remainder, bytesRead);
 
-        // Subsequent reads should return -1
-        bytesRead = bufferedStream.read(buffer, 0, length);
-        assertEquals(-1, bytesRead);
-    }
 
     @Test
     public void testSkip() throws IOException {
--- a/src/tests/java/htsjdk/samtools/sra/SRAIndexTest.java
+++ b/src/tests/java/htsjdk/samtools/sra/SRAIndexTest.java
@@ -50,85 +50,4 @@
     private static final int LAST_BIN_LEVEL = GenomicIndexUtil.LEVEL_STARTS.length - 1;
     private static final int SRA_BIN_OFFSET = GenomicIndexUtil.LEVEL_STARTS[LAST_BIN_LEVEL];
 
-    @Test
-    public void testLevelSize() {
-        final SRAIndex index = getIndex(DEFAULT_ACCESSION);
-        Assert.assertEquals(index.getLevelSize(0), GenomicIndexUtil.LEVEL_STARTS[1] - GenomicIndexUtil.LEVEL_STARTS[0]);
-
-        Assert.assertEquals(index.getLevelSize(LAST_BIN_LEVEL), GenomicIndexUtil.MAX_BINS - GenomicIndexUtil.LEVEL_STARTS[LAST_BIN_LEVEL] - 1);
-    }
-
-    @Test
-    public void testLevelForBin() {
-        final SRAIndex index = getIndex(DEFAULT_ACCESSION);
-        final Bin bin = new Bin(0, SRA_BIN_OFFSET);
-        Assert.assertEquals(index.getLevelForBin(bin), LAST_BIN_LEVEL);
-    }
-
-    @DataProvider(name = "testBinLocuses")
-    private Object[][] createDataForBinLocuses() {
-        return new Object[][] {
-                {DEFAULT_ACCESSION, 0, 0, 1, SRAIndex.SRA_BIN_SIZE},
-                {DEFAULT_ACCESSION, 0, 1, SRAIndex.SRA_BIN_SIZE + 1, SRAIndex.SRA_BIN_SIZE * 2}
-        };
-    }
-
-    @Test(dataProvider = "testBinLocuses")
-    public void testBinLocuses(SRAAccession acc, int reference, int binIndex, int firstLocus, int lastLocus) {
-        final SRAIndex index = getIndex(acc);
-        final Bin bin = new Bin(reference, SRA_BIN_OFFSET + binIndex);
-
-        Assert.assertEquals(index.getFirstLocusInBin(bin), firstLocus);
-        Assert.assertEquals(index.getLastLocusInBin(bin), lastLocus);
-    }
-
-    @DataProvider(name = "testBinOverlappings")
-    private Object[][] createDataForBinOverlappings() {
-        return new Object[][] {
-                {DEFAULT_ACCESSION, 0, 1, SRAIndex.SRA_BIN_SIZE, new HashSet<>(Arrays.asList(0))},
-                {DEFAULT_ACCESSION, 0, SRAIndex.SRA_BIN_SIZE + 1, SRAIndex.SRA_BIN_SIZE * 2, new HashSet<>(Arrays.asList(1))},
-                {DEFAULT_ACCESSION, 0, SRAIndex.SRA_BIN_SIZE + 1, SRAIndex.SRA_BIN_SIZE * 3, new HashSet<>(Arrays.asList(1, 2))},
-                {DEFAULT_ACCESSION, 0, SRAIndex.SRA_BIN_SIZE * 2, SRAIndex.SRA_BIN_SIZE * 2 + 1, new HashSet<>(Arrays.asList(1, 2))}
-        };
-    }
-
-
-    @Test(dataProvider = "testBinOverlappings")
-    public void testBinOverlappings(SRAAccession acc, int reference, int firstLocus, int lastLocus, Set<Integer> binNumbers) {
-        final SRAIndex index = getIndex(acc);
-        final Iterator<Bin> binIterator = index.getBinsOverlapping(reference, firstLocus, lastLocus).iterator();
-        final Set<Integer> binNumbersFromIndex = new HashSet<>();
-        while (binIterator.hasNext()) {
-            final Bin bin = binIterator.next();
-            binNumbersFromIndex.add(bin.getBinNumber() - SRA_BIN_OFFSET);
-        }
-
-        Assert.assertEquals(binNumbers, binNumbersFromIndex);
-    }
-
-    @DataProvider(name = "testSpanOverlappings")
-    private Object[][] createDataForSpanOverlappings() {
-        return new Object[][] {
-                {DEFAULT_ACCESSION, 0, 1, SRAIndex.SRA_BIN_SIZE, new long[] {0, SRAIndex.SRA_CHUNK_SIZE} },
-                {DEFAULT_ACCESSION, 0, SRAIndex.SRA_BIN_SIZE * 2, SRAIndex.SRA_BIN_SIZE * 2 + 1, new long[]{0, SRAIndex.SRA_CHUNK_SIZE} },
-                {DEFAULT_ACCESSION, 0, SRAIndex.SRA_CHUNK_SIZE, SRAIndex.SRA_CHUNK_SIZE + 1, new long[]{0, SRAIndex.SRA_CHUNK_SIZE, SRAIndex.SRA_CHUNK_SIZE, SRAIndex.SRA_CHUNK_SIZE * 2} },
-        };
-    }
-
-    @Test(dataProvider = "testSpanOverlappings")
-    public void testSpanOverlappings(SRAAccession acc, int reference, int firstLocus, int lastLocus, long[] spanCoordinates) {
-        final SRAIndex index = getIndex(acc);
-        final BAMFileSpan span = index.getSpanOverlapping(reference, firstLocus, lastLocus);
-
-        long[] coordinatesFromIndex = span.toCoordinateArray();
-
-        Assert.assertTrue(Arrays.equals(coordinatesFromIndex, spanCoordinates),
-                "Coordinates mismatch. Expected: " + Arrays.toString(spanCoordinates) +
-                " but was : " + Arrays.toString(coordinatesFromIndex));
-    }
-
-    private SRAIndex getIndex(SRAAccession acc) {
-        final SRAFileReader reader = new SRAFileReader(acc);
-        return (SRAIndex) reader.getIndex();
-    }
 }
--- a/build.xml
+++ b/build.xml
@@ -141,6 +141,15 @@
                     </classpath>
                     <classfileset dir="${classes.test}">
                         <include name="**/Test*.class"/>
+                        <exclude name="**/BAM*.class"/>
+                        <exclude name="**/CRAM*.class"/>
+                        <exclude name="**/SAM*.class"/>
+                        <exclude name="**/Sam*.class"/>
+                        <exclude name="**/Tabix*.class"/>
+                        <exclude name="**/SRA*.class"/>
+                        <exclude name="**/*FTP*.class"/>
+                        <exclude name="**/EnaRef*.class"/>
+                        <exclude name="**/IupacTest*.class"/>
                         <include name="**/*Test.class"/>
                     </classfileset>
                     <jvmarg value="-Xmx2G"/>
--- a/src/tests/java/htsjdk/samtools/sra/SRATest.java
+++ b/src/tests/java/htsjdk/samtools/sra/SRATest.java
@@ -57,375 +57,4 @@
  */
 public class SRATest extends AbstractSRATest {
 
-    @DataProvider(name = "testCounts")
-    private Object[][] createDataForCounts() {
-        return new Object[][] {
-            {"SRR2096940", 10591, 498}
-        };
-    }
-
-    @Test(dataProvider = "testCounts")
-    public void testCounts(String acc, int expectedNumMapped, int expectedNumUnmapped) {
-        SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT).open(
-                SamInputResource.of(new SRAAccession(acc))
-        );
-
-        final SAMRecordIterator samRecordIterator = reader.iterator();
-
-        assertCorrectCountsOfMappedAndUnmappedRecords(samRecordIterator, expectedNumMapped, expectedNumUnmapped);
-    }
-
-    @DataProvider(name = "testCountsBySpan")
-    private Object[][] createDataForCountsBySpan() {
-        return new Object[][] {
-            {"SRR2096940", Arrays.asList(new Chunk(0, 59128983), new Chunk(59128983, 59141089)), 10591, 498},
-            {"SRR2096940", Arrays.asList(new Chunk(0, 29128983), new Chunk(29128983, 59141089)), 10591, 498},
-            {"SRR2096940", Arrays.asList(new Chunk(0, 59134983), new Chunk(59134983, 59141089)), 10591, 498},
-            {"SRR2096940", Arrays.asList(new Chunk(0, 59130000)),                                10591, 0},
-            {"SRR2096940", Arrays.asList(new Chunk(0, 59140889)),                                10591, 298}
-        };
-    }
-
-    @Test(dataProvider = "testCountsBySpan")
-    public void testCountsBySpan(String acc, List<Chunk> chunks, int expectedNumMapped, int expectedNumUnmapped) {
-        SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT).open(
-                SamInputResource.of(new SRAAccession(acc))
-        );
-
-        final SAMRecordIterator samRecordIterator = ((SamReader.Indexing) reader).iterator(new BAMFileSpan(chunks));
-
-        assertCorrectCountsOfMappedAndUnmappedRecords(samRecordIterator, expectedNumMapped, expectedNumUnmapped);
-    }
-
-    @DataProvider(name = "testGroups")
-    private Object[][] createDataForGroups() {
-        return new Object[][] {
-            {"SRR822962", new TreeSet<>(Arrays.asList(
-                    "GS54389-FS3-L08", "GS57511-FS3-L08", "GS54387-FS3-L02", "GS54387-FS3-L01",
-                    "GS57510-FS3-L01", "GS57510-FS3-L03", "GS54389-FS3-L07", "GS54389-FS3-L05",
-                    "GS54389-FS3-L06", "GS57510-FS3-L02", "GS57510-FS3-L04", "GS54387-FS3-L03",
-                    "GS46253-FS3-L03"))
-            },
-            {"SRR2096940", new HashSet<>(Arrays.asList("SRR2096940"))}
-        };
-    }
-
-    @Test(dataProvider = "testGroups")
-    public void testGroups(String acc, Set<String> groups) {
-        SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT).open(
-                SamInputResource.of(new SRAAccession(acc))
-        );
-
-        final SAMRecordIterator samRecordIterator = reader.iterator();
-
-        SAMFileHeader header = reader.getFileHeader();
-        Set<String> headerGroups = new TreeSet<>();
-        for (SAMReadGroupRecord group : header.getReadGroups()) {
-            Assert.assertEquals(group.getReadGroupId(), group.getId());
-            headerGroups.add(group.getReadGroupId());
-        }
-
-        Assert.assertEquals(groups, headerGroups);
-
-        Set<String> foundGroups = new TreeSet<>();
-
-        for (int i = 0; i < 10000; i++) {
-            if (!samRecordIterator.hasNext()) {
-                break;
-            }
-            SAMRecord record = samRecordIterator.next();
-            String groupName = (String)record.getAttribute("RG");
-
-            foundGroups.add(groupName);
-        }
-
-        // please note that some groups may be introduced after 10k records, which is not an error
-        Assert.assertEquals(groups, foundGroups);
-    }
-
-    @DataProvider(name = "testReferences")
-    private Object[][] createDataForReferences() {
-        return new Object[][] {
-            // primary alignment only
-            {"SRR1063272", 1,
-                    Arrays.asList("supercont2.1", "supercont2.2", "supercont2.3", "supercont2.4",
-                                  "supercont2.5", "supercont2.6", "supercont2.7", "supercont2.8",
-                                  "supercont2.9", "supercont2.10", "supercont2.11", "supercont2.12",
-                                  "supercont2.13", "supercont2.14"),
-                    Arrays.asList(2291499, 1621675, 1575141, 1084805,
-                                  1814975, 1422463, 1399503, 1398693,
-                                  1186808, 1059964, 1561994, 774062,
-                                  756744, 926563)},
-        };
-    }
-
-    @Test(dataProvider = "testReferences")
-    public void testReferences(String acc, int numberFirstReferenceFound, List<String> references, List<Integer> refLengths) {
-        SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT).open(
-                SamInputResource.of(new SRAAccession(acc))
-        );
-
-        final SAMRecordIterator samRecordIterator = reader.iterator();
-
-        SAMFileHeader header = reader.getFileHeader();
-        Set<String> headerRefNames = new TreeSet<>();
-
-        for (SAMSequenceRecord ref : header.getSequenceDictionary().getSequences()) {
-            String refName = ref.getSequenceName();
-
-            int refIndex = references.indexOf(refName);
-            Assert.assertTrue(refIndex != -1, "Unexpected reference: " + refName);
-
-            Assert.assertEquals(refLengths.get(refIndex), (Integer) ref.getSequenceLength(), "Reference length is incorrect");
-
-            headerRefNames.add(refName);
-        }
-
-        Assert.assertEquals(new TreeSet<>(references), headerRefNames);
-
-        Set<String> foundRefNames = new TreeSet<>();
-        for (int i = 0; i < 10000; i++) {
-            if (!samRecordIterator.hasNext()) {
-                break;
-            }
-            SAMRecord record = samRecordIterator.next();
-
-            if (record.getReferenceIndex().equals(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX)) {
-                continue;
-            }
-
-            String refName = record.getReferenceName();
-            Assert.assertNotNull(refName);
-
-            foundRefNames.add(refName);
-        }
-
-        Assert.assertEquals(new TreeSet<>(references.subList(0, numberFirstReferenceFound)), foundRefNames);
-    }
-
-    @DataProvider(name = "testRows")
-    private Object[][] createDataForRowsTest() {
-        return new Object[][] {
-            // primary alignment only
-            {"SRR1063272", 0, 99, "SRR1063272.R.1",
-                    "ACTCGACATTCTGCCTTCGACCTATCTTTCTCCTCTCCCAGTCATCGCCCAGTAGAATTACCAGGCAATGAACCAGGGCCTTCCATCCCAACGGCACAGCA",
-                    "@@CDDBDFFBFHFIEEFGIGGHIEHIGIGGFGEGAFDHIIIIIGGGDFHII;=BF@FEHGIEEH?AHHFHFFFFDC5'5=?CC?ADCD@AC??9BDDCDB<",
-                    86, "101M", "supercont2.1", 60, true, false},
-
-            // small SRA archive
-            {"SRR2096940", 1, 16, "SRR2096940.R.3",
-                    "GTGTGTCACCAGATAAGGAATCTGCCTAACAGGAGGTGTGGGTTAGACCCAATATCAGGAGACCAGGAAGGAGGAGGCCTAAGGATGGGGCTTTTCTGTCACCAATCCTGTCCCTAGTGGCCCCACTGTGGGGTGGAGGGGACAGATAAAAGTACCCAGAACCAGAG",
-                    "AAAABFFFFFFFGGGGGGGGIIIIIIIIIIIIIIIIIIIIIIIIIIIIII7IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIGGGGGFGFFDFFFFFC",
-                    55627016, "167M", "CM000681.1", 42, false, false},
-
-            {"SRR2096940", 10591, 4, "SRR2096940.R.10592",
-                    "CTCTGGTTCTGGGTACTTTTATCTGTCCCCTCCACCCCACAGTGGCGAGCCAGATTCCTTATCTGGTGACACAC",
-                    "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII",
-                    -1, null, null, -1, false, false},
-
-            // primary and secondary alignments
-            {"SRR833251", 81, 393, "SRR833251.R.51",
-                    "ATGCAAATCCGAATGGGCTATTTGTGGGTACTTGGGCAGGTAAGTAGCTGGCAATCTTGGTCGGTAAACCAATACCCAAGTTCACATAGGCACCATCGGGA",
-                    "CCCFFFFFHHHHHIJJJIJJJJJIIJJJGIJIJIIJIJJJDGIGIIJIJIHIJJJJJJGIGHIHEDFFFFDDEEEDDDDDCDEEDDDDDDDDDDDDDBBDB",
-                    1787186, "38M63S", "gi|169794206|ref|NC_010410.1|", 11, true, true},
-
-            // local SRA file
-            {"testdata/htsjdk/samtools/sra/test_archive.sra", 1, 99, "test_archive.R.2",
-                    "TGTCGATGCTGAAAGTGTCTGCGGTGAACCACTTCATGCACAGCGCACACTGCAGCTCCACTTCACCCAGCTGACGGCCGTTCTCATCGTCTCCAGAGCCCGTCTGAGCGTCCGCTGCTTCAGAACTGTCCCCGGCTGTATCCTGAAGAC",
-                    "BBAABBBFAFFFGGGGGGGGGGGGEEFHHHHGHHHHHFHHGHFDGGGGGHHGHHHHHHHHHHHHFHHHGHHHHHHGGGGGGGHGGHHHHHHHHHGHHHHHGGGGHGHHHGGGGGGGGGHHHHEHHHHHHHHHHGCGGGHHHHHHGBFFGF",
-                    2811570, "150M", "NC_007121.5", 60, true, false}
-        };
-    }
-
-    @Test(dataProvider = "testRows")
-    public void testRows(String acc, int recordIndex, int flags, String readName, String bases, String quals, int refStart, String cigar,
-                         String refName, int mapQ, boolean hasMate, boolean isSecondaryAlignment) {
-        SAMRecord record = getRecordByIndex(acc, recordIndex, false);
-
-        checkSAMRecord(record, flags, readName, bases, quals, refStart, cigar, refName, mapQ, hasMate, isSecondaryAlignment);
-    }
-
-    @Test(dataProvider = "testRows")
-    public void testRowsAfterIteratorDetach(String acc, int recordIndex, int flags, String readName, String bases, String quals,
-                                            int refStart, String cigar, String refName, int mapQ, boolean hasMate,
-                                            boolean isSecondaryAlignment) {
-        SAMRecord record = getRecordByIndex(acc, recordIndex, true);
-
-        checkSAMRecord(record, flags, readName, bases, quals, refStart, cigar, refName, mapQ, hasMate, isSecondaryAlignment);
-    }
-
-    @Test(dataProvider = "testRows")
-    public void testRowsOverrideValues(String acc, int recordIndex, int flags, String readName, String bases, String quals,
-                                       int refStart, String cigar, String refName, int mapQ, boolean hasMate,
-                                       boolean isSecondaryAlignment) {
-        SAMRecord record = getRecordByIndex(acc, recordIndex, true);
-        SAMFileHeader header = record.getHeader();
-
-
-        record.setFlags(0);
-        record.setReadUnmappedFlag(refStart == -1);
-        record.setReadBases("C".getBytes());
-        record.setBaseQualities(SAMUtils.fastqToPhred("A"));
-        if (refStart == -1) {
-            checkSAMRecord(record, 4, readName, "C", "A", refStart, "1M", refName, mapQ, false, false);
-        } else {
-            int sequenceIndex = header.getSequenceIndex(refName);
-            Assert.assertFalse(sequenceIndex == -1);
-
-            if (sequenceIndex == 0) {
-                if (header.getSequenceDictionary().getSequences().size() > 1) {
-                    sequenceIndex++;
-                }
-            } else {
-                sequenceIndex--;
-            }
-
-            refName = header.getSequence(sequenceIndex).getSequenceName();
-
-            record.setAlignmentStart(refStart - 100);
-            record.setCigarString("1M");
-            record.setMappingQuality(mapQ - 1);
-            record.setReferenceIndex(sequenceIndex);
-
-            checkSAMRecord(record, 0, readName, "C", "A", refStart - 100, "1M", refName, mapQ - 1, false, false);
-        }
-    }
-
-    @Test(dataProvider = "testRows")
-    public void testRowsBySpan(String acc, int recordIndex, int flags, String readName, String bases, String quals,
-                                            int refStart, String cigar, String refName, int mapQ, boolean hasMate,
-                                            boolean isSecondaryAlignment) {
-        SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT).open(
-                SamInputResource.of(new SRAAccession(acc))
-        );
-
-        SAMFileHeader header = reader.getFileHeader();
-
-        Chunk chunk;
-        if (refStart != -1) {
-            long refOffset = 0;
-            int refIndex = header.getSequenceDictionary().getSequence(refName).getSequenceIndex();
-            for (SAMSequenceRecord sequenceRecord : header.getSequenceDictionary().getSequences()) {
-                if (sequenceRecord.getSequenceIndex() <  refIndex) {
-                    refOffset += sequenceRecord.getSequenceLength();
-                }
-            }
-
-            chunk = new Chunk(refOffset + refStart - 1, refOffset + refStart);
-        } else {
-            long totalRefLength = header.getSequenceDictionary().getReferenceLength();
-            long totalRecordRange = ((BAMFileSpan)reader.indexing().getFilePointerSpanningReads()).toCoordinateArray()[1];
-            chunk = new Chunk(totalRefLength, totalRecordRange);
-        }
-
-        final SAMRecordIterator samRecordIterator = ((SamReader.Indexing) reader).iterator(new BAMFileSpan(chunk));
-
-        SAMRecord record = null;
-        while (samRecordIterator.hasNext()) {
-            SAMRecord currentRecord = samRecordIterator.next();
-            if (currentRecord.getReadName().equals(readName)) {
-                record = currentRecord;
-                break;
-            }
-        }
-
-        checkSAMRecord(record, flags, readName, bases, quals, refStart, cigar, refName, mapQ, hasMate, isSecondaryAlignment);
-    }
-
-    @Test(dataProvider = "testRows")
-    public void testRowsByIndex(String acc, int recordIndex, int flags, String readName, String bases, String quals,
-                                int refStart, String cigar, String refName, int mapQ, boolean hasMate,
-                                boolean isSecondaryAlignment) {
-        SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT).open(
-                SamInputResource.of(new SRAAccession(acc))
-        );
-
-        Assert.assertTrue(reader.hasIndex());
-        Assert.assertTrue(reader.indexing().hasBrowseableIndex());
-
-        SAMFileHeader header = reader.getFileHeader();
-        BrowseableBAMIndex index = reader.indexing().getBrowseableIndex();
-
-        BAMFileSpan span;
-        if (refStart != -1) {
-            int refIndex = header.getSequenceDictionary().getSequence(refName).getSequenceIndex();
-            span = index.getSpanOverlapping(refIndex, refStart, refStart + 1);
-        } else {
-            long chunkStart = index.getStartOfLastLinearBin();
-            long totalRecordRange = ((BAMFileSpan) reader.indexing().getFilePointerSpanningReads()).toCoordinateArray()[1];
-            span = new BAMFileSpan(new Chunk(chunkStart, totalRecordRange));
-        }
-
-        final SAMRecordIterator samRecordIterator = ((SamReader.Indexing) reader).iterator(span);
-
-        SAMRecord record = null;
-        while (samRecordIterator.hasNext()) {
-            SAMRecord currentRecord = samRecordIterator.next();
-            if (refStart != -1 && currentRecord.getAlignmentStart() + currentRecord.getReadLength() < refStart) {
-                continue;
-            }
-
-            if (currentRecord.getReadName().equals(readName)) {
-                record = currentRecord;
-                break;
-            }
-        }
-
-        checkSAMRecord(record, flags, readName, bases, quals, refStart, cigar, refName, mapQ, hasMate, isSecondaryAlignment);
-    }
-
-    private SAMRecord getRecordByIndex(String acc, int recordIndex, boolean detach) {
-        SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT).open(
-                SamInputResource.of(new SRAAccession(acc))
-        );
-
-        final SAMRecordIterator samRecordIterator = reader.iterator();
-
-        while (recordIndex != 0) {
-            Assert.assertTrue(samRecordIterator.hasNext(), "Record set is too small");
-
-            samRecordIterator.next();
-            recordIndex--;
-        }
-        Assert.assertTrue(samRecordIterator.hasNext(), "Record set is too small");
-
-        SAMRecord record = samRecordIterator.next();
-
-        if (detach) {
-            samRecordIterator.next();
-        }
-
-        return record;
-    }
-
-    private void checkSAMRecord(SAMRecord record, int flags, String readName, String bases, String quals,
-                                int refStart, String cigar, String refName, int mapQ, boolean hasMate,
-                                boolean isSecondaryAlignment) {
-
-        Assert.assertNotNull(record, "Record with read id: " + readName + " was not found by span created from index");
-
-        List<SAMValidationError> validationErrors = record.isValid();
-        Assert.assertNull(validationErrors, "SRA Lazy record is invalid. List of errors: " +
-                (validationErrors != null ? validationErrors.toString() : ""));
-
-        Assert.assertEquals(new String(record.getReadBases()), bases);
-        Assert.assertEquals(record.getBaseQualityString(), quals);
-        Assert.assertEquals(record.getReadPairedFlag(), hasMate);
-        Assert.assertEquals(record.getFlags(), flags);
-        Assert.assertEquals(record.getNotPrimaryAlignmentFlag(), isSecondaryAlignment);
-        if (refStart == -1) {
-            Assert.assertEquals(record.getReadUnmappedFlag(), true);
-            Assert.assertEquals(record.getAlignmentStart(), 0);
-            Assert.assertEquals(record.getCigarString(), "*");
-            Assert.assertEquals(record.getReferenceName(), "*");
-            Assert.assertEquals(record.getMappingQuality(), 0);
-        } else {
-            Assert.assertEquals(record.getReadUnmappedFlag(), false);
-            Assert.assertEquals(record.getAlignmentStart(), refStart);
-            Assert.assertEquals(record.getCigarString(), cigar);
-            Assert.assertEquals(record.getReferenceName(), refName);
-            Assert.assertEquals(record.getMappingQuality(), mapQ);
-        }
-    }
-
 }
