Skip to content

Commit 47f35b9

Browse files
committed
Added similar testing to reader and writers to fix four further unit tests for support of matching against some IChemObject interface class
Change-Id: I21d871d10a39ff18d0ead113657306400b8b718f
1 parent bfc674a commit 47f35b9

4 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/main/org/openscience/cdk/io/MoSSOutputReader.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ public void setReader(InputStream input) throws CDKException {
119119
/** {@inheritDoc} */
120120
@TestMethod("testAccepts")
121121
public boolean accepts(Class testClass) {
122+
if (IMoleculeSet.class.equals(testClass)) return true;
123+
if (IChemFile.class.equals(testClass)) return true;
122124
Class[] interfaces = testClass.getInterfaces();
123125
for (int i=0; i<interfaces.length; i++) {
124126
if (IMoleculeSet.class.equals(interfaces[i])) return true;

src/main/org/openscience/cdk/io/SMILESReader.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ public void setReader(InputStream input) throws CDKException {
131131

132132
@TestMethod("testAccepts")
133133
public boolean accepts(Class classObject) {
134+
if (IMoleculeSet.class.equals(classObject)) return true;
135+
if (IChemFile.class.equals(classObject)) return true;
134136
Class[] interfaces = classObject.getInterfaces();
135137
for (Class anInterface : interfaces) {
136138
if (IChemFile.class.equals(anInterface)) return true;

src/main/org/openscience/cdk/io/rdf/CDKOWLReader.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public void setReader(InputStream input) throws CDKException {
9999
/** {@inheritDoc} */
100100
@TestMethod("testAccepts")
101101
public boolean accepts(Class<? extends IChemObject> classObject) {
102+
if (IMolecule.class.equals(classObject)) return true;
102103
Class[] interfaces = classObject.getInterfaces();
103104
for (int i=0; i<interfaces.length; i++) {
104105
if (IMolecule.class.equals(interfaces[i])) return true;

src/main/org/openscience/cdk/io/rdf/CDKOWLWriter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public void close() throws IOException {
8787
/** {@inheritDoc} */
8888
@TestMethod("testAccepts")
8989
public boolean accepts(Class classObject) {
90+
if (IMolecule.class.equals(classObject)) return true;
9091
Class[] interfaces = classObject.getInterfaces();
9192
for (int i = 0; i < interfaces.length; i++) {
9293
if (IMolecule.class.equals(interfaces[i])) return true;

0 commit comments

Comments
 (0)