Skip to content

Commit 026be04

Browse files
committed
Polish CoroutinesAnnotationTransactionInterceptorTests
1 parent 45ae00f commit 026be04

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

spring-tx/src/test/kotlin/org/springframework/transaction/annotation/CoroutinesAnnotationTransactionInterceptorTests.kt

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -58,12 +58,10 @@ class CoroutinesAnnotationTransactionInterceptorTests {
5858
proxyFactory.setTarget(TestWithCoroutines())
5959
proxyFactory.addAdvice(TransactionInterceptor(rtm, source))
6060
val proxy = proxyFactory.proxy as TestWithCoroutines
61-
runBlocking {
62-
try {
61+
assertThatIllegalStateException().isThrownBy {
62+
runBlocking {
6363
proxy.suspendingNoValueFailure()
6464
}
65-
catch (ex: IllegalStateException) {
66-
}
6765
}
6866
assertReactiveGetTransactionAndRollbackCount(1)
6967
}
@@ -86,12 +84,9 @@ class CoroutinesAnnotationTransactionInterceptorTests {
8684
proxyFactory.setTarget(TestWithCoroutines())
8785
proxyFactory.addAdvice(TransactionInterceptor(rtm, source))
8886
val proxy = proxyFactory.proxy as TestWithCoroutines
89-
runBlocking {
90-
try {
87+
assertThatIllegalStateException().isThrownBy {
88+
runBlocking {
9189
proxy.suspendingValueFailure()
92-
fail("No exception thrown as expected")
93-
}
94-
catch (ex: IllegalStateException) {
9590
}
9691
}
9792
assertReactiveGetTransactionAndRollbackCount(1)

0 commit comments

Comments
 (0)