>
>
>>
>> All: any clue for a unit test here? I do not... I think this fix will
>> go into the library without unit test... if someone does come up with
>> one, we can always add that later...
>>
>
>

Actually, any of the existing IteratingMDLReader tests would do, by
emulating "broken" InputStreamReader :

+  @Test public void testSDF_broken_stream() throws Exception {
+        String filename = "data/mdl/test2.sdf";
+        logger.info("Testing: " + filename);
+        InputStream ins =
this.getClass().getClassLoader().getResourceAsStream(filename);
+       InputStreamReader streamReader = new InputStreamReader(ins) {
+               @Override
+               public boolean ready() throws IOException {
+                       return false;
+               }
+       };
+
+       IteratingMDLReader reader = new IteratingMDLReader(
+            streamReader, DefaultChemObjectBuilder.getInstance()
+        );
+
+        int molCount = 0;
+        while (reader.hasNext()) {
+            Object object = reader.next();
+            Assert.assertNotNull(object);
+            Assert.assertTrue(object instanceof Molecule);
+            molCount++;
+            Assert.assertEquals("Molecule # was not in MDL V2000 format: "
+ molCount,
+                    MDLV2000Format.getInstance(), reader.getFormat());
+        }
+
+        Assert.assertEquals(6, molCount);
+    }
+

Best regards,
Nina
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to