FormatFactory { public void registerFormat(IChemFormatMatcher format) { formats.add(format); } FormatFactory();  FormatFactory(int headerLength); void registerFormat(IChemFormatMatcher format); List<IChemFormatMatcher> getFormats(); IChemFormat guessFormat(Reader input); IChemFormat guessFormat(InputStream input);  }
@Test public void testRegisterFormat() throws IOException { factory.registerFormat(new DummyFormat()); StringReader reader = new StringReader("DummyFormat:"); IChemFormat format = factory.guessFormat(reader); Assert.assertNotNull(format); Assert.assertTrue(format instanceof DummyFormat); }