package ca.ualberta.cs.f14t07_application.test;

import android.test.ActivityInstrumentationTestCase2;

public class SearchTest extends ActivityInstrumentationTestCase2<QuestionList> {

    public SearchTest(){
    	super(ForumEntryList.class);
    }

    public void getSearchTermTest(){
    	String searchTerm = "foo";
    	String inputedTerm = getSearchTerm();
    	assertEquals(inputedTerm,searchTerm);	
    }

    public void sortBySearchTerm()){
    	ForumEntryList posts = new ForumEntryList;
		posts.add(new ForumEntry("no term"));
		posts.add(new ForumEntry("still no term"));
		posts.add(new ForumEntry("has foo!"));
		posts.add(new ForumEntry("has foo foo twice!")); //If it has the search term twice, it should probably be above? (Tested in sortedList2)
		posts.sortBySearchTerm("foo");

		ArrayList<ForumEntry> sortedList = new ArrayList<ForumEntry>();
		sortedList.add(new ForumEntry("has foo!"));
		sortedList.add(new ForumEntry("has foo foo twice!"));
		sortedList.add(new ForumEntry("no term"));
		sortedList.add(new ForumEntry("still no term"));
		assertEquals(posts.getlist(), sortedList);
		
		ArrayList<ForumEntry> sortedList2 = new ArrayList<ForumEntry>();
		sortedList2.add(new ForumEntry("has foo foo twice!"));
		sortedList2.add(new ForumEntry("has foo!"));
		sortedList2.add(new ForumEntry("no term"));
		sortedList2.add(new ForumEntry("still no term"));
		assertEquals(posts.getlist(), sortedList2);
    }

}

@@ -166,20 +166,22 @@
 se2%3C
-QuestionList
+SearchActivity
 %3E %7B%0A
@@ -217,30 +217,30 @@
  %09super(
-ForumEntryList
+SearchActivity
 .class);
@@ -263,19 +263,16 @@
 ic void 
-get
 SearchTe
@@ -313,16 +313,541 @@
  %22foo%22;%0A
+    %09SearchText = (EditText) SearchActivity.findViewById(com.example.f14t07_application.activity_searchactivity.R.id.SearchText);%0A    %09SearchText.setText(%22foo%22);%0A    %0A    %09SearchButton = (Button) SearchActivity.findViewById(com.example.f14t07_application.activity_searchactivity.R.id.SearchButton);%0A    %09SearchButton.performClick();%0A    %09%0A    %09Intent newIntent = getStartedActivityIntent();%0A    %09Intent searchIntent = new Intent(SearchTest.this, SearchActivity.class);%0A    %09assertTrue(newIntent.filterEquals(searchIntent));%0A%0A
     %09Str
@@ -864,19 +864,16 @@
 dTerm = 
-get
 SearchTe
@@ -1625,16 +1625,18 @@
 ist);%0A%09%09
+/*
 %0A%09%09Array
@@ -1942,16 +1942,18 @@
 dList2);
+*/
 %0A    %7D%0A%0A

Update SearchTest.java