mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
57 lines
1.6 KiB
Java
57 lines
1.6 KiB
Java
package fr.free.nrw.commons;
|
|
|
|
import android.content.Context;
|
|
import android.support.test.InstrumentationRegistry;
|
|
import android.support.test.runner.AndroidJUnit4;
|
|
|
|
import org.junit.Assert;
|
|
import org.junit.Before;
|
|
import org.junit.Test;
|
|
import org.junit.runner.RunWith;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import fr.free.nrw.commons.location.LatLng;
|
|
import fr.free.nrw.commons.nearby.NearbyBaseMarker;
|
|
import fr.free.nrw.commons.nearby.NearbyController;
|
|
import fr.free.nrw.commons.nearby.Place;
|
|
|
|
import static org.hamcrest.CoreMatchers.is;
|
|
|
|
@RunWith(AndroidJUnit4.class)
|
|
public class NearbyControllerTest {
|
|
private Context instrumentationContext;
|
|
|
|
@Before
|
|
public void setup() {
|
|
instrumentationContext = InstrumentationRegistry.getTargetContext();
|
|
}
|
|
|
|
@Test public void testNullAttractions() {
|
|
LatLng location = new LatLng(0, 0, 0);
|
|
|
|
List<NearbyBaseMarker> options =
|
|
NearbyController.loadAttractionsFromLocationToBaseMarkerOptions(
|
|
location,
|
|
null,
|
|
instrumentationContext
|
|
);
|
|
|
|
Assert.assertThat(options.size(), is(0));
|
|
}
|
|
|
|
@Test public void testEmptyList() {
|
|
LatLng location = new LatLng(0, 0, 0);
|
|
List<Place> emptyList = new ArrayList<>();
|
|
|
|
List<NearbyBaseMarker> options =
|
|
NearbyController.loadAttractionsFromLocationToBaseMarkerOptions(
|
|
location,
|
|
emptyList,
|
|
instrumentationContext
|
|
);
|
|
|
|
Assert.assertThat(options.size(), is(0));
|
|
}
|
|
}
|