diff --git a/enabler/src/de/schildbach/pte/dto/Location.java b/enabler/src/de/schildbach/pte/dto/Location.java index addb90dd..60d4d45f 100644 --- a/enabler/src/de/schildbach/pte/dto/Location.java +++ b/enabler/src/de/schildbach/pte/dto/Location.java @@ -145,7 +145,7 @@ public final class Location implements Serializable } @Override - public boolean equals(Object o) + public boolean equals(final Object o) { if (o == this) return true; @@ -154,10 +154,10 @@ public final class Location implements Serializable final Location other = (Location) o; if (this.type != other.type) return false; - if (this.id != 0 && this.id == other.id) - return true; - if (this.lat != 0 && this.lon != 0 && this.lat == other.lat && this.lon == other.lon) - return true; + if (this.id != 0) + return this.id == other.id; + if (this.lat != 0 && this.lon != 0) + return this.lat == other.lat && this.lon == other.lon; if (!nullSafeEquals(this.name, other.name)) // only discriminate by name if no ids are given return false; return true; diff --git a/enabler/test/de/schildbach/pte/live/MvvProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/MvvProviderLiveTest.java index efb024c2..d5c34ab0 100644 --- a/enabler/test/de/schildbach/pte/live/MvvProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/MvvProviderLiveTest.java @@ -17,7 +17,9 @@ package de.schildbach.pte.live; +import static org.hamcrest.CoreMatchers.hasItem; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; import java.util.Date; import java.util.List; @@ -96,6 +98,9 @@ public class MvvProviderLiveTest extends AbstractProviderLiveTest @Test public void autocompleteLocal() throws Exception { + final List autocompletesFraunhoferStr = provider.autocompleteStations("fraunhofer"); + assertThat(autocompletesFraunhoferStr, hasItem(new Location(LocationType.STATION, 1000150))); + final List autocompletesHirschgarten = provider.autocompleteStations("Hirschgarten"); assertEquals("München", autocompletesHirschgarten.get(0).place);