Program: 69710
Project: 69710
Buggy source:
@Test public void testUpdateRootNodeCoursePostWithFile() throws IOException, URISyntaxException {
  assertTrue(conn.login("String_Node_Str","String_Node_Str"));
  URI uri=getCoursesUri().queryParam("String_Node_Str","String_Node_Str").queryParam("String_Node_Str","String_Node_Str").build();
  HttpPut method=conn.createPut(uri,MediaType.APPLICATION_JSON,true);
  HttpResponse response=conn.execute(method);
  assertEquals(200,response.getStatusLine().getStatusCode());
  CourseVO course=conn.parse(response,CourseVO.class);
  assertNotNull(course);
  assertNotNull(course.getKey());
  assertNotNull(course.getEditorRootNodeId());
  URL pageUrl=RepositoryEntriesTest.class.getResource("String_Node_Str");
  assertNotNull(pageUrl);
  File page=new File(pageUrl.toURI());
  URI rootUri=getElementsUri(course).path("String_Node_Str").path(course.getEditorRootNodeId()).build();
  HttpPost newStructureMethod=conn.createPost(rootUri,MediaType.APPLICATION_JSON,true);
  HttpEntity entity=MultipartEntityBuilder.create().setMode(HttpMultipartMode.BROWSER_COMPATIBLE).addBinaryBody("String_Node_Str",page,ContentType.APPLICATION_OCTET_STREAM,page.getName()).addTextBody("String_Node_Str",page.getName()).addTextBody("String_Node_Str",course.getEditorRootNodeId()).addTextBody("String_Node_Str","String_Node_Str").addTextBody("String_Node_Str","String_Node_Str").addTextBody("String_Node_Str","String_Node_Str").addTextBody("String_Node_Str","String_Node_Str").addTextBody("String_Node_Str","String_Node_Str").build();
  newStructureMethod.setEntity(entity);
  HttpResponse newStructureCode=conn.execute(newStructureMethod);
  assertTrue(newStructureCode.getStatusLine().getStatusCode() == 200 || newStructureCode.getStatusLine().getStatusCode() == 201);
  CourseNodeVO structureNode=conn.parse(newStructureCode,CourseNodeVO.class);
  assertNotNull(structureNode);
  assertNotNull(structureNode.getId());
  assertEquals(structureNode.getShortTitle(),"String_Node_Str");
  assertEquals(structureNode.getLongTitle(),"String_Node_Str");
  assertEquals(structureNode.getLearningObjectives(),"String_Node_Str");
  assertEquals(structureNode.getId(),course.getEditorRootNodeId());
  ICourse realCourse=CourseFactory.loadCourse(course.getKey());
  CourseEditorTreeModel editorTreeModel=realCourse.getEditorTreeModel();
  CourseEditorTreeNode rootNode=(CourseEditorTreeNode)editorTreeModel.getRootNode();
  assertNotNull(rootNode);
  assertNotNull(rootNode.getIdent());
  assertNotNull(rootNode.getCourseNode());
  assertEquals(rootNode.getCourseNode().getShortTitle(),"String_Node_Str");
  assertEquals(rootNode.getCourseNode().getLongTitle(),"String_Node_Str");
  assertEquals(rootNode.getCourseNode().getLearningObjectives(),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testUpdateRootNodeCoursePostWithFile() throws IOException, URISyntaxException {
  assertTrue(conn.login("String_Node_Str","String_Node_Str"));
  URI uri=getCoursesUri().queryParam("String_Node_Str","String_Node_Str").queryParam("String_Node_Str","String_Node_Str").build();
  HttpPut method=conn.createPut(uri,MediaType.APPLICATION_JSON,true);
  HttpResponse response=conn.execute(method);
  assertEquals(200,response.getStatusLine().getStatusCode());
  CourseVO course=conn.parse(response,CourseVO.class);
  assertNotNull(course);
  assertNotNull(course.getKey());
  assertNotNull(course.getEditorRootNodeId());
  URL pageUrl=RepositoryEntriesTest.class.getResource("String_Node_Str");
  assertNotNull(pageUrl);
  File page=new File(pageUrl.toURI());
  URI rootUri=getElementsUri(course).path("String_Node_Str").path(course.getEditorRootNodeId()).build();
  HttpPost newStructureMethod=conn.createPost(rootUri,MediaType.APPLICATION_JSON);
  HttpEntity entity=MultipartEntityBuilder.create().setMode(HttpMultipartMode.BROWSER_COMPATIBLE).addBinaryBody("String_Node_Str",page,ContentType.APPLICATION_OCTET_STREAM,page.getName()).addTextBody("String_Node_Str",page.getName()).addTextBody("String_Node_Str",course.getEditorRootNodeId()).addTextBody("String_Node_Str","String_Node_Str").addTextBody("String_Node_Str","String_Node_Str").addTextBody("String_Node_Str","String_Node_Str").addTextBody("String_Node_Str","String_Node_Str").addTextBody("String_Node_Str","String_Node_Str").build();
  newStructureMethod.setEntity(entity);
  HttpResponse newStructureCode=conn.execute(newStructureMethod);
  assertTrue(newStructureCode.getStatusLine().getStatusCode() == 200 || newStructureCode.getStatusLine().getStatusCode() == 201);
  CourseNodeVO structureNode=conn.parse(newStructureCode,CourseNodeVO.class);
  assertNotNull(structureNode);
  assertNotNull(structureNode.getId());
  assertEquals(structureNode.getShortTitle(),"String_Node_Str");
  assertEquals(structureNode.getLongTitle(),"String_Node_Str");
  assertEquals(structureNode.getLearningObjectives(),"String_Node_Str");
  assertEquals(structureNode.getId(),course.getEditorRootNodeId());
  ICourse realCourse=CourseFactory.loadCourse(course.getKey());
  CourseEditorTreeModel editorTreeModel=realCourse.getEditorTreeModel();
  CourseEditorTreeNode rootNode=(CourseEditorTreeNode)editorTreeModel.getRootNode();
  assertNotNull(rootNode);
  assertNotNull(rootNode.getIdent());
  assertNotNull(rootNode.getCourseNode());
  assertEquals(rootNode.getCourseNode().getShortTitle(),"String_Node_Str");
  assertEquals(rootNode.getCourseNode().getLongTitle(),"String_Node_Str");
  assertEquals(rootNode.getCourseNode().getLearningObjectives(),"String_Node_Str");
}