Polishing

This commit is contained in:
Sam Brannen 2020-04-06 14:42:23 +02:00
parent f8ab19dc68
commit dc5ddffd03
1 changed files with 5 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 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.
@ -205,13 +205,10 @@ public abstract class TestContextTransactionUtils {
"Only one TransactionManagementConfigurer may exist in the ApplicationContext");
if (configurers.size() == 1) {
TransactionManager tm = configurers.values().iterator().next().annotationDrivenTransactionManager();
if (tm instanceof PlatformTransactionManager) {
return (PlatformTransactionManager) tm;
}
else {
throw new IllegalStateException(
"Specified transaction manager is not a PlatformTransactionManager: " + tm);
}
Assert.state(tm instanceof PlatformTransactionManager, () ->
"Transaction manager specified via TransactionManagementConfigurer " +
"is not a PlatformTransactionManager: " + tm);
return (PlatformTransactionManager) tm;
}
}