From: Gustavo Martin Morcuende Date: Sun, 16 Nov 2014 15:21:30 +0000 (+0100) Subject: WeatherInformation: there are no tests (at the moment) X-Git-Tag: weatherinformation-1.0~60 X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=159e0bac8fa4c73c2f5d48e9279cc3d977e73063;p=AndroidWeatherInformation WeatherInformation: there are no tests (at the moment) --- diff --git a/app/src/androidTest/java/name/gumartinm/weather/information/test/JPOSWeatherParserTest.java b/app/src/androidTest/java/name/gumartinm/weather/information/test/JPOSWeatherParserTest.java deleted file mode 100644 index db1575c..0000000 --- a/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/app/src/androidTest/java/name/gumartinm/weather/information/test/WeatherInformationActivityUnitTest.java b/app/src/androidTest/java/name/gumartinm/weather/information/test/WeatherInformationActivityUnitTest.java deleted file mode 100644 index eefca29..0000000 --- a/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); - } -}