mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fix NearbyAdapterFactoryTest by reflecting PlaceRender's new behavior
This commit is contained in:
parent
36ec230506
commit
698fad62ce
1 changed files with 6 additions and 4 deletions
|
|
@ -33,7 +33,8 @@ public class NearbyAdapterFactoryTest {
|
||||||
private static final Place PLACE = new Place("name", Place.Label.AIRPORT,
|
private static final Place PLACE = new Place("name", Place.Label.AIRPORT,
|
||||||
"desc", null, new LatLng(38.6270, -90.1994, 0), null);
|
"desc", null, new LatLng(38.6270, -90.1994, 0), null);
|
||||||
private static final Place UNKNOWN_PLACE = new Place("name", Place.Label.UNKNOWN,
|
private static final Place UNKNOWN_PLACE = new Place("name", Place.Label.UNKNOWN,
|
||||||
"desc", null, new LatLng(39.7392, -104.9903, 0), null);
|
"?", null, new LatLng(39.7392, -104.9903, 0), null);
|
||||||
|
// ^ "?" is a special value for unknown class names from Wikidata query results
|
||||||
private Place clickedPlace;
|
private Place clickedPlace;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -68,12 +69,13 @@ public class NearbyAdapterFactoryTest {
|
||||||
|
|
||||||
RendererViewHolder viewHolder = renderComponent(result);
|
RendererViewHolder viewHolder = renderComponent(result);
|
||||||
|
|
||||||
|
// test that the values we gave are actually rendered
|
||||||
assertNotNull(viewHolder.itemView.findViewById(R.id.tvName));
|
assertNotNull(viewHolder.itemView.findViewById(R.id.tvName));
|
||||||
assertEquals("name",
|
assertEquals(PLACE.name,
|
||||||
((TextView) viewHolder.itemView.findViewById(R.id.tvName)).getText().toString());
|
((TextView) viewHolder.itemView.findViewById(R.id.tvName)).getText().toString());
|
||||||
|
|
||||||
assertNotNull(viewHolder.itemView.findViewById(R.id.tvDesc));
|
assertNotNull(viewHolder.itemView.findViewById(R.id.tvDesc));
|
||||||
assertEquals("airport",
|
assertEquals(PLACE.getLongDescription(),
|
||||||
((TextView) viewHolder.itemView.findViewById(R.id.tvDesc)).getText().toString());
|
((TextView) viewHolder.itemView.findViewById(R.id.tvDesc)).getText().toString());
|
||||||
|
|
||||||
assertNotNull(viewHolder.itemView.findViewById(R.id.distance));
|
assertNotNull(viewHolder.itemView.findViewById(R.id.distance));
|
||||||
|
|
@ -94,7 +96,7 @@ public class NearbyAdapterFactoryTest {
|
||||||
RendererViewHolder viewHolder = renderComponent(result);
|
RendererViewHolder viewHolder = renderComponent(result);
|
||||||
|
|
||||||
assertNotNull(viewHolder.itemView.findViewById(R.id.tvDesc));
|
assertNotNull(viewHolder.itemView.findViewById(R.id.tvDesc));
|
||||||
assertEquals("no description found",
|
assertEquals(RuntimeEnvironment.application.getString(R.string.no_description_found),
|
||||||
((TextView) viewHolder.itemView.findViewById(R.id.tvDesc)).getText().toString());
|
((TextView) viewHolder.itemView.findViewById(R.id.tvDesc)).getText().toString());
|
||||||
|
|
||||||
assertNotNull(viewHolder.itemView.findViewById(R.id.icon));
|
assertNotNull(viewHolder.itemView.findViewById(R.id.icon));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue