Program: 36218
Project: 36218
Buggy source:
private Resource generateInformation(Method method,String className,ArrayList<ArrayList<Resource>> conformanceClasses){
  SpecTest testLdp=null;
  Test test=null;
  if (method.getAnnotation(SpecTest.class) != null && method.getAnnotation(Test.class) != null) {
    testLdp=method.getAnnotation(SpecTest.class);
    test=method.getAnnotation(Test.class);
    String allGroups=groups(test.groups());
    Calendar cal=GregorianCalendar.getInstance();
    Literal date=model.createTypedLiteral(cal);
    String testCaseName=createTestCaseName(className,method.getName());
    String testCaseDeclaringName=createTestCaseName(method.getDeclaringClass().getCanonicalName(),method.getName());
    String testCaseURL=LDP.LDPT_NAMESPACE + testCaseName;
    String testCaseDeclaringURL=LDP.LDPT_NAMESPACE + testCaseDeclaringName;
    Resource testCaseResource=model.createResource(testCaseURL);
    testCaseResource.addProperty(RDF.type,EARL.TestCase);
    testCaseResource.addProperty(RDFS.label,testCaseName);
    testCaseResource.addProperty(TestManifest.name,testCaseName);
    testCaseResource.addProperty(DCTerms.date,date);
    testCaseResource.addProperty(RDFS.comment,test.description());
    if (allGroups != null)     testCaseResource.addProperty(DCTerms.subject,allGroups);
 else     conformanceClasses.get(LdpTestCaseReporter.OTHER).add(testCaseResource);
    for (    String group : test.groups()) {
      group=group.trim();
      testCaseResource.addProperty(conformanceLevel,model.createResource(LDP.LDPT_NAMESPACE + group));
      conformanceClasses.get(LdpTestCaseReporter.getConformanceIndex(group)).add(testCaseResource);
    }
    String[] stepsArr=testLdp.steps();
    if (stepsArr != null && stepsArr.length > 0) {
      ArrayList<Literal> arr=new ArrayList<Literal>();
      for (      String s : stepsArr) {
        arr.add(model.createLiteral(s));
      }
      RDFList l=model.createList(arr.iterator());
      testCaseResource.addProperty(steps,l);
    }
    testCaseResource.addProperty(TestManifest.action,"String_Node_Str");
switch (testLdp.approval()) {
case WG_APPROVED:
      testCaseResource.addProperty(TestDescription.reviewStatus,TestDescription.approved);
    break;
case WG_PENDING:
  testCaseResource.addProperty(TestDescription.reviewStatus,TestDescription.unreviewed);
break;
default :
testCaseResource.addProperty(TestDescription.reviewStatus,TestDescription.unreviewed);
break;
}
testCaseResource.addProperty(declaredInClass,className);
testCaseResource.addProperty(declaredTestCase,model.createResource(testCaseDeclaringURL));
Resource specRef=null;
if (testLdp.specRefUri() != null) {
specRef=model.createResource(testLdp.specRefUri());
testCaseResource.addProperty(RDFS.seeAlso,specRef);
}
if (test.description() != null && test.description().length() > 0) {
Resource excerpt=model.createResource(TestDescription.Excerpt);
excerpt.addLiteral(TestDescription.includesText,test.description());
if (specRef != null) {
excerpt.addProperty(RDFS.seeAlso,specRef);
}
testCaseResource.addProperty(TestDescription.specificationReference,excerpt);
}
switch (testLdp.testMethod()) {
case AUTOMATED:
testCaseResource.addProperty(testMethod,automated);
break;
case MANUAL:
testCaseResource.addProperty(testMethod,manual);
break;
case NOT_IMPLEMENTED:
testCaseResource.addProperty(testMethod,notImplemented);
break;
case CLIENT_ONLY:
testCaseResource.addProperty(testMethod,clientOnly);
break;
}
return testCaseResource;
}
return null;
}

