Add missing test for IllegalArgumentException
Backport Bot / build (push) Has been cancelled
Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled
Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled
Details
Build and Deploy Snapshot / Verify (push) Has been cancelled
Details
Backport Bot / build (push) Has been cancelled
Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Has been cancelled
Details
Deploy Docs / Dispatch docs deployment (push) Has been cancelled
Details
Build and Deploy Snapshot / Verify (push) Has been cancelled
Details
See gh-35111
This commit is contained in:
parent
61474cc34c
commit
511739e3de
|
@ -17,11 +17,11 @@
|
|||
package org.springframework.orm.jpa.hibernate;
|
||||
|
||||
import jakarta.persistence.OptimisticLockException;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.dialect.lock.OptimisticEntityLockException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.orm.ObjectOptimisticLockingFailureException;
|
||||
import org.springframework.orm.jpa.JpaDialect;
|
||||
import org.springframework.orm.jpa.JpaOptimisticLockingFailureException;
|
||||
|
@ -40,7 +40,7 @@ class HibernateJpaDialectTests {
|
|||
@Test
|
||||
void testTranslateException() {
|
||||
// Plain JPA exception
|
||||
PersistenceException ex = new OptimisticLockException();
|
||||
RuntimeException ex = new OptimisticLockException();
|
||||
assertThat(dialect.translateExceptionIfPossible(ex))
|
||||
.isInstanceOf(JpaOptimisticLockingFailureException.class).hasCause(ex);
|
||||
|
||||
|
@ -53,6 +53,11 @@ class HibernateJpaDialectTests {
|
|||
ex = new HibernateException(new OptimisticEntityLockException("", ""));
|
||||
assertThat(dialect.translateExceptionIfPossible(ex))
|
||||
.isInstanceOf(ObjectOptimisticLockingFailureException.class).hasCause(ex);
|
||||
|
||||
// IllegalArgumentException
|
||||
ex = new IllegalArgumentException("");
|
||||
assertThat(dialect.translateExceptionIfPossible(ex))
|
||||
.isInstanceOf(InvalidDataAccessApiUsageException.class).hasCause(ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue