-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Labels
in: testIssues in the test moduleIssues in the test modulestatus: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancementA general enhancement
Description
Andrei Badea opened SPR-7824 and commented
Have the following test classes:
@ContextConfiguration(...)
public class MyTestBase extends AbstractTestNGSpringContextTests {
protected boolean beforeTransaction;
@Test
public void test() {
Assert.assertTrue(beforeTransaction);
}
}
@TestExecutionListeners({ TransactionalTestExecutionListener.class })
@Transactional
public class MyTest extends MyTestBase {
@BeforeTransaction
public void before() {
beforeTransaction = true;
}
}
Run MyTest.java. The expectation is that the @Transactional
annotation is handled and the test() method runs in a transaction. This does not happen. AbstractFallbackTransactionAttributeSource seems to have been written with interfaces in mind, where the "most specific method" is in the implementation class. So for the case above, one would expect the most specific method to be MyTest.test(), but it actually is MyTestBase.test(). I did not find a way to get a java.lang.reflect.Method handle for MyTest.test().
Affects: 3.0.4
Issue Links:
- @Transactional annotation does not apply to inherited methods from abstract class during tests [SPR-11252] #15877
@Transactional
annotation does not apply to inherited methods from abstract class during tests ("is duplicated by")
Metadata
Metadata
Assignees
Labels
in: testIssues in the test moduleIssues in the test modulestatus: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancementA general enhancement