package com.example.ollie;

import com.example.ollie.model.Note;
import com.example.ollie.shadows.PersistentShadowSQLiteOpenHelper;
import ollie.Ollie;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import static org.fest.assertions.api.Assertions.assertThat;

@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE, shadows = PersistentShadowSQLiteOpenHelper.class)
public class OllieTest {
	@Before
	public void initialize() {
		Ollie.init(Robolectric.application, "OllieSample.db", 1);
	}

	@Test
	public void testSaveEntity() {
		Note note = new Note();

		assertThat(note.id).isNull();

		note.title = "Test note";
		note.body = "Testing saving a note.";
		note.save();

		assertThat(note.id).isNotNull();
		assertThat(note.id).isGreaterThan(0l);
	}

	@Test
	public void testLoadEntity() {
		Note note = Note.find(Note.class, 1l);

		assertThat(note).isNotNull();
		assertThat(note.id).isNotNull();
		assertThat(note.id).isGreaterThan(0l);
	}
}
@@ -170,16 +170,46 @@
 Before;%0A
+import org.junit.BeforeClass;%0A
 import o
@@ -223,16 +223,16 @@
 t.Test;%0A
-
 import o
@@ -381,16 +381,38 @@
 onfig;%0A%0A
+import java.io.File;%0A%0A
 import s
@@ -585,16 +585,16 @@
 .class)%0A
-
 public c
@@ -610,16 +610,101 @@
 eTest %7B%0A
+%09@BeforeClass%0A%09public static void preInitialize() %7B%0A%09%09new File(%22path%22).delete();%0A%09%7D%0A%0A
 %09@Before

Delete old sqlite db before running tests.