Code example for SQLIntegrityConstraintViolationException

Methods: getCause, getErrorCode, getMessage, getSQLState

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