PeliasPlaceDetailFetcher implements PlaceDetailFetcher { @Override public void fetchDetails(final Map<String, String> properties, final OnPlaceDetailsFetchedListener listener) { final long id = parseId(properties); final String nodeOrWay = parseNodeOrWay(properties); final String gid = PELIAS_GID_BASE + nodeOrWay + id; fetchDetails(gid, listener); } PeliasPlaceDetailFetcher(Pelias pelias, PeliasCallbackHandler callbackHandler); @Override void fetchDetails(final Map<String, String> properties,
      final OnPlaceDetailsFetchedListener listener); @Override void fetchDetails(String gid, final OnPlaceDetailsFetchedListener listener);  }
@Test public void fetchDetails_props_shouldCallPelias() throws Exception { Map props = new HashMap(); fetcher.fetchDetails(props, null); verify(pelias).place(anyString(), any(Callback.class)); }
@Test public void fetchDetails_gid_shouldCallPelias() throws Exception { String gid = "123"; fetcher.fetchDetails(gid, null); verify(pelias).place(eq(gid), any(Callback.class)); }
@Test public void fetchDetails_props_shouldConstructGidWithWayIfHasArea() throws Exception { Map props = new HashMap(); props.put(PROP_ID, "123.000"); props.put(PROP_AREA, "456.000"); fetcher.fetchDetails(props, null); verify(pelias).place(eq(PELIAS_GID_BASE + PELIAS_GID_WAY + "123"), any(Callback.class)); }
@Test public void fetchDetails_props_shouldConstructGidWithWayIfHasAreaYes() throws Exception { Map props = new HashMap(); props.put(PROP_ID, "123.000"); props.put(PROP_AREA, "yes"); fetcher.fetchDetails(props, null); verify(pelias).place(eq(PELIAS_GID_BASE + PELIAS_GID_WAY + "123"), any(Callback.class)); }
@Test public void fetchDetails_props_shouldConstructGidWithNodeIfNoArea() throws Exception { Map props = new HashMap(); props.put(PROP_ID, "123.000"); fetcher.fetchDetails(props, null); verify(pelias).place(eq(PELIAS_GID_BASE + PELIAS_GID_NODE + "123"), any(Callback.class)); }