From 0e069b1b1d055f37c4828a7445858daa8a9d0cac Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Sun, 16 Nov 2014 16:21:30 +0100 Subject: [PATCH] WeatherInformation: there are no tests (at the moment) --- .../information/test/JPOSWeatherParserTest.java | 49 ------------------- .../test/WeatherInformationActivityUnitTest.java | 57 ---------------------- 2 files changed, 106 deletions(-) delete mode 100644 Android/WeatherInformation/app/src/androidTest/java/name/gumartinm/weather/information/test/JPOSWeatherParserTest.java delete mode 100644 Android/WeatherInformation/app/src/androidTest/java/name/gumartinm/weather/information/test/WeatherInformationActivityUnitTest.java diff --git a/Android/WeatherInformation/app/src/androidTest/java/name/gumartinm/weather/information/test/JPOSWeatherParserTest.java b/Android/WeatherInformation/app/src/androidTest/java/name/gumartinm/weather/information/test/JPOSWeatherParserTest.java deleted file mode 100644 index db1575c..0000000 --- a/Android/WeatherInformation/app/src/androidTest/java/name/gumartinm/weather/information/test/JPOSWeatherParserTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright 2014 Gustavo Martin Morcuende - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package name.gumartinm.weather.information.test; - -import name.gumartinm.weather.information.parser.JPOSWeatherParser; - -import junit.framework.TestCase; - -import org.json.JSONException; - -public class JPOSWeatherParserTest extends TestCase { - private JPOSWeatherParser jposWeatherParser; - - @Override - protected void setUp() throws Exception { - super.setUp(); - - this.jposWeatherParser = new JPOSWeatherParser(); - } - - public void testRetrieveWeatherFromJPOS() throws JSONException { - // Arrange - final String jsonData = "{\"coord\":{\"lon\":139,\"lat\":35}}"; - final double longitude = 139; - final double latitude = 35; - final WeatherData.Coord coord = new WeatherData.Coord(longitude, latitude); - final WeatherData expectedWeather = new WeatherData.Builder().setCoord(coord).build(); - - // Act - final WeatherData finalWeather = this.jposWeatherParser.retrieveWeatherFromJPOS(jsonData); - - // Assert - assertEquals(expectedWeather.toString(), finalWeather.toString()); - } - -} diff --git a/Android/WeatherInformation/app/src/androidTest/java/name/gumartinm/weather/information/test/WeatherInformationActivityUnitTest.java b/Android/WeatherInformation/app/src/androidTest/java/name/gumartinm/weather/information/test/WeatherInformationActivityUnitTest.java deleted file mode 100644 index eefca29..0000000 --- a/Android/WeatherInformation/app/src/androidTest/java/name/gumartinm/weather/information/test/WeatherInformationActivityUnitTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2014 Gustavo Martin Morcuende - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package name.gumartinm.weather.information.test; - -import android.content.Intent; -import android.widget.Button; - -public class WeatherInformationActivityUnitTest extends - ActivityUnitTestCase { - - private WeatherInformationActivity activity; - - public WeatherInformationActivityUnitTest() { - super(WeatherInformationActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - final Intent intent = new Intent(this.getInstrumentation().getTargetContext(), - WeatherInformationActivity.class); - this.startActivity(intent, null, null); - this.activity = this.getActivity(); - } - - public void testIntentTriggerViaOnClick() { - final int buttonweather = name.gumartinm.weather.information.R.id.buttonweather; - final Button view = (Button) this.activity.findViewById(buttonweather); - assertNotNull("Button Weather not allowed to be null", view); - - view.performClick(); - - // TouchUtils cannot be used, only allowed in - // InstrumentationTestCase or ActivityInstrumentationTestCase2 - - // Check the intent which was started - final Intent triggeredIntent = this.getStartedActivityIntent(); - assertNotNull("Intent was null", triggeredIntent); - final String data = triggeredIntent.getDataString(); - - assertEquals("Incorrect data passed via the intent", - "http://gumartinm.name", data); - } -} -- 2.1.4