PairedEndFastqReader { public static void streamInterleaved(final Reader reader, final PairedEndListener listener) throws IOException { streamInterleaved((Readable) reader, listener); } private  PairedEndFastqReader(); static void readPaired(final Reader firstReader,
                                  final Reader secondReader,
                                  final PairedEndListener listener); static void readPaired(final Readable firstReadable,
                                  final Readable secondReadable,
                                  final PairedEndListener listener); static void streamPaired(final Reader firstReader,
                                    final Reader secondReader,
                                    final PairedEndListener listener); static void streamPaired(final Readable firstReadable,
                                    final Readable secondReadable,
                                    final PairedEndListener listener); static void streamInterleaved(final Reader reader, final PairedEndListener listener); static void streamInterleaved(final Readable readable, final PairedEndListener listener);  }
@Test(expected=NullPointerException.class) public void testStreamInterleavedNullReader() throws Exception { streamInterleaved(null, listener); }
@Test(expected=NullPointerException.class) public void testStreamInterleavedNullListener() throws Exception { streamInterleaved(reader, null); }
@Test public void testStreamInterleaved() throws Exception { streamInterleaved(reader, new PairedEndAdapter() { @Override public void paired(final Fastq left, final Fastq right) { assertEquals(PairedEndFastqReaderTest.this.left.getDescription(), left.getDescription()); assertEquals(PairedEndFastqReaderTest.this.right.getDescription(), right.getDescription()); } @Override public void unpaired(final Fastq unpaired) { fail("unpaired " + unpaired); } }); }
@Test public void testStreamInterleavedUnpairedLeft() throws Exception { streamInterleaved(firstReader, listener); }
@Test(expected=IOException.class) public void testStreamInterleavedUnpairedRight() throws Exception { streamInterleaved(secondReader, listener); }
@Test(expected=IOException.class) public void testStreamInterleavedInvalidPrefix() throws Exception { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); new SangerFastqWriter().write(outputStream, invalidPrefix); Reader invalidPrefixReader = new StringReader(outputStream.toString()); streamInterleaved(invalidPrefixReader, listener); }
@Test(expected=IOException.class) public void testStreamInterleavedInvalidPrefixLeft() throws Exception { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); new SangerFastqWriter().write(outputStream, ImmutableList.of(left, right, invalidPrefix)); Reader invalidPrefixLeftReader = new StringReader(outputStream.toString()); streamInterleaved(invalidPrefixLeftReader, listener); }
@Test(expected=IOException.class) public void testStreamInterleavedInvalidPrefixRight() throws Exception { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); new SangerFastqWriter().write(outputStream, ImmutableList.of(left, invalidPrefix)); Reader invalidPrefixRightReader = new StringReader(outputStream.toString()); streamInterleaved(invalidPrefixRightReader, listener); }
@Test(expected=IOException.class) public void testStreamInterleavedOnlyLeft() throws Exception { ByteArrayOutputStream interleaved = new ByteArrayOutputStream(); new SangerFastqWriter().write(interleaved, ImmutableList.of(left, left)); Reader onlyLeftReader = new StringReader(interleaved.toString()); streamInterleaved(onlyLeftReader, listener); }
@Test(expected=IOException.class) public void testStreamInterleavedOnlyRight() throws Exception { ByteArrayOutputStream interleaved = new ByteArrayOutputStream(); new SangerFastqWriter().write(interleaved, ImmutableList.of(right, right)); Reader onlyRightReader = new StringReader(interleaved.toString()); streamInterleaved(onlyRightReader, listener); }
@Test(expected=IOException.class) public void testStreamInterleavedDuplicateLeft() throws Exception { ByteArrayOutputStream interleaved = new ByteArrayOutputStream(); new SangerFastqWriter().write(interleaved, ImmutableList.of(left, left, right)); Reader duplicateLeftReader = new StringReader(interleaved.toString()); streamInterleaved(duplicateLeftReader, listener); }
@Test(expected=IOException.class) public void testStreamInterleavedDuplicateRight() throws Exception { ByteArrayOutputStream interleaved = new ByteArrayOutputStream(); new SangerFastqWriter().write(interleaved, ImmutableList.of(left, right, right)); Reader duplicateRightReader = new StringReader(interleaved.toString()); streamInterleaved(duplicateRightReader, listener); }
@Test(expected=IOException.class) public void testStreamInterleavedMismatchPrefix() throws Exception { ByteArrayOutputStream interleaved = new ByteArrayOutputStream(); new SangerFastqWriter().write(interleaved, ImmutableList.of(left, mismatchPrefix)); Reader mismatchPrefixReader = new StringReader(interleaved.toString()); streamInterleaved(mismatchPrefixReader, listener); }