Adapt test to current 5.0+ behavior

See gh-24502
This commit is contained in:
Juergen Hoeller 2023-12-30 10:47:52 +01:00
parent 153f8895cb
commit 473efb6d4f
1 changed files with 9 additions and 9 deletions

View File

@ -20,7 +20,6 @@ import java.util.Collection;
import java.util.Map;
import java.util.Properties;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.aop.support.AopUtils;
@ -290,16 +289,15 @@ public class EnableTransactionManagementTests {
}
@Test
@Disabled("gh-24502")
public void gh24502AppliesTransactionOnlyOnAnnotatedInterface() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(Gh24502ConfigA.class);
Object bean = ctx.getBean("testBean");
CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class);
((TransactionalInterface)bean).methodOne();
((NonTransactionalInterface)bean).methodTwo();
assertThat(txManager.begun).isEqualTo(1);
assertThat(txManager.commits).isEqualTo(1);
((TransactionalInterface) bean).methodOne();
((NonTransactionalInterface) bean).methodTwo();
assertThat(txManager.begun).isEqualTo(2);
assertThat(txManager.commits).isEqualTo(2);
assertThat(txManager.rollbacks).isEqualTo(0);
ctx.close();
@ -565,18 +563,20 @@ public class EnableTransactionManagementTests {
}
}
@Transactional
interface TransactionalInterface {
void methodOne();
}
interface NonTransactionalInterface {
void methodTwo();
}
static class MixedTransactionalTestService implements TransactionalInterface, NonTransactionalInterface {
@Override
@ -588,8 +588,9 @@ public class EnableTransactionManagementTests {
}
}
@Configuration
@EnableTransactionManagement(proxyTargetClass = false)
@EnableTransactionManagement
static class Gh24502ConfigA {
@Bean
@ -601,7 +602,6 @@ public class EnableTransactionManagementTests {
public PlatformTransactionManager txManager() {
return new CallCountingTransactionManager();
}
}
}