Code example for SQLDataException

Methods: getCause, getErrorCode, getMessage, getSQLState

0
 
    /** 
     * @test java.sql.SQLDataException(String, String, int, Throwable) 
     */ 
    public void test_Constructor_LStringLStringILThrowable_9() { 
        SQLDataException sQLDataException = new SQLDataException(
                "MYTESTSTRING", null, 0, null); 
        assertNotNull(sQLDataException);
        assertNull("The SQLState of SQLDataException should be null",
                sQLDataException.getSQLState());
        assertEquals(
                "The reason of SQLDataException set and get should be equivalent", 
                "MYTESTSTRING", sQLDataException.getMessage());
        assertEquals("The error code of SQLDataException should be 0",
                sQLDataException.getErrorCode(), 0);
        assertNull("The cause of SQLDataException should be null",
                sQLDataException.getCause());
    } 
 
    /** 
     * @test java.sql.SQLDataException(String, String, int, Throwable) 
     */