/** @tests {@link javax.sql.rowset.serial.SQLInputImpl#readInt()} */ public void testReadInt() throws SQLException { Object[] attributes = new Object[] {Integer.valueOf("3")}; SQLInputImpl impl = new SQLInputImpl(attributes, new HashMap<String, Class<?>>()); assertEquals(3, impl.readInt()); try { impl.readInt(); fail("should throw SQLException"); } catch (SQLException e) { // expected } attributes = new Object[] {null}; impl = new SQLInputImpl(attributes, new HashMap<String, Class<?>>()); assertEquals(0, impl.readInt()); }
/* * Validate that wasNull indicates if a null was read in */ @Test() public void test04() throws Exception { Object[] values = {"Hello", null, 1}; SQLInputImpl sqli = new SQLInputImpl(values, map); String s = sqli.readString(); assertFalse(sqli.wasNull()); s = sqli.readString(); assertTrue(sqli.wasNull()); int i = sqli.readInt(); assertFalse(sqli.wasNull()); }