Package javax.sql.rowset.serial

Examples of javax.sql.rowset.serial.SQLInputImpl


     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readBinaryStream()}
     */
    public void testReadBinaryStream() 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.readBinaryStream());

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


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

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

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

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

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

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

     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readBinaryStream()}
     */
    public void testReadBinaryStream() 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.readBinaryStream());

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

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

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

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

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

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

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

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

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

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

     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readBytes()}
     */
    public void testReadBytes() throws SQLException {
        byte[] bytes = new byte[] { 1, 2, 3 };
        Object[] attributes = new Object[] { bytes };
        SQLInputImpl impl = new SQLInputImpl(attributes,
                new HashMap<String, Class<?>>());
        assertEquals(bytes, impl.readBytes());

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

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

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

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

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