Person implements Serializable { public void addEmail(Email email) { if (emails == null) { emails = new HashSet<Email>(); } emails.add(email); }  void addEmail(Email email); void addTag(String tag); void addAccount(Account account); void addOrganization(Organization organization); void addPhoneNumber(PhoneNumber phoneNumber); String getNickname(); void setNickname(String nickName); Set<Email> getEmails(); @JsonIgnore String getEmailValue(); void setEmails(Set<Email> emails); String getId(); void setId(String id); Name getName(); void setName(Name name); Set<String> getTags(); void setTags(Set<String> tags); Set<Account> getAccounts(); void setAccounts(Set<Account> accounts); String getDisplayName(); void setDisplayName(String displayName); String getVoot_membership_role(); void setVoot_membership_role(String voot_membership_role); Set<Organization> getOrganizations(); void setOrganizations(Set<Organization> organizations); Set<PhoneNumber> getPhoneNumbers(); void setPhoneNumbers(Set<PhoneNumber> phoneNumbers); String getError(); void setError(String error); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object other);  }
@Test public void skipConvenienceMethodsOnSerialize() throws IOException { ObjectMapper objectMapper = new ObjectMapper() .enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); Person person = new Person(); person.addEmail(new Email("value@test.org", Type.email)); String serialized = objectMapper.writeValueAsString(person); assertThat("serialized Person should not include convenience getters", serialized, not(containsString("emailValue"))); }