Program: 35991
Project: 35991
Buggy source:
@Test public void simpleGet() throws Exception {
  IContext c=Core.createSystemContext();
  Task t=createTask(c,"String_Node_Str",false);
  publishTask(c,t,false);
  IContext c2=Core.createSystemContext();
  CTaskView v;
  v=getTask(c2,t.getNr().toString(),null,ResponseCode.OK,200);
  Assert.assertEquals("String_Node_Str",v.getDescription());
  Assert.assertEquals(t.getNr(),v.getNr());
  Assert.assertEquals(false,v.getCompleted());
  Assert.assertTrue(lastRequestResult.getResponseBody().contains("String_Node_Str"));
  v=getTask(c2,t.getNr().toString(),"String_Node_Str",ResponseCode.OK,200);
  Assert.assertEquals("String_Node_Str",v.getDescription());
  Assert.assertEquals(t.getNr(),v.getNr());
  Assert.assertEquals(false,v.getCompleted());
  Assert.assertTrue(lastRequestResult.getResponseBody().contains("String_Node_Str"));
  v=getTask(c2,t.getNr().toString(),v.getETag(),ResponseCode.NotModified,304);
  Assert.assertEquals(null,v.getDescription());
  Assert.assertEquals(0L,(long)v.getNr());
  Assert.assertEquals(false,v.getCompleted());
  v=getTask(c2,t.getNr().toString(),"String_Node_Str",ResponseCode.OK,200);
  Assert.assertEquals("String_Node_Str",v.getDescription());
  Assert.assertEquals(t.getNr(),v.getNr());
  Assert.assertEquals(false,v.getCompleted());
  try {
    v=getTask(c2,"String_Node_Str",v.getETag(),ResponseCode.NotModified,304);
    Assert.fail();
  }
 catch (  RestConsumeException e) {
    Assert.assertEquals(404L,e.getStatus());
  }
  try {
    v=getTask(c2,"String_Node_Str",null,ResponseCode.OK,200);
    Assert.fail();
  }
 catch (  RestConsumeException e) {
    Assert.assertEquals(404L,e.getStatus());
  }
  RequestResult xmlresult=RestConsumer.getObject(c,baseUrl + t.getNr().toString() + "String_Node_Str",null,null);
  Assert.assertEquals(200L,(long)(int)xmlresult.getRawResponseCode());
  Assert.assertTrue(xmlresult.getResponseBody().startsWith("String_Node_Str"));
  Assert.assertTrue(xmlresult.getResponseBody().contains("String_Node_Str"));
  def.setEnableGet(false);
  def.setEnableListing(false);
  def.commit();
  try {
    v=getTask(c2,v.getNr().toString(),null,ResponseCode.OK,200);
    Assert.fail();
  }
 catch (  RestConsumeException e) {
    Assert.assertEquals(405L,e.getStatus());
  }
  def.setEnableGet(true);
  def.setEnableListing(true);
  def.setSourceConstraint("String_Node_Str" + Task.MemberNames.Completed.toString() + "String_Node_Str");
  def.commit();
  v=getTask(c2,t.getNr().toString(),null,ResponseCode.OK,200);
  Assert.assertEquals("String_Node_Str",v.getDescription());
  Assert.assertEquals(t.getNr(),v.getNr());
  Assert.assertEquals(false,v.getCompleted());
  t.setCompleted(true);
  publishTask(c,t,false);
  try {
    v=getTask(c2,t.getNr().toString(),null,ResponseCode.OK,200);
    Assert.fail();
  }
 catch (  RestConsumeException e) {
    Assert.assertEquals(404L,e.getStatus());
  }
  t.setCompleted(false);
  publishTask(c2,t,false);
  def.setAccessRole("String_Node_Str");
  def.setSourceConstraint("String_Node_Str");
  def.commit();
  try {
    v=getTask(c2,v.getNr().toString(),null,ResponseCode.OK,200);
    Assert.fail();
  }
 catch (  RestConsumeException e) {
    Assert.assertEquals(401L,e.getStatus());
  }
  RestConsumer.addCredentialsToNextRequest(getTestUser(),"String_Node_Str");
  v=getTask(c2,t.getNr().toString(),null,ResponseCode.OK,200);
  Assert.assertEquals("String_Node_Str",v.getDescription());
  Assert.assertEquals(t.getNr(),v.getNr());
  Assert.assertEquals(false,v.getCompleted());
  Assert.assertTrue(lastRequestResult.getResponseBody().contains("String_Node_Str"));
  def.setSourceConstraint("String_Node_Str" + Task.MemberNames.Completed.toString() + "String_Node_Str");
  def.commit();
  RestConsumer.addCredentialsToNextRequest(getTestUser(),"String_Node_Str");
  v=getTask(c2,t.getNr().toString(),null,ResponseCode.OK,200);
  try {
    v=getTask(c2,t.getNr().toString(),null,ResponseCode.OK,200);
    Assert.fail();
  }
 catch (  RestConsumeException e) {
    Assert.assertEquals(401L,e.getStatus());
  }
  def.setAccessRole("String_Node_Str");
  def.commit();
  t.delete();
  publishTask(c,t,true);
}

