Program: 174729
Project: 174729
Buggy source:
@Test public void testUpdatePerson_withCustomProps() throws Exception {
  publicApiClient.setRequestContext(new RequestContext(account1.getId(),account1Admin,"String_Node_Str"));
{
    Person person=createTestUpdatePerson();
    assertNull(person.getProperties().get("String_Node_Str"));
    assertFalse(person.getAspectNames().contains("String_Node_Str"));
    String json=qjson("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    person=people.update(person.getId(),json,200);
    assertEquals("String_Node_Str",person.getProperties().get("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
  }
{
    Person person=createTestUpdatePerson();
    person=people.update(person.getId(),qjson("String_Node_Str"),200);
    assertEquals("String_Node_Str",person.getProperties().get("String_Node_Str"));
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
  }
{
    Person person=createTestUpdatePerson();
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    person=people.update(person.getId(),qjson("String_Node_Str"),200);
    assertNull(person.getAspectNames());
    NodeRef nodeRef=personService.getPerson(person.getId());
    Set<QName> aspects=nodeService.getAspects(nodeRef);
    assertTrue(aspects.contains(ContentModel.ASPECT_REFERENCEABLE));
    assertTrue(aspects.contains(ContentModel.ASPECT_LOCALIZED));
  }
{
    Person person=createTestUpdatePerson();
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    String json=qjson("String_Node_Str");
    person=people.update(person.getId(),json,200);
    AuthenticationUtil.setFullyAuthenticatedUser("String_Node_Str" + account1.getId());
    NodeRef nodeRef=personService.getPerson(person.getId(),false);
    nodeService.hasAspect(nodeRef,ContentModel.ASPECT_AUDITABLE);
    nodeService.hasAspect(nodeRef,ContentModel.ASPECT_TITLED);
    List<String> aspectNames=person.getAspectNames();
    assertEquals(1,aspectNames.size());
    assertTrue(aspectNames.contains("String_Node_Str"));
    assertNull(person.getProperties());
  }
{
    Person person=createTestUpdatePerson();
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertEquals(1,person.getProperties().size());
    assertTrue(person.getProperties().containsKey("String_Node_Str"));
    person=people.update(person.getId(),qjson("String_Node_Str"),200);
    assertNull(person.getProperties());
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
  }
{
    Person person=createTestUpdatePerson();
    final String personId=person.getId();
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    String json=qjson("String_Node_Str");
    people.update(person.getId(),json,400);
    json=qjson("String_Node_Str");
    people.update(person.getId(),json,400);
    json=qjson("String_Node_Str");
    people.update(person.getId(),json,400);
    AuthenticationUtil.setFullyAuthenticatedUser("String_Node_Str" + account1.getId());
    NodeRef nodeRef=personService.getPerson(person.getId(),false);
    nodeService.hasAspect(nodeRef,ContentModel.ASPECT_AUDITABLE);
    nodeService.hasAspect(nodeRef,ContentModel.ASPECT_TITLED);
    person=people.getPerson(personId);
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertEquals("String_Node_Str",person.getProperties().get("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Test public void testUpdatePerson_withCustomProps() throws Exception {
  publicApiClient.setRequestContext(new RequestContext(account1.getId(),account1Admin,"String_Node_Str"));
{
    Person person=createTestUpdatePerson();
    assertNull(person.getProperties().get("String_Node_Str"));
    assertFalse(person.getAspectNames().contains("String_Node_Str"));
    String json=qjson("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    person=people.update(person.getId(),json,200);
    assertEquals("String_Node_Str",person.getProperties().get("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
  }
{
    Person person=createTestUpdatePerson();
    person=people.update(person.getId(),qjson("String_Node_Str"),200);
    assertEquals("String_Node_Str",person.getProperties().get("String_Node_Str"));
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
  }
{
    Person person=createTestUpdatePerson();
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    person=people.update(person.getId(),qjson("String_Node_Str"),200);
    assertNull(person.getAspectNames());
    NodeRef nodeRef=personService.getPerson(person.getId());
    Set<QName> aspects=nodeService.getAspects(nodeRef);
    assertTrue(aspects.contains(ContentModel.ASPECT_REFERENCEABLE));
    assertTrue(aspects.contains(ContentModel.ASPECT_LOCALIZED));
  }
{
    Person person=createTestUpdatePerson();
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    String json=qjson("String_Node_Str");
    person=people.update(person.getId(),json,200);
    AuthenticationUtil.setFullyAuthenticatedUser("String_Node_Str" + account1.getId());
    NodeRef nodeRef=personService.getPerson(person.getId(),false);
    nodeService.hasAspect(nodeRef,ContentModel.ASPECT_AUDITABLE);
    nodeService.hasAspect(nodeRef,ContentModel.ASPECT_TITLED);
    List<String> aspectNames=person.getAspectNames();
    assertEquals(1,aspectNames.size());
    assertTrue(aspectNames.contains("String_Node_Str"));
    assertNull(person.getProperties());
  }
{
    Person person=new Person();
    String personId=UUID.randomUUID().toString() + "String_Node_Str" + account1.getId();
    person.setUserName(personId);
    person.setFirstName("String_Node_Str");
    person.setEmail(personId);
    person.setEnabled(true);
    person.setPassword("String_Node_Str");
    person.setProperties(null);
    person.setAspectNames(null);
    person=people.create(person);
    assertNull(person.getAspectNames());
    assertNull(person.getProperties());
    String json=qjson("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    person=people.update(person.getId(),json,200);
    List<String> aspectNames=person.getAspectNames();
    assertEquals(2,aspectNames.size());
    assertTrue(aspectNames.contains("String_Node_Str"));
    assertTrue(aspectNames.contains("String_Node_Str"));
    assertEquals(2,person.getProperties().size());
    assertEquals("String_Node_Str",person.getProperties().get("String_Node_Str"));
    assertEquals("String_Node_Str",person.getProperties().get("String_Node_Str"));
  }
{
    Person person=createTestUpdatePerson();
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertEquals(1,person.getProperties().size());
    assertTrue(person.getProperties().containsKey("String_Node_Str"));
    person=people.update(person.getId(),qjson("String_Node_Str"),200);
    assertNull(person.getProperties());
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
  }
{
    Person person=createTestUpdatePerson();
    final String personId=person.getId();
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    String json=qjson("String_Node_Str");
    people.update(person.getId(),json,400);
    json=qjson("String_Node_Str");
    people.update(person.getId(),json,400);
    json=qjson("String_Node_Str");
    people.update(person.getId(),json,400);
    AuthenticationUtil.setFullyAuthenticatedUser("String_Node_Str" + account1.getId());
    NodeRef nodeRef=personService.getPerson(person.getId(),false);
    nodeService.hasAspect(nodeRef,ContentModel.ASPECT_AUDITABLE);
    nodeService.hasAspect(nodeRef,ContentModel.ASPECT_TITLED);
    person=people.getPerson(personId);
    assertEquals(2,person.getAspectNames().size());
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertTrue(person.getAspectNames().contains("String_Node_Str"));
    assertEquals("String_Node_Str",person.getProperties().get("String_Node_Str"));
  }
}