Program: 172188
Project: 172188
Buggy source:
public void testApplyUpdateDeleteRatings_SingleUserMultipleSchemes() throws Exception {
  AuthenticationUtil.setFullyAuthenticatedUser(USER_TWO);
  Rating nullRating=ratingService.getRatingByCurrentUser(testDoc_Admin,LIKES_SCHEME_NAME);
  assertNull("String_Node_Str",nullRating);
  assertNull("String_Node_Str",ratingService.removeRatingByCurrentUser(testDoc_Admin,LIKES_SCHEME_NAME));
  final float likesScore=1;
  final float fiveStarScore=5;
  ratingService.applyRating(testDoc_Admin,likesScore,LIKES_SCHEME_NAME);
  ratingService.applyRating(testDoc_Admin,fiveStarScore,FIVE_STAR_SCHEME_NAME);
  assertTrue(ContentModel.ASPECT_RATEABLE + "String_Node_Str",nodeService.hasAspect(testDoc_Admin,ContentModel.ASPECT_RATEABLE));
  List<ChildAssociationRef> allChildren=nodeService.getChildAssocs(testDoc_Admin,ContentModel.ASSOC_RATINGS,RegexQNamePattern.MATCH_ALL);
  assertEquals("String_Node_Str",1,allChildren.size());
  assertEquals("String_Node_Str",ContentModel.ASSOC_RATINGS,allChildren.get(0).getTypeQName());
  QName expectedAssocName=QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,AuthenticationUtil.getFullyAuthenticatedUser());
  assertEquals("String_Node_Str",expectedAssocName,allChildren.get(0).getQName());
  Rating likeRating=ratingService.getRatingByCurrentUser(testDoc_Admin,LIKES_SCHEME_NAME);
  Rating fiveStarRating=ratingService.getRatingByCurrentUser(testDoc_Admin,FIVE_STAR_SCHEME_NAME);
  assertNotNull("String_Node_Str",likeRating);
  assertEquals("String_Node_Str",likesScore,likeRating.getScore());
  assertEquals("String_Node_Str",AuthenticationUtil.getFullyAuthenticatedUser(),likeRating.getAppliedBy());
  final Date likeRatingAppliedAt=likeRating.getAppliedAt();
  assertDateIsCloseToNow(likeRatingAppliedAt);
  assertNotNull("String_Node_Str",fiveStarRating);
  assertEquals("String_Node_Str",fiveStarScore,fiveStarRating.getScore());
  assertEquals("String_Node_Str",AuthenticationUtil.getFullyAuthenticatedUser(),fiveStarRating.getAppliedBy());
  final Date fiveStarRatingAppliedAt=fiveStarRating.getAppliedAt();
  assertDateIsCloseToNow(fiveStarRatingAppliedAt);
  final float updatedFiveStarScore=3;
  ratingService.applyRating(testDoc_Admin,updatedFiveStarScore,FIVE_STAR_SCHEME_NAME);
  allChildren=nodeService.getChildAssocs(testDoc_Admin,ContentModel.ASSOC_RATINGS,RegexQNamePattern.MATCH_ALL);
  assertEquals("String_Node_Str",1,allChildren.size());
  assertEquals("String_Node_Str",ContentModel.ASSOC_RATINGS,allChildren.get(0).getTypeQName());
  assertEquals("String_Node_Str",expectedAssocName,allChildren.get(0).getQName());
  Rating updatedFiveStarRating=ratingService.getRatingByCurrentUser(testDoc_Admin,FIVE_STAR_SCHEME_NAME);
  assertNotNull("String_Node_Str",likeRating);
  assertEquals("String_Node_Str",likesScore,likeRating.getScore());
  assertEquals("String_Node_Str",AuthenticationUtil.getFullyAuthenticatedUser(),likeRating.getAppliedBy());
  assertEquals("String_Node_Str",likeRatingAppliedAt,likeRating.getAppliedAt());
  assertNotNull("String_Node_Str",updatedFiveStarRating);
  assertEquals("String_Node_Str",updatedFiveStarScore,updatedFiveStarRating.getScore());
  assertEquals("String_Node_Str",AuthenticationUtil.getFullyAuthenticatedUser(),updatedFiveStarRating.getAppliedBy());
  assertTrue("String_Node_Str",fiveStarRatingAppliedAt.equals(updatedFiveStarRating.getAppliedAt()) == false);
  assertDateIsCloseToNow(updatedFiveStarRating.getAppliedAt());
  Rating deletedLikesRating=ratingService.removeRatingByCurrentUser(testDoc_Admin,LIKES_SCHEME_NAME);
  assertNotNull("String_Node_Str",deletedLikesRating);
  assertEquals("String_Node_Str",likesScore,deletedLikesRating.getScore());
  assertEquals("String_Node_Str",AuthenticationUtil.getFullyAuthenticatedUser(),deletedLikesRating.getAppliedBy());
  assertEquals("String_Node_Str",likeRatingAppliedAt,deletedLikesRating.getAppliedAt());
  Rating deletedStarRating=ratingService.removeRatingByCurrentUser(testDoc_Admin,FIVE_STAR_SCHEME_NAME);
  assertNotNull("String_Node_Str",deletedStarRating);
  assertEquals("String_Node_Str",updatedFiveStarScore,deletedStarRating.getScore());
  assertEquals("String_Node_Str",AuthenticationUtil.getFullyAuthenticatedUser(),deletedStarRating.getAppliedBy());
  assertEquals("String_Node_Str",updatedFiveStarRating.getAppliedAt(),deletedStarRating.getAppliedAt());
}

