1 package name.gumartinm.weather.information.test;
3 import android.content.Intent;
4 import android.widget.Button;
6 public class WeatherInformationActivityUnitTest extends
7 ActivityUnitTestCase<WeatherInformationActivity> {
9 private WeatherInformationActivity activity;
11 public WeatherInformationActivityUnitTest() {
12 super(WeatherInformationActivity.class);
16 protected void setUp() throws Exception {
18 final Intent intent = new Intent(this.getInstrumentation().getTargetContext(),
19 WeatherInformationActivity.class);
20 this.startActivity(intent, null, null);
21 this.activity = this.getActivity();
24 public void testIntentTriggerViaOnClick() {
25 final int buttonweather = name.gumartinm.weather.information.R.id.buttonweather;
26 final Button view = (Button) this.activity.findViewById(buttonweather);
27 assertNotNull("Button Weather not allowed to be null", view);
31 // TouchUtils cannot be used, only allowed in
32 // InstrumentationTestCase or ActivityInstrumentationTestCase2
34 // Check the intent which was started
35 final Intent triggeredIntent = this.getStartedActivityIntent();
36 assertNotNull("Intent was null", triggeredIntent);
37 final String data = triggeredIntent.getDataString();
39 assertEquals("Incorrect data passed via the intent",
40 "http://gumartinm.name", data);