Just add @Transactional annotation on top of your test:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"testContext.xml"})
@Transactional
public class StudentSystemTest {
By default Spring will start a new transaction surrounding your test method and @Before/@After callbacks, rolling back at the end. It works by default, it’s enough to have some transaction manager in the context.
From: 10.3.5.4 Transaction management (bold mine):
In the TestContext framework, transactions are managed by the TransactionalTestExecutionListener. Note that
TransactionalTestExecutionListeneris configured by default, even if you do not explicitly declare@TestExecutionListenerson your test class. To enable support for transactions, however, you must provide aPlatformTransactionManagerbean in the application context loaded by@ContextConfigurationsemantics. In addition, you must declare@Transactionaleither at the class or method level for your tests.