Code example for SQLDataException

Methods: getCause, getErrorCode, getMessage, getSQLState

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