Package javax.sql.rowset.serial

Examples of javax.sql.rowset.serial.SQLInputImpl


     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readTime()}
     */
    public void testReadTime() throws SQLException {
        Time time = new Time(345);
        Object[] attributes = new Object[] { time };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        assertEquals(time, impl.readTime());

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

        attributes = new Object[] { null };
        impl = new SQLInputImpl(attributes, new HashMap<String, Class<?>>());
        assertNull(impl.readTime());
    }
View Full Code Here


     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readTimestamp()}
     */
    public void testReadTimestamp() throws SQLException {
        Timestamp time = new Timestamp(345);
        Object[] attributes = new Object[] { time };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        assertEquals(time, impl.readTimestamp());

        try {
            impl.readTimestamp();
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }
    }
View Full Code Here

     */
    public void testReadURL() throws SQLException, MalformedURLException {
        URL url = new URL("http://www.apache.org");
        SerialDatalink link = new SerialDatalink(url);
        Object[] attributes = new Object[] { link };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        try {
            impl.readURL();
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }

        try {
            impl.readURL();
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }
    }
View Full Code Here

     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#wasNull()}
     *
     */
    public void testWasNull() throws SQLException {
        Object[] attributes = new Object[] { null, "hello" };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        assertFalse(impl.wasNull());
        assertEquals(null, impl.readString());
        assertTrue(impl.wasNull());
        assertEquals("hello", impl.readString());
        assertFalse(impl.wasNull());
        try {
            impl.readString();
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }
        assertFalse(impl.wasNull());
        assertFalse(impl.wasNull());
    }
View Full Code Here

     * @since 1.6
     */
    public void testReadNClob() throws SQLException {
        NClob nclob = new MockNClob();
        Object[] attributes = new Object[] { null, nclob };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        try {
            impl.readNClob();
            fail("should throw UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
            // expected
        }

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

        try {
            impl.readNClob();
            fail("should throw UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
            // expected
        }
    }
View Full Code Here

     *
     * @since 1.6
     */
    public void testReadNString() throws SQLException {
        Object[] attributes = new Object[] { null, "hello" };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        try {
            impl.readNString();
            fail("should throw UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
            // expected
        }

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

        try {
            impl.readNString();
            fail("should throw UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
            // expected
        }
    }
View Full Code Here

     * @since 1.6
     */
    public void testReadRowId() throws SQLException {
        RowId rowId = new MockRowId();
        Object[] attributes = new Object[] { null, rowId };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        try {
            impl.readRowId();
            fail("should throw UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
            // expected
        }

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

        try {
            impl.readRowId();
            fail("should throw UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
            // expected
        }
    }
View Full Code Here

     * @since 1.6
     */
    public void testReadSQLXML() throws SQLException {
        SQLXML sqlXML = new MockSQLXML();
        Object[] attributes = new Object[] { null, sqlXML };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        try {
            impl.readSQLXML();
            fail("should throw UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
            // expected
        }

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

        try {
            impl.readSQLXML();
            fail("should throw UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
            // expected
        }
    }
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    public void test_Constructor() {

        try {
            new SQLInputImpl(null, new HashMap());
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }

        try {
            new SQLInputImpl(null, null);
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }

        try {
            new SQLInputImpl(new Object[0], null);
            fail("should throw SQLException");
        } catch (SQLException e) {
            // expected
        }
    }
View Full Code Here

     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readArray()}
     */
    public void testReadArray() throws SQLException {
        Array array = new MockArray();
        Object[] attributes = new Object[] { array };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        assertEquals(array, impl.readArray());

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

        attributes = new Object[] { null };
        impl = new SQLInputImpl(attributes, new HashMap<String, Class<?>>());
        assertNull(impl.readArray());
    }
View Full Code Here

TOP

Related Classes of javax.sql.rowset.serial.SQLInputImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.