package ca.ualberta.team7project.tests;

import android.test.ActivityInstrumentationTestCase2;
import ca.ualberta.team7project.MainActivity;
import ca.ualberta.team7project.cache.MemoryToFileOperation;
import ca.ualberta.team7project.cache.ThreadModelPool;

public class CacheBasicOperationTest extends
		ActivityInstrumentationTestCase2<MainActivity> {

	public CacheBasicOperationTest()
	{
		super(MainActivity.class);
	}
	
	//I 
	public void testSaveInFileWithPoolEmpty(){
		
		//populate pool with several examples
		//ThreadModel tm = new ThreadModel("some text", null, "some text too");
		
		MemoryToFileOperation tool = new MemoryToFileOperation(new MainActivity());
		tool.saveInFile();
		tool.loadFromFile();
		
		this.assertEquals(true, ThreadModelPool.threadModelPool.size() == 0);
	}
	
	

}

@@ -249,16 +249,68 @@
 delPool;
+%0Aimport ca.ualberta.team7project.models.ThreadModel;
 %0A%0Apublic
@@ -398,16 +398,44 @@
 ivity%3E %7B
+%0A%09%0A%09private MainActivity ac;
 %0A%0A%09publi
@@ -504,12 +504,8 @@
 %0A%09%0A%09
-//I 
 %0A%09pu
@@ -548,16 +548,300 @@
 y()%7B%0A%09%09%0A
+%09%09ac = this.getActivity();%0A%09%09MemoryToFileOperation tool = new MemoryToFileOperation(ac);%0A%09%09tool.saveInFile();%0A%09%09tool.loadFromFile();%0A%09%09%0A%09%09this.assertEquals(true, ThreadModelPool.threadModelPool.size() == 0);%0A%09%7D%0A%0A%09%0A%09public void testSaveInFilePupulated()%7B%0A%09%09ac = this.getActivity();%0A%09%09%0A
 %09%09//popu
@@ -874,18 +874,16 @@
 mples%0A%09%09
-//
 ThreadMo
@@ -944,19 +944,16 @@
  too%22);%0A
-%09%09%0A
 %09%09Memory
@@ -1005,28 +1005,58 @@
 ion(
-new MainActivity());
+ac);%0A%09%09ThreadModelPool.threadModelPool.add(tm);%0A%09%09
 %0A%09%09t
@@ -1163,25 +1163,25 @@
 l.size() == 
-0
+1
 );%0A%09%7D%0A%09%0A%09%0A%0A%7D

Test passed!!