Fixed version (ground truth):
public void testApplyUpdateDeleteRatings_SingleUserMultipleSchemes() throws Exception {
  AuthenticationUtil.setFullyAuthenticatedUser(USER_TWO);
  Rating nullRating=ratingService.getRatingByCurrentUser(testDoc_Admin,LIKES_SCHEME_NAME);
  assertNull("String_Node_Str",nullRating);
  assertNull("String_Node_Str",ratingService.removeRatingByCurrentUser(testDoc_Admin,LIKES_SCHEME_NAME));
  final float likesScore=1;
  final float fiveStarScore=5;
  ratingService.applyRating(testDoc_Admin,likesScore,LIKES_SCHEME_NAME);
  ratingService.applyRating(testDoc_Admin,fiveStarScore,FIVE_STAR_SCHEME_NAME);
  assertTrue(ContentModel.ASPECT_RATEABLE + "String_Node_Str",nodeService.hasAspect(testDoc_Admin,ContentModel.ASPECT_RATEABLE));
  List<ChildAssociationRef> allChildren=nodeService.getChildAssocs(testDoc_Admin,ContentModel.ASSOC_RATINGS,RegexQNamePattern.MATCH_ALL);
  assertEquals("String_Node_Str",1,allChildren.size());
  assertEquals("String_Node_Str",ContentModel.ASSOC_RATINGS,allChildren.get(0).getTypeQName());
  QName expectedAssocName=QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,AuthenticationUtil.getFullyAuthenticatedUser());
  assertEquals("String_Node_Str",expectedAssocName,allChildren.get(0).getQName());
  Rating likeRating=ratingService.getRatingByCurrentUser(testDoc_Admin,LIKES_SCHEME_NAME);
  Rating fiveStarRating=ratingService.getRatingByCurrentUser(testDoc_Admin,FIVE_STAR_SCHEME_NAME);
  assertNotNull("String_Node_Str",likeRating);
  assertEquals("String_Node_Str",likesScore,likeRating.getScore());
  assertEquals("String_Node_Str",AuthenticationUtil.getFullyAuthenticatedUser(),likeRating.getAppliedBy());
  final Date likeRatingAppliedAt=likeRating.getAppliedAt();
  assertDateIsCloseToNow(likeRatingAppliedAt);
  assertNotNull("String_Node_Str",fiveStarRating);
  assertEquals("String_Node_Str",fiveStarScore,fiveStarRating.getScore());
  assertEquals("String_Node_Str",AuthenticationUtil.getFullyAuthenticatedUser(),fiveStarRating.getAppliedBy());
  final Date fiveStarRatingAppliedAt=fiveStarRating.getAppliedAt();
  assertDateIsCloseToNow(fiveStarRatingAppliedAt);
  final float updatedFiveStarScore=3;
  ratingService.applyRating(testDoc_Admin,updatedFiveStarScore,FIVE_STAR_SCHEME_NAME);
  allChildren=nodeService.getChildAssocs(testDoc_Admin,ContentModel.ASSOC_RATINGS,RegexQNamePattern.MATCH_ALL);
  assertEquals("String_Node_Str",1,allChildren.size());
  assertEquals("String_Node_Str",ContentModel.ASSOC_RATINGS,allChildren.get(0).getTypeQName());
  assertEquals("String_Node_Str",expectedAssocName,allChildren.get(0).getQName());
  Rating updatedFiveStarRating=ratingService.getRatingByCurrentUser(testDoc_Admin,FIVE_STAR_SCHEME_NAME);
  assertNotNull("String_Node_Str",likeRating);
  assertEquals("String_Node_Str",likesScore,likeRating.getScore());
  assertEquals("String_Node_Str",AuthenticationUtil.getFullyAuthenticatedUser(),likeRating.getAppliedBy());
  assertEquals("String_Node_Str",likeRatingAppliedAt,likeRating.getAppliedAt());
  assertNotNull("String_Node_Str",updatedFiveStarRating);
  assertEquals("String_Node_Str",updatedFiveStarScore,updatedFiveStarRating.getScore());
  assertEquals("String_Node_Str",AuthenticationUtil.getFullyAuthenticatedUser(),updatedFiveStarRating.getAppliedBy());
  assertTrue("String_Node_Str",fiveStarRatingAppliedAt.equals(updatedFiveStarRating.getAppliedAt()) == false);
  assertDateIsCloseToNow(updatedFiveStarRating.getAppliedAt());
  Rating deletedLikesRating=ratingService.removeRatingByCurrentUser(testDoc_Admin,LIKES_SCHEME_NAME);
  assertNotNull("String_Node_Str",deletedLikesRating);
  assertEquals("String_Node_Str",likesScore,deletedLikesRating.getScore());
  assertEquals("String_Node_Str",AuthenticationUtil.getFullyAuthenticatedUser(),deletedLikesRating.getAppliedBy());
  assertEquals("String_Node_Str",likeRatingAppliedAt,deletedLikesRating.getAppliedAt());
  Rating deletedStarRating=ratingService.removeRatingByCurrentUser(testDoc_Admin,FIVE_STAR_SCHEME_NAME);
  assertNotNull("String_Node_Str",deletedStarRating);
  assertEquals("String_Node_Str",updatedFiveStarScore,deletedStarRating.getScore());
  assertEquals("String_Node_Str",AuthenticationUtil.getFullyAuthenticatedUser(),deletedStarRating.getAppliedBy());
  assertEquals("String_Node_Str",updatedFiveStarRating.getAppliedAt(),deletedStarRating.getAppliedAt());
  assertNull("String_Node_Str",ratingService.getRatingByCurrentUser(testDoc_Admin,FIVE_STAR_SCHEME_NAME));
  assertNull("String_Node_Str",ratingService.getRatingByCurrentUser(testDoc_Admin,LIKES_SCHEME_NAME));
}