@@ -0,0 +1,1744 @@
+package com.brogrammers.agora.test;%0A%0Aimport junit.framework.TestCase;%0A%0Apublic class AddComments extends TestCase %7B%0A%09// These are singletons%0A%09User user = new User();%0A%09WebServiceModel webServiceModel = new WebServiceModel;%0A%09LocalCacheModel localCacheModel = new LocalCacheModel;%0A%09QuestionController controller = new QuestionController();%0A%09%0A%09String questionTitle = %22Scald vs Surf. Which one?%22;%0A%09String questionBody = %22Water with burh too OP? Or Power Level of SURF?%22;%0A%09String answerBody = %22Neither. Use Hydro Pump%22;%0A%09String comment1 = %22I liek Rain Dance%22;%0A%09%0A%09controller.addQuestion(questionTitle, questionBody, null);%0A%09%0A%09Question q1 = webServiceModel.getQuestions()%5B0%5D;%0A%09long q1id = q1.getUniqueID();%0A%09controller.addAnswer(answerBody, null, q1id);%0A%09Answer a1 = q1.getAnswers()%5B0%5D;%0A%09long a1id = a1.getUniqueID();%0A%09%0A%09Question q1c = localCacheModel.getQuestions()%5B0%5D;%0A%09long q1cid = q1c.getUniqueID();%0A%09Answer a1c = q1c.getAnswers()%5B0%5D;%0A%09long a1cid = a1c.getUniqueID();%0A%09%0A%09void testAddCommentToQ() %7B %0A%09%09controller.addComment(comment1, q1id);%0A%09%09assertSame(%22Q1 comment did not get added in web model%22, q1.getComments()%5B0%5D.getBody(), comment1);%0A%09%09assertSame(%22Q1 comment did not get added in cache model%22, q1c.getComments()%5B0%5D.getBody(), comment1);%0A%09%7D%0A%09%0A%09void testAddCommentToA() %7B%0A%09%09controller.addComment(comment1, a1id);%0A%09%09assertSame(%22A1 comment did not get added in web model%22, a1.getComments()%5B0%5D.getBody(), comment1);%0A%09%09assertSame(%22A1 comment did not get added in cache model%22, a1c.getComments()%5B0%5D.getBody(), comment1);%0A%09%09assertSame(%22Q1 comment got destroyed by adding A1 to Web Model%22, q1.getComments()%5B0%5D.getBody(), comment1);%0A%09%09assertSame(%22Q1 comment got destroyed by adding A1 to Cache%22, q1c.getComments()%5B0%5D.getBody(), comment1);%0A%09%7D%0A%09%0A%09%0A%09%0A%7D%0A%0A%7D%0A

Add Comments jCase Test