Importance of flushing data in unit test cases

While writing unit test cases, it is a good practice to clear and flush the session. When an application is executed in real time, there are several requests, responses or different transactions due to which the session/cache gets cleared. On the other hand, while running a unit test, everything happens as part of a single process i.e the session (especially hibernate) has rotten values or old references which leads to raising of certain exceptions at times.

Aseem JainAseem Jain | 14th July 2015
Data,Flushing, Unit test cases, Repository, Transactions