Query { public City getCityData(String city) { city = city.replace("\'", "\\\'"); queryCityData = "SELECT * FROM Cities WHERE city=\'" + city + "\';"; queryHousingData = "SELECT id, place_name, place_id, period, index_nsa, index_sa, MAX(year) FROM Houses WHERE place_name LIKE \'%" + city + "\' ;"; queryCrimeData = "SELECT * FROM Crime WHERE City=\'" + city + "\';"; runQuery(dbh, queryCityData, "City", -1); runQuery(dbh, queryHousingData, "Housing", -1); runQuery(dbc, queryCrimeData, "Crime", -1); return this.city; } Query(); City getCityData(String city); ArrayList<City> getLowestCrime(String state, int n); City getCityByCrime(City c); ArrayList<String> getStateNames(); ArrayList<String> getCityNames(String state);  }
@Test public void testGetCityData() { for(int i = 0; i < 27; i++) { City c = q.getCityData(cities[i][0]); boolean c_one = true, c_two = true, c_three = true, c_four = true, c_five = true; if(num[i][0] != -1.0f) c_one = c.getIndex_nsa() == num[i][0]; if(num[i][1] != -1.0f) c_two = c.getIndex_sa() == num[i][1]; if(num[i][2] != -1.0f) c_three = c.getViolentCrime() == num[i][2]; if(num[i][3] != -1.0f) c_four = c.getMurder() == num[i][3]; if(num[i][4] != -1.0f) c_five = c.getRape() == num[i][4]; assertTrue ( c_three && c_four && c_five ); } }