From 026be04b75459dfd2a45560bbc8f04f63c397d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Mon, 13 Feb 2023 14:59:07 +0100 Subject: [PATCH] Polish CoroutinesAnnotationTransactionInterceptorTests --- ...utinesAnnotationTransactionInterceptorTests.kt | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/spring-tx/src/test/kotlin/org/springframework/transaction/annotation/CoroutinesAnnotationTransactionInterceptorTests.kt b/spring-tx/src/test/kotlin/org/springframework/transaction/annotation/CoroutinesAnnotationTransactionInterceptorTests.kt index 6130b4941f..4ec5b21d6d 100644 --- a/spring-tx/src/test/kotlin/org/springframework/transaction/annotation/CoroutinesAnnotationTransactionInterceptorTests.kt +++ b/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"); * you may not use this file except in compliance with the License. @@ -58,12 +58,10 @@ class CoroutinesAnnotationTransactionInterceptorTests { proxyFactory.setTarget(TestWithCoroutines()) proxyFactory.addAdvice(TransactionInterceptor(rtm, source)) val proxy = proxyFactory.proxy as TestWithCoroutines - runBlocking { - try { + assertThatIllegalStateException().isThrownBy { + runBlocking { proxy.suspendingNoValueFailure() } - catch (ex: IllegalStateException) { - } } assertReactiveGetTransactionAndRollbackCount(1) } @@ -86,12 +84,9 @@ class CoroutinesAnnotationTransactionInterceptorTests { proxyFactory.setTarget(TestWithCoroutines()) proxyFactory.addAdvice(TransactionInterceptor(rtm, source)) val proxy = proxyFactory.proxy as TestWithCoroutines - runBlocking { - try { + assertThatIllegalStateException().isThrownBy { + runBlocking { proxy.suspendingValueFailure() - fail("No exception thrown as expected") - } - catch (ex: IllegalStateException) { } } assertReactiveGetTransactionAndRollbackCount(1)