ProvinceModel implements PickerItem { public String toString() { return name + "[" + id + "][" + getCityCount() + " cities]"; }  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 testToString() { model.id = PROVINCE_ID; model.name = PROVINCE_NAME; assertEquals("ProvinceName[ProvinceId][0 cities]", model.toString()); model.addCity(new CityModel()); assertEquals("ProvinceName[ProvinceId][1 cities]", model.toString()); for (CityModel city : cities) { model.addCity(city); } assertEquals("ProvinceName[ProvinceId][" + (CITIES_NUM + 1) + " cities]", model.toString()); }