### Question:
BamManager implements AutoCloseable { public List<SAMRecord> query(AlignmentFilters<SAMRecord> filters) throws IOException { return query(null, filters, null, SAMRecord.class); } BamManager(Path bamFilePath);  BamManager(Path bamFilePath, Path refFilePath); Path createIndex(); Path createIndex(Path outputIndex); SAMFileHeader getHeader(); Path calculateBigWigCoverage(); Path calculateBigWigCoverage(Path bigWigPath, int windowSize); String header(); byte[] compressedHeader(); List<SAMRecord> query(AlignmentFilters<SAMRecord> filters); List<SAMRecord> query(AlignmentFilters<SAMRecord> filters, AlignmentOptions options); List<T> query(AlignmentFilters<SAMRecord> filters, AlignmentOptions options, Class<T> clazz); List<SAMRecord> query(Region region); List<SAMRecord> query(Region region, AlignmentOptions options); List<SAMRecord> query(Region region, AlignmentFilters<SAMRecord> filters, AlignmentOptions options); List<T> query(Region region, AlignmentFilters<SAMRecord> filters, AlignmentOptions options, Class<T> clazz); BamIterator<SAMRecord> iterator(); BamIterator<SAMRecord> iterator(AlignmentOptions options); BamIterator<SAMRecord> iterator(AlignmentFilters<SAMRecord> filters, AlignmentOptions options); BamIterator<T> iterator(AlignmentFilters<SAMRecord> filters, AlignmentOptions options, Class<T> clazz); BamIterator<SAMRecord> iterator(Region region); BamIterator<SAMRecord> iterator(Region region, AlignmentOptions options); BamIterator<SAMRecord> iterator(Region region, AlignmentFilters<SAMRecord> filters, AlignmentOptions options); BamIterator<T> iterator(Region region, AlignmentFilters<SAMRecord> filters, AlignmentOptions options, Class<T> clazz); List<Chunk> getChunks(Region region); List<String> getBreakpoints(Region region); RegionCoverage coverage(Region region, int windowSize); RegionCoverage coverage(Region region, AlignmentFilters<SAMRecord> filters, AlignmentOptions options); AlignmentGlobalStats stats(); AlignmentGlobalStats stats(Region region, AlignmentFilters<SAMRecord> filters, AlignmentOptions options); @Override void close(); Path getBamFile(); BamManager setBamFile(Path bamFilePath); static final int DEFAULT_WINDOW_SIZE; static final int MAX_NUM_RECORDS; static final int MAX_REGION_COVERAGE; static final String COVERAGE_BIGWIG_EXTENSION; }### Answer:
@Test public void testQuery() throws Exception { BamManager bamManager = new BamManager(inputPath); AlignmentOptions options = new AlignmentOptions().setLimit(5); Region region = new Region("20", 60000, 65000); List<SAMRecord> query = bamManager.query(region, options); assertEquals(5, query.size()); options.setLimit(3); query = bamManager.query(region, options); for (SAMRecord sam: query) { System.out.println(sam.toString()); } assertEquals(3, query.size()); }