NearbyPerson { public void updateState(LetterSource source) { if (source == null) { state = State.NEW; return; } state = (source.available == 1) ? State.EXISTING : State.REDISCOVERED; } NearbyPerson(
      String googlePlusId, String letter, String displayName, String imageUrl);  NearbyPerson(LetterSource source); void updateState(LetterSource source); final String googlePlusId; final String letter; final String displayName; public String imageUrl; public State state; }
@Test public void stateNew() { person.updateState(null); assertEquals(NearbyPerson.State.NEW, person.state); }
@Test public void stateExisting() { LetterSource source = new LetterSource(); source.available = 1; person.updateState(source); assertEquals(NearbyPerson.State.EXISTING, person.state); }
@Test public void stateRediscovered() { LetterSource source = new LetterSource(); source.available = 0; person.updateState(source); assertEquals(NearbyPerson.State.REDISCOVERED, person.state); }