Fixed version (ground truth):
private Resource generateInformation(Method method,String className,ArrayList<ArrayList<Resource>> conformanceClasses){
  SpecTest testLdp=null;
  Test test=null;
  if (method.getAnnotation(SpecTest.class) != null && method.getAnnotation(Test.class) != null) {
    testLdp=method.getAnnotation(SpecTest.class);
    if (testLdp.testMethod() == METHOD.CLIENT_ONLY) {
      return null;
    }
    test=method.getAnnotation(Test.class);
    String allGroups=groups(test.groups());
    Calendar cal=GregorianCalendar.getInstance();
    Literal date=model.createTypedLiteral(cal);
    String testCaseName=createTestCaseName(className,method.getName());
    String testCaseDeclaringName=createTestCaseName(method.getDeclaringClass().getCanonicalName(),method.getName());
    String testCaseURL=LDP.LDPT_NAMESPACE + testCaseName;
    String testCaseDeclaringURL=LDP.LDPT_NAMESPACE + testCaseDeclaringName;
    Resource testCaseResource=model.createResource(testCaseURL);
    testCaseResource.addProperty(RDF.type,EARL.TestCase);
    testCaseResource.addProperty(RDFS.label,testCaseName);
    testCaseResource.addProperty(TestManifest.name,testCaseName);
    testCaseResource.addProperty(DCTerms.date,date);
    testCaseResource.addProperty(RDFS.comment,test.description());
    if (allGroups != null)     testCaseResource.addProperty(DCTerms.subject,allGroups);
 else     conformanceClasses.get(LdpTestCaseReporter.OTHER).add(testCaseResource);
    for (    String group : test.groups()) {
      group=group.trim();
      testCaseResource.addProperty(conformanceLevel,model.createResource(LDP.LDPT_NAMESPACE + group));
      conformanceClasses.get(LdpTestCaseReporter.getConformanceIndex(group)).add(testCaseResource);
    }
    String[] stepsArr=testLdp.steps();
    if (stepsArr != null && stepsArr.length > 0) {
      ArrayList<Literal> arr=new ArrayList<Literal>();
      for (      String s : stepsArr) {
        arr.add(model.createLiteral(s));
      }
      RDFList l=model.createList(arr.iterator());
      testCaseResource.addProperty(steps,l);
    }
    testCaseResource.addProperty(TestManifest.action,"String_Node_Str");
switch (testLdp.approval()) {
case WG_APPROVED:
      testCaseResource.addProperty(TestDescription.reviewStatus,TestDescription.approved);
    break;
case WG_PENDING:
  testCaseResource.addProperty(TestDescription.reviewStatus,TestDescription.unreviewed);
break;
default :
testCaseResource.addProperty(TestDescription.reviewStatus,TestDescription.unreviewed);
break;
}
testCaseResource.addProperty(declaredInClass,className);
testCaseResource.addProperty(declaredTestCase,model.createResource(testCaseDeclaringURL));
Resource specRef=null;
if (testLdp.specRefUri() != null) {
specRef=model.createResource(testLdp.specRefUri());
testCaseResource.addProperty(RDFS.seeAlso,specRef);
}
if (test.description() != null && test.description().length() > 0) {
Resource excerpt=model.createResource(TestDescription.Excerpt);
excerpt.addLiteral(TestDescription.includesText,test.description());
if (specRef != null) {
excerpt.addProperty(RDFS.seeAlso,specRef);
}
testCaseResource.addProperty(TestDescription.specificationReference,excerpt);
}
switch (testLdp.testMethod()) {
case AUTOMATED:
testCaseResource.addProperty(testMethod,automated);
break;
case MANUAL:
testCaseResource.addProperty(testMethod,manual);
break;
case NOT_IMPLEMENTED:
testCaseResource.addProperty(testMethod,notImplemented);
break;
case CLIENT_ONLY:
testCaseResource.addProperty(testMethod,clientOnly);
break;
}
return testCaseResource;
}
return null;
}