Hello I would like to use Unit Tests to see if my Data Save Structe is working the problem is, that I have no Idea how to Simulate a Restart programmatically.
Here is a Example Unit Test.
(AppData is just a Class to save various Things like a Shopping List with multiple Entries.)
@Test
public void getDataAfterRestart(){
//Save a Entry
AppData appData = new AppData();
appData.addShoppingEntry(new ShoppingEntry("Bread"));
appData.save();
//************************
//Restart the Application*
//************************
//After the App reopend it self check if the Entry is still here
int entries = appData.getShoppingEntries().size();
assertEquals(1,entries);
}
What are some good practices, to deal with problems like this?
Thank you in advance!