Mopac7Writer extends DefaultChemObjectWriter { @Override public boolean accepts(Class<? extends IChemObject> classObject) { Class<?>[] interfaces = classObject.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { if (IAtomContainer.class.equals(interfaces[i])) return true; } if (IAtomContainer.class.equals(classObject)) return true; Class superClass = classObject.getSuperclass(); if (superClass != null) return this.accepts(superClass); return false; } Mopac7Writer();  Mopac7Writer(OutputStream out);  Mopac7Writer(Writer out); @Override synchronized void write(IChemObject arg0); @Override /** {@inheritDoc} */ void close(); @Override /** {@inheritDoc} */ boolean accepts(Class<? extends IChemObject> classObject); @Override /** {@inheritDoc} */ IResourceFormat getFormat(); @Override /** {@inheritDoc} */ void setWriter(OutputStream writer); @Override /** {@inheritDoc} */ void setWriter(Writer writer);  }
@Test public void testAccepts() throws Exception { Mopac7Writer reader = new Mopac7Writer(); Assert.assertTrue(reader.accepts(AtomContainer.class)); }