Merge pull request #1034 from misaochan/fix-description-bug

Fix issue with Nearby item descriptions
This commit is contained in:
Yusuke Matsubara 2018-01-15 18:29:24 +09:00 committed by GitHub
commit a8bc53d1a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 27 deletions

View file

@ -30,10 +30,11 @@ import static org.junit.Assert.assertNotNull;
@Config(constants = BuildConfig.class, sdk = 21, application = TestCommonsApplication.class)
public class NearbyAdapterFactoryTest {
private static final Place PLACE = new Place("name", Place.Description.AIRPORT,
private static final Place PLACE = new Place("name", Place.Label.AIRPORT,
"desc", null, new LatLng(38.6270, -90.1994, 0), null);
private static final Place UNKNOWN_PLACE = new Place("name", Place.Description.UNKNOWN,
"desc", null, new LatLng(39.7392, -104.9903, 0), null);
private static final Place UNKNOWN_PLACE = new Place("name", Place.Label.UNKNOWN,
"?", null, new LatLng(39.7392, -104.9903, 0), null);
// ^ "?" is a special value for unknown class names from Wikidata query results
private Place clickedPlace;
@Test
@ -68,12 +69,13 @@ public class NearbyAdapterFactoryTest {
RendererViewHolder viewHolder = renderComponent(result);
// test that the values we gave are actually rendered
assertNotNull(viewHolder.itemView.findViewById(R.id.tvName));
assertEquals("name",
assertEquals(PLACE.name,
((TextView) viewHolder.itemView.findViewById(R.id.tvName)).getText().toString());
assertNotNull(viewHolder.itemView.findViewById(R.id.tvDesc));
assertEquals("airport",
assertEquals(PLACE.getLongDescription(),
((TextView) viewHolder.itemView.findViewById(R.id.tvDesc)).getText().toString());
assertNotNull(viewHolder.itemView.findViewById(R.id.distance));
@ -94,7 +96,7 @@ public class NearbyAdapterFactoryTest {
RendererViewHolder viewHolder = renderComponent(result);
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());
assertNotNull(viewHolder.itemView.findViewById(R.id.icon));