ProvinceModel implements PickerItem { public CityModel getCity(int position) { return (position >= 0 && position < getCityCount()) ? mCityList.get(position) : null; }  void addCity(CityModel city); CityModel getCity(int position); ArrayList<CityModel> getCityList(); int getCityCount(); List<String> getCityIdList(); List<String> getCityNameList(); @Override String getText(); String toString(); public String id; public String name; }
@Test public void testGetCity() { CityModel cityModel = new CityModel(); assertNull(model.getCity(0)); model.addCity(cityModel); assertEquals(cityModel, model.getCity(0)); assertNull(model.getCity(-1)); assertNull(model.getCity(1)); for (CityModel city : cities) { model.addCity(city); } assertEquals(cityModel, model.getCity(0)); for (int i=0; i<cities.length; i++) { assertEquals(cities[i], model.getCity(i+1)); } assertNull(model.getCity(-1)); assertNull(model.getCity(CITIES_NUM + 1)); }