HmlUtils { public static Iterable<Sequence> createSequences(final BufferedReader reader) throws IOException { checkNotNull(reader); List<Sequence> sequences = new ArrayList<Sequence>(); for (SequenceIterator it = SeqIOTools.readFastaDNA(reader); it.hasNext(); ) { try { sequences.add(createSequence(it.nextSequence())); } catch (BioException e) { throw new IOException("could not read DNA sequences", e); } } return sequences; } private  HmlUtils(); static Sequence createSequence(final org.biojava.bio.seq.Sequence sequence); static Iterable<Sequence> createSequences(final BufferedReader reader); static Iterable<Sequence> createSequences(final File file); static Iterable<Sequence> createSequences(final URL url); static Iterable<Sequence> createSequences(final InputStream inputStream); static Hmlid getHmlid(final Hml hml); static SymbolList toDnaSymbolList(final Sequence sequence);  }
@Test(expected=NullPointerException.class) public void testCreateSequencesNullReader() throws Exception { createSequences((BufferedReader) null); }
@Test public void testCreateSequences() throws Exception { StringBuilder sb = new StringBuilder(); sb.append(">foo\n"); sb.append("actg\n"); sb.append(">bar\n"); sb.append("gtca\n"); int count = 0; for (Sequence sequence : createSequences(new BufferedReader(new StringReader(sb.toString())))) { assertTrue("actg".equals(sequence.getValue()) || "gtca".equals(sequence.getValue())); count++; } assertEquals(2, count); }
@Test(expected=NullPointerException.class) public void testCreateSequencesNullFile() throws Exception { createSequences((File) null); }
@Test(expected=NullPointerException.class) public void testCreateSequencesNullURL() throws Exception { createSequences((URL) null); }
@Test(expected=NullPointerException.class) public void testCreateSequencesNullInputStream() throws Exception { createSequences((InputStream) null); }