Announcement Announcement Module
Collapse
No announcement yet.
Committing transactions within AbstractTransactionalJUnit4SpringContextTests methods Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Committing transactions within AbstractTransactionalJUnit4SpringContextTests methods

    Hi,

    I have some legacy code that creates its own database connection. To test this code I extended from AbstractTransactionalSpringContextTests like this:

    Code:
    public class LegacyCodeTest extends AbstractTransactionalSpringContextTests {
    	public void testLegacyCode() {
    		// set up test data in database
    
    		setComplete();
    		endTransaction();
    		startNewTransaction();
    
    		// call legacy code - this code creates its own database connection
    
    		// verify results in database
    	}
    }
    Now I'd like to do the same in JUnit 4 style, i.e. by extending AbstractTransactionalJUnit4SpringContextTests. This class doesn't have the methods setComplete(), endTransaction() and startNewTransaction(). How can I write my test?
Working...
X