PersonRecord { public String getName() { return !TextUtils.isEmpty(name) ? name : getNumber(); } PersonRecord(long id, String name, String email, String number); boolean isUnknown(); Address getAddress(AddressStyle style); String getEmail(); String getId(); long getContactId(); String getNumber(); String getName(); String toString();  }
@Test public void shouldSanitizeInputDataName() throws Exception { PersonRecord r = new PersonRecord(1, "foo\n\r\n", "foo\n@gmail.com", "\r\r1234"); assertThat(r.getName()).isEqualTo("foo"); }