PersonRecord { public String getNumber() { return (TextUtils.isEmpty(number) || "-1".equals(number) || "-2".equals(number)) ? "Unknown" : number; } 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 shouldSanitizeInputDataNumber() throws Exception { PersonRecord r = new PersonRecord(1, "foo\n\r\n", "foo\n@gmail.com", "\r\r1234"); assertThat(r.getNumber()).isEqualTo("1234"); }
@Test public void shouldReturnNumberForUnknown() throws Exception { PersonRecord record = new PersonRecord(1, null, null, "-1"); assertThat(record.getNumber()).isEqualTo("Unknown"); }