Code example for SQLTransientException

Methods: getCause, getErrorCode, getMessage, getSQLState

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