Code example for SQLNonTransientException

Methods: getCausegetMessagegetErrorCodegetSQLState

0
    /** 
     * @test java.sql.SQLNonTransientException(String, String, int, Throwable) 
     */ 
    public void test_Constructor_LStringLStringILThrowable() { 
        Throwable cause = new Exception("MYTHROWABLE");
        SQLNonTransientException sQLNonTransientException = new SQLNonTransientException(
                "MYTESTSTRING1", "MYTESTSTRING2", 1, cause);
        assertNotNull(sQLNonTransientException);
        assertEquals(
                "The SQLState of SQLNonTransientException set and get should be equivalent", 
                "MYTESTSTRING2", sQLNonTransientException.getSQLState());
        assertEquals(
                "The reason of SQLNonTransientException set and get should be equivalent", 
                "MYTESTSTRING1", sQLNonTransientException.getMessage());
        assertEquals("The error code of SQLNonTransientException should be 1",
                sQLNonTransientException.getErrorCode(), 1);
        assertEquals(
                "The cause of SQLNonTransientException set and get should be equivalent", 
                cause, sQLNonTransientException.getCause());
    } 
 
    /** 
     * @test java.sql.SQLNonTransientException(String, String, int, Throwable) 
     */ 
Contextual code suggestions in your IDE  Get Codota for Java