Program: 63004
Project: 63004
Buggy source:
@Test public void testPublishAndUnpublishEvaluation() throws Exception {
  ______TS("String_Node_Str");
  restoreTypicalDataInDatastore();
  String[] methodNames=new String[]{"String_Node_Str","String_Node_Str"};
  Class<?>[] paramTypes=new Class<?>[]{String.class,String.class};
  Object[] params=new Object[]{"String_Node_Str","String_Node_Str"};
  for (int i=0; i < methodNames.length; i++) {
    verifyCannotAccess(USER_TYPE_NOT_LOGGED_IN,methodNames[i],"String_Node_Str",paramTypes,params);
    verifyCannotAccess(USER_TYPE_UNREGISTERED,methodNames[i],"String_Node_Str",paramTypes,params);
    verifyCannotAccess(USER_TYPE_STUDENT,methodNames[i],"String_Node_Str",paramTypes,params);
    verifyCannotAccess(USER_TYPE_COORD,methodNames[i],"String_Node_Str",paramTypes,params);
    verifyCanAccess(USER_TYPE_COORD,methodNames[i],"String_Node_Str",paramTypes,params);
  }
  ______TS("String_Node_Str");
  restoreTypicalDataInDatastore();
  loginAsAdmin("String_Node_Str");
  EvaluationData eval1=dataBundle.evaluations.get("String_Node_Str");
  assertEquals(false,logic.getEvaluation(eval1.course,eval1.name).published);
  eval1.endTime=Common.getDateOffsetToCurrentTime(-1);
  assertEquals(EvalStatus.CLOSED,eval1.getStatus());
  logic.editEvaluation(eval1);
  logic.publishEvaluation(eval1.course,eval1.name);
  assertEquals(true,logic.getEvaluation(eval1.course,eval1.name).published);
  logic.unpublishEvaluation(eval1.course,eval1.name);
  assertEquals(false,logic.getEvaluation(eval1.course,eval1.name).published);
  ______TS("String_Node_Str");
  eval1.endTime=Common.getDateOffsetToCurrentTime(1);
  assertEquals(EvalStatus.OPEN,eval1.getStatus());
  logic.editEvaluation(eval1);
  try {
    logic.publishEvaluation(eval1.course,eval1.name);
    fail();
  }
 catch (  InvalidParametersException e) {
    assertContains(Common.ERRORCODE_PUBLISHED_BEFORE_CLOSING,e.errorCode);
  }
  assertEquals(EvalStatus.OPEN,logic.getEvaluation(eval1.course,eval1.name).getStatus());
  ______TS("String_Node_Str");
  try {
    logic.unpublishEvaluation(eval1.course,eval1.name);
    fail();
  }
 catch (  InvalidParametersException e) {
    assertContains(Common.ERRORCODE_UNPUBLISHED_BEFORE_PUBLISHING,e.errorCode);
  }
  assertEquals(EvalStatus.OPEN,logic.getEvaluation(eval1.course,eval1.name).getStatus());
  ______TS("String_Node_Str");
  try {
    logic.publishEvaluation("String_Node_Str","String_Node_Str");
    fail();
  }
 catch (  EntityDoesNotExistException e) {
  }
  try {
    logic.unpublishEvaluation("String_Node_Str","String_Node_Str");
    fail();
  }
 catch (  EntityDoesNotExistException e) {
  }
  ______TS("String_Node_Str");
  try {
    logic.publishEvaluation(null,"String_Node_Str");
    fail();
  }
 catch (  NullPointerException e) {
    assertContains("String_Node_Str",e.getMessage());
  }
  try {
    logic.unpublishEvaluation("String_Node_Str",null);
    fail();
  }
 catch (  NullPointerException e) {
    assertContains("String_Node_Str",e.getMessage().toLowerCase());
  }
}

Fixed version (ground truth):
@Test public void testPublishAndUnpublishEvaluation() throws Exception {
  ______TS("String_Node_Str");
  restoreTypicalDataInDatastore();
  String[] methodNames=new String[]{"String_Node_Str","String_Node_Str"};
  Class<?>[] paramTypes=new Class<?>[]{String.class,String.class};
  Object[] params=new Object[]{"String_Node_Str","String_Node_Str"};
  for (int i=0; i < methodNames.length; i++) {
    verifyCannotAccess(USER_TYPE_NOT_LOGGED_IN,methodNames[i],"String_Node_Str",paramTypes,params);
    verifyCannotAccess(USER_TYPE_UNREGISTERED,methodNames[i],"String_Node_Str",paramTypes,params);
    verifyCannotAccess(USER_TYPE_STUDENT,methodNames[i],"String_Node_Str",paramTypes,params);
    verifyCannotAccess(USER_TYPE_COORD,methodNames[i],"String_Node_Str",paramTypes,params);
    verifyCanAccess(USER_TYPE_COORD,methodNames[i],"String_Node_Str",paramTypes,params);
  }
  ______TS("String_Node_Str");
  restoreTypicalDataInDatastore();
  loginAsAdmin("String_Node_Str");
  EvaluationData eval1=dataBundle.evaluations.get("String_Node_Str");
  assertEquals(false,logic.getEvaluation(eval1.course,eval1.name).published);
  eval1.endTime=Common.getDateOffsetToCurrentTime(-1);
  assertEquals(EvalStatus.CLOSED,eval1.getStatus());
  BackDoorLogic backDoorLogic=new BackDoorLogic();
  backDoorLogic.editEvaluation(eval1);
  logic.publishEvaluation(eval1.course,eval1.name);
  assertEquals(true,logic.getEvaluation(eval1.course,eval1.name).published);
  logic.unpublishEvaluation(eval1.course,eval1.name);
  assertEquals(false,logic.getEvaluation(eval1.course,eval1.name).published);
  ______TS("String_Node_Str");
  eval1.endTime=Common.getDateOffsetToCurrentTime(1);
  assertEquals(EvalStatus.OPEN,eval1.getStatus());
  backDoorLogic.editEvaluation(eval1);
  try {
    logic.publishEvaluation(eval1.course,eval1.name);
    fail();
  }
 catch (  InvalidParametersException e) {
    assertContains(Common.ERRORCODE_PUBLISHED_BEFORE_CLOSING,e.errorCode);
  }
  assertEquals(EvalStatus.OPEN,logic.getEvaluation(eval1.course,eval1.name).getStatus());
  ______TS("String_Node_Str");
  try {
    logic.unpublishEvaluation(eval1.course,eval1.name);
    fail();
  }
 catch (  InvalidParametersException e) {
    assertContains(Common.ERRORCODE_UNPUBLISHED_BEFORE_PUBLISHING,e.errorCode);
  }
  assertEquals(EvalStatus.OPEN,logic.getEvaluation(eval1.course,eval1.name).getStatus());
  ______TS("String_Node_Str");
  try {
    logic.publishEvaluation("String_Node_Str","String_Node_Str");
    fail();
  }
 catch (  EntityDoesNotExistException e) {
  }
  try {
    logic.unpublishEvaluation("String_Node_Str","String_Node_Str");
    fail();
  }
 catch (  EntityDoesNotExistException e) {
  }
  ______TS("String_Node_Str");
  try {
    logic.publishEvaluation(null,"String_Node_Str");
    fail();
  }
 catch (  NullPointerException e) {
    assertContains("String_Node_Str",e.getMessage());
  }
  try {
    logic.unpublishEvaluation("String_Node_Str",null);
    fail();
  }
 catch (  NullPointerException e) {
    assertContains("String_Node_Str",e.getMessage().toLowerCase());
  }
}