db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Korneliussen (JIRA)" <derby-...@db.apache.org>
Subject [jira] Commented: (DERBY-1474) Add assertEquals overloads for Blob and Clob
Date Thu, 06 Jul 2006 13:57:32 GMT
    [ http://issues.apache.org/jira/browse/DERBY-1474?page=comments#action_12419526 ] 

Andreas Korneliussen commented on DERBY-1474:
---------------------------------------------

Just some minor comments (sorry I did not catch this earlier), however I guess these comments
can be addressed in an additional patch:

In this while loops, the code will do a String-concatenation for each byte in the Blob:
+            int by1 = is1.read();
+            int by2 = is2.read();
+            do {
+                assertEquals("Blobs differ at index " + index,
+                        by1, by2);
+                index++;
+                by1 = is1.read();
+                by2 = is2.read();
+            } while ( by1 != -1 || by2 != -1);

Maybe in this case, it is better to do a quick comparison before doing the call to assertEquals.

The other comment, is about exception handling. I find it useful to get the stack trace of
SQLException and IOException.
I would propose to either print the stacktrace (using printStackTrace()), or let the method
throw these exceptions.

+        } catch (IOException ioe) {
+            fail("IOException while asserting Blob equality: " +
+                    ioe.getMessage());
+        }

+        } catch (SQLException sqle) {
+            fail("SQLException while asserting Clob equality: " +
+                    sqle.getMessage());
+        }



> Add assertEquals overloads for Blob and Clob
> --------------------------------------------
>
>          Key: DERBY-1474
>          URL: http://issues.apache.org/jira/browse/DERBY-1474
>      Project: Derby
>         Type: Sub-task

>   Components: Test
>     Versions: 10.2.0.0, 10.3.0.0
>     Reporter: Kristian Waagan
>     Assignee: Kristian Waagan
>      Fix For: 10.2.0.0
>  Attachments: derby-1474-1a.diff, derby-1474-1a.stat, derby-1474-1b.diff, derby-1474-1c.diff
>
> Add assertEquals(Blob,Blob) and assertEquals(Clob,Clob) to BaseJDBCTestCase.
> The naming follows the JUnit scheme, and the methods throws an AssertionFailedError if
the objects passed in are not equal.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message