Browse Source

Adapt test to current 5.0+ behavior

See gh-24502
pull/31930/head
Juergen Hoeller 2 years ago
parent
commit
473efb6d4f
  1. 18
      spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java

18
spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java

@ -20,7 +20,6 @@ import java.util.Collection; @@ -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 { @@ -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 { @@ -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 { @@ -588,8 +588,9 @@ public class EnableTransactionManagementTests {
}
}
@Configuration
@EnableTransactionManagement(proxyTargetClass = false)
@EnableTransactionManagement
static class Gh24502ConfigA {
@Bean
@ -601,7 +602,6 @@ public class EnableTransactionManagementTests { @@ -601,7 +602,6 @@ public class EnableTransactionManagementTests {
public PlatformTransactionManager txManager() {
return new CallCountingTransactionManager();
}
}
}

Loading…
Cancel
Save