Package javax.sql.rowset.serial

Examples of javax.sql.rowset.serial.SQLInputImpl


     * @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());
    }
View Full Code Here


    /**
     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readShort()}
     */
    public void testReadShort() throws SQLException {
        Object[] attributes = new Object[] { Short.valueOf("3") };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        assertEquals((short) 3, impl.readShort());

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

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

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

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

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

     * @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

     * @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

     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readAsciiStream()}
     */
    public void testReadAsciiStream() throws SQLException {
        InputStream stream = new ByteArrayInputStream("abc".getBytes());
        Object[] attributes = new Object[] { stream };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        assertEquals(stream, impl.readAsciiStream());

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

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

     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readBigDecimal()}
     */
    public void testReadBigDecimal() throws SQLException {
        BigDecimal bd = new BigDecimal("12.5");
        Object[] attributes = new Object[] { bd };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        assertEquals(bd, impl.readBigDecimal());

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

        attributes = new Object[] { null };
        impl = new SQLInputImpl(attributes, new HashMap<String, Class<?>>());
        assertNull(impl.readBigDecimal());
    }
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.