I am using Sugar ORM for db and Robolectric for unit testing. To use Sugar ORM with Robolectric i followed this question.
Where i put my code below in to startEverTestSugarAppAsFirst method and run.
new PersonHandler(new Activity()).insertPeople();
Person p = Person.findById(Person.class, 1);
System.out.println(p.getName());
It prints the name of the first record. So far so good.
But if i comment out //new PersonHandler(new Activity()).insertPeople();
and run again no records are returned and null pointer exception is given. I thought that Sugar ORM stored records at the first run to somewhere and i can access to these records at the second time.
On the other hand, if I run the emulator where i put the code below in my main activity's onCreate method and in the second run with commenting out the first line I can see the first record printed in the log.
new PersonHandler(this).insertPeople();
Person p = Person.findById(Person.class, 1);
Log.v("person", p.getName());
So, Does Sugar ORM delete db after unit test ends? or where it saves the db so i can use it over and over again?