2008/04/08

blob test [junit]

 public void testGetAttachment() throws SQLException {
  String s = "lavasoft";
  Blob value = new SerialBlob( s.getBytes() );
  TvAttach tvObj = new TvAttach();
  tvObj.setAttachment( value );
  assertEquals( tvObj.getAttachment(), value );
  byte[] b2 = tvObj.getAttachment().getBytes( 1, (int)tvObj.getAttachment().length() );
  assertEquals( s, new String(b2) );
 }

No comments: