File tree 1 file changed +5
-8
lines changed
spring-test/src/main/java/org/springframework/test/context/transaction
1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2019 the original author or authors.
2
+ * Copyright 2002-2020 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -205,13 +205,10 @@ public static PlatformTransactionManager retrieveTransactionManager(TestContext
205
205
"Only one TransactionManagementConfigurer may exist in the ApplicationContext" );
206
206
if (configurers .size () == 1 ) {
207
207
TransactionManager tm = configurers .values ().iterator ().next ().annotationDrivenTransactionManager ();
208
- if (tm instanceof PlatformTransactionManager ) {
209
- return (PlatformTransactionManager ) tm ;
210
- }
211
- else {
212
- throw new IllegalStateException (
213
- "Specified transaction manager is not a PlatformTransactionManager: " + tm );
214
- }
208
+ Assert .state (tm instanceof PlatformTransactionManager , () ->
209
+ "Transaction manager specified via TransactionManagementConfigurer " +
210
+ "is not a PlatformTransactionManager: " + tm );
211
+ return (PlatformTransactionManager ) tm ;
215
212
}
216
213
}
217
214
You can’t perform that action at this time.
0 commit comments