1 package name.gumartinm.weather.information.test;
3 import name.gumartinm.weather.information.parser.JPOSWeatherParser;
5 import junit.framework.TestCase;
7 import org.json.JSONException;
9 public class JPOSWeatherParserTest extends TestCase {
10 private JPOSWeatherParser jposWeatherParser;
13 protected void setUp() throws Exception {
16 this.jposWeatherParser = new JPOSWeatherParser();
19 public void testRetrieveWeatherFromJPOS() throws JSONException {
21 final String jsonData = "{\"coord\":{\"lon\":139,\"lat\":35}}";
22 final double longitude = 139;
23 final double latitude = 35;
24 final WeatherData.Coord coord = new WeatherData.Coord(longitude, latitude);
25 final WeatherData expectedWeather = new WeatherData.Builder().setCoord(coord).build();
28 final WeatherData finalWeather = this.jposWeatherParser.retrieveWeatherFromJPOS(jsonData);
31 assertEquals(expectedWeather.toString(), finalWeather.toString());