Can any one help out in this test class. Why do i get an Error as :
Error: Compile Error: unexpected token: '}' at line 27 column 0.
The test class written is right or do i'm making any mistake? Any help is very much appreciated.
Trigger :
trigger ReparentComment on CaseComment (before insert) {
Map<String, Case> newCaseMap = new Map<String, Case>();
Set<Id> caseIds = new Set<Id>();
Map<Id, List<CaseComment>> ccMap = new Map<Id, List<CaseComment>>();
for(CaseComment cc : trigger.new)
{
caseIds.add(cc.ParentId);
List<CaseComment> ccList = ccMap.get(cc.ParentId);
if(ccList == null)
ccList = new List<CaseComment>();
ccList.add(cc);
ccMap.put(cc.ParentId, ccList);
}
for(Case c : [Select Id, Subject From Case Where Id in :caseIds Order by CreatedDate])
if(newCaseMap.containsKey(c.Subject))
for(CaseComment cc : ccMap.get(c.Id))
cc.ParentId = newCaseMap.get(c.Subject).Id;
else
newCaseMap.put(c.Subject, c);
for(Case c : [Select Id, Subject From Case Where Subject in :newCaseMap.keySet() And Id not in :caseIds And Status != 'Closed'])
for(CaseComment cc : ccMap.get(newCaseMap.get(c.Subject).Id))
cc.ParentId = c.Id;
}
Test Class :
@istest
Public class TestReparentComment{
static testmethod void testReparentComment(){
list <CaseComment> casecomment = new list<CaseComment> ();
{
CaseComment cc = new CaseComment(commentBody = 'Testing for the comments to appear in the description' ,ParentId = c.Id);
casecomment.add(cc);
}
test.startTest();
insert casecomment ;
test.stopTest();
list <CaseComment> insertedcasecomment = [Select Id ,CommentBody ,ParentId from CaseComment where Id IN :casecpmment ];
for(CaseComment cc :insertedcasecomment)
}
}