@@ -0,0 +1,2286 @@
+import static org.junit.Assert.*;%0A%0Aimport org.junit.Test;%0A%0Aimport android.test.ActivityInstrumentationTestCase2;%0A%0Aimport ca.ualberta.cs.cmput301t03app.MainActivity;%0A%0Apublic class theoTest extends ActivityInstrumentationTestCase2%3CMainActivity%3E%0A%7B%0A%09public theoTest() %7B%0A%09%09super(MainActivity.class);%0A%09%7D%0A%09%0A%09// Creates a list of questions and and list of answers%0A%09// iterates through all existing questions and answers, favoriting%0A%09// each question and answer and then adding them to the%0A%09// question and answer lists.%0A%09// It then uses the getter methods for favourites answers%0A%09// and questions and then compares the two lists%0A%09// which should be equal%0A%09%0A%09public void testViewFavorites() %7B%0A%09%09%0A%09%09ArrayList%3CQuestion%3E favQuestions = new ArrayList%3CQuestion%3E();%0A%09%09ArrayList%3CAnswer%3E favAnswer = new ArrayList%3CAnswer%3E();%0A%09%09forumQuestionList listTest = new forumQuestionList;%0A%09%09ArrayList%3CQuestion%3E q = listTest.getList();%0A%09%09ArrayList%3CAnswer%3E a = new ArrayList%3CAnswer%3E();%0A%09%09for(int i = 0; i %3C q.size(); i++) %7B%0A%09%09%09User.addFavQuestion(q.indexOf(i));%0A%09%09%09ArrayList%3CAnswer%3E temp = q.indexOf(i).getAnswers();%0A%09%09%09for(int j = 0; j %3C temp.size(); j++) %7B%0A%09%09%09%09User.addFavAnswer(temp.indexOf(j));%0A%09%09%09%09a.add(temp.indexOf(j))%0A%09%09%09%7D%0A%09%09%7D%0A%09%09favQuestions = User.getFavQuestions();%0A%09%09favAnswers = User.getFavAnswers();%0A%09%09assertEquals(favQuestions,q);%0A%09%09assertEquals(favAnswers,a);%0A%09%7D%0A%09%0A%09// Creates a dummy questions, adds an upvote%0A%09// asserts that the question has one upvote%0A%09%0A%09public void testUpvoteQuestions() %7B%0A%09%09%0A%09%09Question testQuestion = new Question;%0A%09%09testQuestions.changeRating();%0A%09%09assertEquals(testQuestion.getRating(),1);%0A%09%7D%0A%09%0A%09// Creates dummy answer, adds and upvote%0A%09// asserts that the question has one upvote%0A%09%0A%09public void testUpvoteAnswers() %7B%0A%09%09%0A%09%09Answer testAnswer = new Answer;%0A%09%09testAnswers.changeRating();%0A%09%09assertEquals(testAnswer.getRating(), 1);%0A%09%7D%0A%09%0A%09// Creates a dummy author, uses a dummy function%0A%09// of uploading a test jpg file, sets the author profile%0A%09// picture to the newly uploaded file.%0A%09// Asserts with a getter method that the jpg returned and%0A%09// the jpg uploaded are the same.%0A%09%0A%09public void testProfilePic() %7B%0A%09%09Author newAuthor = new Author;%0A%09%09profilePic = uploadPic(%22test.jpg%22);%0A%09%09newAuthor.setProfile(profilePic);%0A%09%09assertEquals(%22test.jpg%22,newAuthor.getProfilePic());%0A%09%7D%0A%7D%0A

hello world