Program: 172079
Project: 172079
Buggy source:
/** 
 * ALF-19732: Share does not render Cancel Checkout action for items being edited online
 */
public void testPermissionWithEphemeralLockAspect(){
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.ALL_PERMISSIONS,true);
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.CHECK_OUT,true);
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.WRITE,true);
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.READ,true);
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.CHECK_OUT,true);
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.WRITE,true);
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.READ,true);
  authenticationService.authenticate("String_Node_Str","String_Node_Str".toCharArray());
  NodeRef testNode=nodeService.createNode(rootNodeRef,ContentModel.ASSOC_CHILDREN,ContentModel.TYPE_PERSON,ContentModel.TYPE_CMOBJECT,null).getChildRef();
  lockService.lock(testNode,LockType.READ_ONLY_LOCK,3600,Lifetime.EPHEMERAL);
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.LOCK));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.UNLOCK));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.CHECK_OUT));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.CHECK_IN));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.CANCEL_CHECK_OUT));
  authenticationService.authenticate("String_Node_Str","String_Node_Str".toCharArray());
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.LOCK));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.UNLOCK));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.CHECK_OUT));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.CHECK_IN));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.CANCEL_CHECK_OUT));
  authenticationService.authenticate("String_Node_Str","String_Node_Str".toCharArray());
  lockService.unlock(testNode);
  authenticationService.authenticate("String_Node_Str","String_Node_Str".toCharArray());
  lockService.lock(testNode,LockType.READ_ONLY_LOCK,3600,Lifetime.EPHEMERAL);
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.LOCK));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.UNLOCK));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.CHECK_OUT));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.CHECK_IN));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.CANCEL_CHECK_OUT));
  authenticationService.authenticate("String_Node_Str","String_Node_Str".toCharArray());
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.LOCK));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.UNLOCK));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.CHECK_OUT));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.CHECK_IN));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.CANCEL_CHECK_OUT));
}

Fixed version (ground truth):
/** 
 * ALF-19732: Share does not render Cancel Checkout action for items being edited online
 */
public void testPermissionWithEphemeralLockAspect(){
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.ALL_PERMISSIONS,true);
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.CHECK_OUT,true);
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.WRITE,true);
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.READ,true);
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.CHECK_OUT,true);
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.WRITE,true);
  permissionService.setPermission(rootNodeRef,"String_Node_Str",PermissionService.READ,true);
  authenticationService.authenticate("String_Node_Str","String_Node_Str".toCharArray());
  NodeRef testNode=nodeService.createNode(rootNodeRef,ContentModel.ASSOC_CHILDREN,ContentModel.TYPE_PERSON,ContentModel.TYPE_CMOBJECT,null).getChildRef();
  lockService.lock(testNode,LockType.READ_ONLY_LOCK,3600,Lifetime.EPHEMERAL);
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.LOCK));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.UNLOCK));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.CHECK_OUT));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.CHECK_IN));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.CANCEL_CHECK_OUT));
  authenticationService.authenticate("String_Node_Str","String_Node_Str".toCharArray());
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.LOCK));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.UNLOCK));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.CHECK_OUT));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.CHECK_IN));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.CANCEL_CHECK_OUT));
  authenticationService.authenticate("String_Node_Str","String_Node_Str".toCharArray());
  lockService.unlock(testNode);
  authenticationService.authenticate("String_Node_Str","String_Node_Str".toCharArray());
  lockService.lock(testNode,LockType.READ_ONLY_LOCK,3600,Lifetime.EPHEMERAL);
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.LOCK));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.UNLOCK));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.CHECK_OUT));
  authenticationService.authenticate("String_Node_Str","String_Node_Str".toCharArray());
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.LOCK));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.UNLOCK));
  assertEquals(AccessStatus.ALLOWED,permissionService.hasPermission(testNode,PermissionService.CHECK_OUT));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.CHECK_IN));
  assertEquals(AccessStatus.DENIED,permissionService.hasPermission(testNode,PermissionService.CANCEL_CHECK_OUT));
}