### Question:
Person extends BaseChangeableOpenmrsData { public Set<PersonAttribute> getAttributes() { if (attributes == null) { attributes = new TreeSet<>(); } return this.attributes; } Person();  Person(Person person);  Person(Integer personId); Integer getPersonId(); void setPersonId(Integer personId); String getGender(); void setGender(String gender); Date getBirthdate(); void setBirthdate(Date birthdate); @Deprecated @JsonIgnore Boolean isBirthdateEstimated(); Boolean getBirthdateEstimated(); void setBirthdateEstimated(Boolean birthdateEstimated); Boolean getDeathdateEstimated(); void setDeathdateEstimated(Boolean deathdateEstimated); void setBirthtime(Date birthtime); Date getBirthDateTime(); Date getBirthtime(); @Deprecated @JsonIgnore Boolean isDead(); Boolean getDead(); void setDead(Boolean dead); Date getDeathDate(); void setDeathDate(Date deathDate); Concept getCauseOfDeath(); void setCauseOfDeath(Concept causeOfDeath); Set<PersonAddress> getAddresses(); void setAddresses(Set<PersonAddress> addresses); Set<PersonName> getNames(); void setNames(Set<PersonName> names); Set<PersonAttribute> getAttributes(); List<PersonAttribute> getActiveAttributes(); void setAttributes(Set<PersonAttribute> attributes); void addAttribute(PersonAttribute newAttribute); void removeAttribute(PersonAttribute attribute); PersonAttribute getAttribute(PersonAttributeType pat); PersonAttribute getAttribute(String attributeName); PersonAttribute getAttribute(Integer attributeTypeId); List<PersonAttribute> getAttributes(String attributeName); List<PersonAttribute> getAttributes(Integer attributeTypeId); List<PersonAttribute> getAttributes(PersonAttributeType personAttributeType); Map<String, PersonAttribute> getAttributeMap(); Map<String, PersonAttribute> getAllAttributeMap(); String printAttributes(); void addName(PersonName name); void removeName(PersonName name); void addAddress(PersonAddress address); void removeAddress(PersonAddress address); PersonName getPersonName(); String getGivenName(); String getMiddleName(); String getFamilyName(); PersonAddress getPersonAddress(); Integer getAge(); Integer getAge(Date onDate); void setBirthdateFromAge(int age, Date ageOnDate); User getPersonChangedBy(); void setPersonChangedBy(User changedBy); Date getPersonDateChanged(); void setPersonDateChanged(Date dateChanged); User getPersonCreator(); void setPersonCreator(User creator); Date getPersonDateCreated(); void setPersonDateCreated(Date dateCreated); Date getPersonDateVoided(); void setPersonDateVoided(Date dateVoided); void setPersonVoided(Boolean voided); Boolean getPersonVoided(); @Deprecated @JsonIgnore Boolean isPersonVoided(); User getPersonVoidedBy(); void setPersonVoidedBy(User voidedBy); String getPersonVoidReason(); void setPersonVoidReason(String voidReason); @Deprecated @JsonIgnore boolean isPatient(); boolean getIsPatient(); @Override String toString(); @Override Integer getId(); @Override void setId(Integer id); static final long serialVersionUID; }### Answer:
@Test public void getAttributes_shouldReturnAllPersonAttributesWithMatchingAttributeTypeNames() { Person person = personHelper(false, 1, 2, 3, "name1", "name1", "name3", "value1", "value2", "value3"); Assert.assertEquals(2, person.getAttributes("name1").size()); }
@Test public void getAttributes_shouldReturnListOfPersonAttributesBasedOnAttributeTypeId() { Person person = personHelper(false, 1, 1, 3, "name1", "name2", "name3", "value1", "value2", "value3"); Assert.assertEquals(2, person.getAttributes(1).size()); }
@Test public void getAttributes_shouldReturnEmptyListWhenMatchingPersonAttributeByIdIsVoided() { Person person = personHelper(true, 1, 1, 3, "name1", "name2", "name3", "value1", "value2", "value3"); Assert.assertEquals(0, person.getAttributes(1).size()); }