Code example for SQLDataException

Methods: getCause, getErrorCode, getMessage, getSQLState

0
 
    /** 
     * @test java.sql.SQLDataException(String, String, int, Throwable) 
     */ 
    public void test_Constructor_LStringLStringILThrowable_15() { 
        SQLDataException sQLDataException = new SQLDataException(null,
                "MYTESTSTRING", 0, null); 
        assertNotNull(sQLDataException);
        assertEquals(
                "The SQLState of SQLDataException set and get should be equivalent", 
                "MYTESTSTRING", sQLDataException.getSQLState());
        assertNull("The reason of SQLDataException should be null",
                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)