/** @tests {@link javax.sql.rowset.serial.SQLInputImpl#readRef()} */
  public void testReadRef() throws SQLException {
    Ref ref = new MockRef();
    Object[] attributes = new Object[] {ref};
    SQLInputImpl impl = new SQLInputImpl(attributes, new HashMap<String, Class<?>>());
    assertEquals(ref, impl.readRef());

    try {
      impl.readRef();
      fail("should throw SQLException");
    } catch (SQLException e) {
      // expected
    }

    attributes = new Object[] {null};
    impl = new SQLInputImpl(attributes, new HashMap<String, Class<?>>());
    assertNull(impl.readRef());
  }
Ejemplo n.º 2
0
 /*
  * Validate a Ref can be read
  */
 @Test(enabled = true)
 public void test09() throws Exception {
   Ref ref = new StubRef(sqlType, hero);
   Object[] values = {ref};
   SQLInputImpl sqli = new SQLInputImpl(values, map);
   Ref ref2 = sqli.readRef();
   assertTrue(ref.getObject().equals(ref2.getObject()));
   assertTrue(ref.getBaseTypeName().equals(ref2.getBaseTypeName()));
 }