Browse Source

Polishing

pull/24871/head
Sam Brannen 5 years ago
parent
commit
dc5ddffd03
  1. 13
      spring-test/src/main/java/org/springframework/test/context/transaction/TestContextTransactionUtils.java

13
spring-test/src/main/java/org/springframework/test/context/transaction/TestContextTransactionUtils.java

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

Loading…
Cancel
Save