Browse Source

Polish CoroutinesAnnotationTransactionInterceptorTests

pull/29969/head
Sébastien Deleuze 3 years ago
parent
commit
026be04b75
  1. 11
      spring-tx/src/test/kotlin/org/springframework/transaction/annotation/CoroutinesAnnotationTransactionInterceptorTests.kt

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2022 the original author or authors. * Copyright 2002-2023 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -58,12 +58,10 @@ class CoroutinesAnnotationTransactionInterceptorTests {
proxyFactory.setTarget(TestWithCoroutines()) proxyFactory.setTarget(TestWithCoroutines())
proxyFactory.addAdvice(TransactionInterceptor(rtm, source)) proxyFactory.addAdvice(TransactionInterceptor(rtm, source))
val proxy = proxyFactory.proxy as TestWithCoroutines val proxy = proxyFactory.proxy as TestWithCoroutines
assertThatIllegalStateException().isThrownBy {
runBlocking { runBlocking {
try {
proxy.suspendingNoValueFailure() proxy.suspendingNoValueFailure()
} }
catch (ex: IllegalStateException) {
}
} }
assertReactiveGetTransactionAndRollbackCount(1) assertReactiveGetTransactionAndRollbackCount(1)
} }
@ -86,12 +84,9 @@ class CoroutinesAnnotationTransactionInterceptorTests {
proxyFactory.setTarget(TestWithCoroutines()) proxyFactory.setTarget(TestWithCoroutines())
proxyFactory.addAdvice(TransactionInterceptor(rtm, source)) proxyFactory.addAdvice(TransactionInterceptor(rtm, source))
val proxy = proxyFactory.proxy as TestWithCoroutines val proxy = proxyFactory.proxy as TestWithCoroutines
assertThatIllegalStateException().isThrownBy {
runBlocking { runBlocking {
try {
proxy.suspendingValueFailure() proxy.suspendingValueFailure()
fail("No exception thrown as expected")
}
catch (ex: IllegalStateException) {
} }
} }
assertReactiveGetTransactionAndRollbackCount(1) assertReactiveGetTransactionAndRollbackCount(1)

Loading…
Cancel
Save