@@ -0,0 +1,1457 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public%0A * License, v. 2.0. If a copy of the MPL was not distributed with this%0A * file, You can obtain one at http://mozilla.org/MPL/2.0/. */%0Apackage vaeke.countrydata.rest;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.InputStreamReader;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0A%0Aimport vaeke.restcountries.domain.Country;%0A%0Aimport com.eclipsesource.restfuse.HttpJUnitRunner;%0Aimport com.google.gson.Gson;%0Aimport com.google.gson.stream.JsonReader;%0A%0A@RunWith(HttpJUnitRunner.class)%0Apublic class CountryDataTest %7B%0A%09%0A%09List%3CCountry%3E countries;%0A%09%0A%09@Before%0A%09public void before() throws IOException %7B%0A%09%09InputStream is = this.getClass().getClassLoader().getResourceAsStream(%22countries.json%22);%0A%09%09Gson gson = new Gson();%0A%09%09JsonReader reader = new JsonReader(new InputStreamReader(is, %22UTF-8%22));%0A%09%09countries = new ArrayList%3CCountry%3E();%0A%09%09reader.beginArray();%0A%09%09while(reader.hasNext()) %7B%0A%09%09%09Country country = gson.fromJson(reader, Country.class);%0A%09%09%09countries.add(country);%0A%09%09%7D%0A%09%09reader.endArray();%0A        reader.close();%0A%09%7D%0A%09%0A%09@Test%0A%09public void emptyPopulation() %7B%0A%09%09List%3CCountry%3E result = new ArrayList%3CCountry%3E();%0A%09%09for(Country c : countries) %7B%0A%09%09%09if(c.getPopulation() == null) %7B%0A%09%09%09%09result.add(c);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09for(Country c : result) %7B%0A%09%09%09System.out.println(c.getName());%0A%09%09%7D%0A%09%7D%0A%7D%0A

test to see countries with missing data