Program: 69703
Project: 69703
Buggy source:
@Test public void testDeleteCalendarEvent() throws IOException, URISyntaxException {
  RestConnection conn=new RestConnection();
  assertTrue(conn.login(auth1.getName(),"String_Node_Str"));
  CalendarManager calendarManager=CalendarManagerFactory.getInstance().getCalendarManager();
  KalendarRenderWrapper calendarWrapper=calendarManager.getCourseCalendar(course1);
  Calendar cal=Calendar.getInstance();
  Date begin=cal.getTime();
  cal.add(Calendar.HOUR_OF_DAY,1);
  String id=UUID.randomUUID().toString();
  KalendarEvent kalEvent=new KalendarEvent(id,"String_Node_Str" + UUID.randomUUID().toString(),begin,cal.getTime());
  calendarManager.addEventTo(calendarWrapper.getKalendar(),kalEvent);
  URI uri=UriBuilder.fromUri(getContextURI()).path("String_Node_Str").path("String_Node_Str").path(course1.getResourceableId().toString()).path("String_Node_Str").path("String_Node_Str").build();
  HttpGet method=conn.createGet(uri,MediaType.APPLICATION_JSON,true);
  HttpResponse response=conn.execute(method);
  assertEquals(200,response.getStatusLine().getStatusCode());
  List<EventVO> vos=parseEventArray(response.getEntity().getContent());
  assertNotNull(vos);
  boolean found=false;
  for (  EventVO vo : vos) {
    if (id.equals(vo.getId())) {
      found=true;
    }
  }
  assertTrue(found);
  URI eventUri=UriBuilder.fromUri(getContextURI()).path("String_Node_Str").path("String_Node_Str").path(course1.getResourceableId().toString()).path("String_Node_Str").path("String_Node_Str").path(kalEvent.getID()).build();
  HttpDelete delEventMethod=conn.createDelete(eventUri,MediaType.APPLICATION_JSON,true);
  HttpResponse delEventResponse=conn.execute(delEventMethod);
  assertEquals(200,delEventResponse.getStatusLine().getStatusCode());
  EntityUtils.consume(delEventResponse.getEntity());
  conn.shutdown();
  KalendarRenderWrapper reloadedCalendarWrapper=calendarManager.getCourseCalendar(course1);
  Collection<KalendarEvent> savedEvents=reloadedCalendarWrapper.getKalendar().getEvents();
  for (  KalendarEvent savedEvent : savedEvents) {
    Assert.assertFalse(savedEvent.getID().equals(kalEvent.getID()));
  }
}

Fixed version (ground truth):
@Test public void testDeleteCalendarEvent() throws IOException, URISyntaxException {
  RestConnection conn=new RestConnection();
  assertTrue(conn.login(auth1.getName(),"String_Node_Str"));
  CalendarManager calendarManager=CalendarManagerFactory.getInstance().getCalendarManager();
  KalendarRenderWrapper calendarWrapper=calendarManager.getCourseCalendar(course1);
  Calendar cal=Calendar.getInstance();
  Date begin=cal.getTime();
  cal.add(Calendar.HOUR_OF_DAY,1);
  String id=UUID.randomUUID().toString();
  KalendarEvent kalEvent=new KalendarEvent(id,"String_Node_Str" + UUID.randomUUID().toString(),begin,cal.getTime());
  calendarManager.addEventTo(calendarWrapper.getKalendar(),kalEvent);
  URI uri=UriBuilder.fromUri(getContextURI()).path("String_Node_Str").path("String_Node_Str").path(course1.getResourceableId().toString()).path("String_Node_Str").path("String_Node_Str").build();
  HttpGet method=conn.createGet(uri,MediaType.APPLICATION_JSON,true);
  HttpResponse response=conn.execute(method);
  assertEquals(200,response.getStatusLine().getStatusCode());
  List<EventVO> vos=parseEventArray(response.getEntity().getContent());
  assertNotNull(vos);
  boolean found=false;
  for (  EventVO vo : vos) {
    if (id.equals(vo.getId())) {
      found=true;
    }
  }
  assertTrue(found);
  URI eventUri=UriBuilder.fromUri(getContextURI()).path("String_Node_Str").path("String_Node_Str").path(course1.getResourceableId().toString()).path("String_Node_Str").path("String_Node_Str").path(kalEvent.getID()).build();
  HttpDelete delEventMethod=conn.createDelete(eventUri,MediaType.APPLICATION_JSON);
  HttpResponse delEventResponse=conn.execute(delEventMethod);
  assertEquals(200,delEventResponse.getStatusLine().getStatusCode());
  EntityUtils.consume(delEventResponse.getEntity());
  conn.shutdown();
  KalendarRenderWrapper reloadedCalendarWrapper=calendarManager.getCourseCalendar(course1);
  Collection<KalendarEvent> savedEvents=reloadedCalendarWrapper.getKalendar().getEvents();
  for (  KalendarEvent savedEvent : savedEvents) {
    Assert.assertFalse(savedEvent.getID().equals(kalEvent.getID()));
  }
}