package ca.ualberta.cs.cmput301f14t14.questionapp.test;

import android.net.Uri;
import ca.ualberta.cs.cmput301f14t14.questionapp.model.Answer;
import ca.ualberta.cs.cmput301f14t14.questionapp.model.Image;
import ca.ualberta.cs.cmput301f14t14.questionapp.model.Question;
import junit.framework.TestCase;

public class ImageTest extends TestCase {

	Question mQuestion;
	Answer mAnswer;

	protected void setUp() throws Exception {
		super.setUp();;
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}
	
	/**
	 * UC7 TC7.1, 7.2 - Attach an Image
	 */
	
	public void testAddImage() {
		Image image = new Image(Uri.parse("android.resource://QuestionAppTests/drawable/under64"), null);
		mQuestion = new Question("Title", "QBody", "Author", image);
		mAnswer = new Answer(mQuestion.getId(), "ABody", "Author", image);
		assertNotNull(mAnswer.getImage());
		assertNotNull(mQuestion.getImage());
	}
	
	/**
	 * UC7 TC7.3 - Image too big
	 */
	public void testPathFileTooBig() {
		try {
			Uri local = null;
			local = Uri.parse("android.resource://QuestionAppTests/drawable/over64");
			Image tooBig = new Image(local, null);
			fail("Try giving a smaller image.");
		}
		catch(IllegalArgumentException e){
			//Passed
		}
	}


	
}

@@ -69,15 +69,98 @@
 oid.
-net.Uri
+app.Activity;%0Aimport android.net.Uri;%0Aimport android.test.ActivityInstrumentationTestCase2
 ;%0Aim
@@ -416,18 +416,103 @@
 nds 
-TestCase %7B
+ActivityInstrumentationTestCase2%3CActivity%3E %7B%0A%0A%09public ImageTest() %7B%0A%09%09super(Activity.class);%0A%09%7D
 %0A%0A%09Q
@@ -789,16 +789,51 @@
 w Image(
+getInstrumentation().getContext(), 
 Uri.pars
@@ -889,22 +889,16 @@
 nder64%22)
-, null
 );%0A%09%09mQu
@@ -1319,18 +1319,47 @@
 age(
-local, nul
+getInstrumentation().getContext(), loca
 l);%0A

Update test case