Fixed version (ground truth):
@Test public void simpleGet() throws Exception {
  IContext c=Core.createSystemContext();
  Task t=createTask(c,"String_Node_Str",false);
  publishTask(c,t,false);
  IContext c2=Core.createSystemContext();
  CTaskView v;
  v=getTask(c2,t.getNr().toString(),null,ResponseCode.OK,200);
  Assert.assertEquals("String_Node_Str",v.getDescription());
  Assert.assertEquals(t.getNr(),v.getNr());
  Assert.assertEquals(false,v.getCompleted());
  Assert.assertTrue(lastRequestResult.getResponseBody().contains("String_Node_Str"));
  v=getTask(c2,t.getNr().toString(),"String_Node_Str",ResponseCode.OK,200);
  Assert.assertEquals("String_Node_Str",v.getDescription());
  Assert.assertEquals(t.getNr(),v.getNr());
  Assert.assertEquals(false,v.getCompleted());
  Assert.assertTrue(lastRequestResult.getResponseBody().contains("String_Node_Str"));
  v=getTask(c2,t.getNr().toString(),v.getETag(),ResponseCode.NotModified,304);
  Assert.assertEquals(null,v.getDescription());
  Assert.assertEquals(0L,(long)v.getNr());
  Assert.assertEquals(false,v.getCompleted());
  v=getTask(c2,t.getNr().toString(),"String_Node_Str",ResponseCode.OK,200);
  Assert.assertEquals("String_Node_Str",v.getDescription());
  Assert.assertEquals(t.getNr(),v.getNr());
  Assert.assertEquals(false,v.getCompleted());
  try {
    v=getTask(c2,"String_Node_Str",v.getETag(),ResponseCode.NotModified,304);
    Assert.fail();
  }
 catch (  RestConsumeException e) {
    Assert.assertEquals(404L,e.getStatus());
  }
  try {
    v=getTask(c2,"String_Node_Str",null,ResponseCode.OK,200);
    Assert.fail();
  }
 catch (  RestConsumeException e) {
    Assert.assertEquals(404L,e.getStatus());
  }
  RequestResult xmlresult=RestConsumer.getObject(c,baseUrl + t.getNr().toString() + "String_Node_Str",null,null);
  Assert.assertEquals(200L,(long)(int)xmlresult.getRawResponseCode());
  Assert.assertTrue(xmlresult.getResponseBody().startsWith("String_Node_Str"));
  Assert.assertTrue(xmlresult.getResponseBody().contains("String_Node_Str"));
  def.setEnableGet(false);
  def.setEnableListing(false);
  def.commit();
  try {
    v=getTask(c2,v.getNr().toString(),null,ResponseCode.OK,200);
    Assert.fail();
  }
 catch (  RestConsumeException e) {
    Assert.assertEquals(405L,e.getStatus());
  }
  def.setEnableGet(true);
  def.setEnableListing(true);
  def.setSourceConstraint("String_Node_Str" + Task.MemberNames.Completed.toString() + "String_Node_Str");
  def.commit();
  v=getTask(c2,t.getNr().toString(),null,ResponseCode.OK,200);
  Assert.assertEquals("String_Node_Str",v.getDescription());
  Assert.assertEquals(t.getNr(),v.getNr());
  Assert.assertEquals(false,v.getCompleted());
  t.setCompleted(true);
  publishTask(c,t,false);
  try {
    v=getTask(c2,t.getNr().toString(),null,ResponseCode.OK,200);
    Assert.fail();
  }
 catch (  RestConsumeException e) {
    Assert.assertEquals(404L,e.getStatus());
  }
  t.setCompleted(false);
  publishTask(c2,t,false);
  def.setAccessRole("String_Node_Str");
  def.setSourceConstraint("String_Node_Str");
  def.commit();
  try {
    v=getTask(c2,v.getNr().toString(),null,ResponseCode.OK,200);
    Assert.fail();
  }
 catch (  RestConsumeException e) {
    Assert.assertEquals(401L,e.getStatus());
  }
  RestConsumer.addCredentialsToNextRequest(getTestUser(),"String_Node_Str");
  v=getTask(c2,t.getNr().toString(),null,ResponseCode.OK,200);
  Assert.assertEquals("String_Node_Str",v.getDescription());
  Assert.assertEquals(t.getNr(),v.getNr());
  Assert.assertEquals(false,v.getCompleted());
  Assert.assertTrue(lastRequestResult.getResponseBody().contains("String_Node_Str"));
  def.setSourceConstraint("String_Node_Str" + Task.MemberNames.Completed.toString() + "String_Node_Str");
  def.commit();
  RestConsumer.addCredentialsToNextRequest(getTestUser(),"String_Node_Str");
  v=getTask(c2,t.getNr().toString(),null,ResponseCode.OK,200);
  try {
    v=getTask(c2,t.getNr().toString(),null,ResponseCode.OK,200);
    Assert.fail();
  }
 catch (  RestConsumeException e) {
    Assert.assertEquals(401L,e.getStatus());
  }
  def.setAccessRole("String_Node_Str");
  def.commit();
  t.delete();
  publishTask(c,t,true);
  try {
    v=getTask(c2,t.getNr().toString(),null,ResponseCode.OK,200);
    Assert.fail();
  }
 catch (  RestConsumeException e) {
    Assert.assertEquals(404L,e.getStatus());
  }
}