Event implements Parcelable, Comparable<Event> { public boolean hasLocation() { return getLocation() != null && !getLocation().trim().isEmpty(); } Event(); protected  Event(Parcel in); @Override void writeToParcel(Parcel dest, int flags); @Override int describeContents(); LocalDateTime getLocalStart(); @Nullable LocalDateTime getLocalEnd(); String getTitle(); OffsetDateTime getStart(); @Nullable OffsetDateTime getEnd(); String getLocation(); String getAddress(); boolean hasPreciseLocation(); boolean hasLocation(); String getDescription(); String getUrl(); boolean hasUrl(); String getAssociation(); String getIdentifier(); @Override int compareTo(Event o); @Override boolean equals(Object o); @Override int hashCode(); static final Creator<Event> CREATOR; }
@Test public void shouldNotHaveLocation_whenThereIsNoLocation() { Event event = Utils.generate(Event.class, "location"); assertFalse(event.hasLocation()); Utils.setField(event, "location", ""); }
@Test public void shouldNotHaveLocation_whenThereIsEmptyLocation() { Event event = Utils.generate(Event.class, "location"); Utils.setField(event, "location", ""); assertFalse(event.hasLocation()); }
@Test public void shouldHaveLocation_whenThereIsLocation() { Event event = Utils.generate(Event.class); assertTrue(event.hasLocation()); }