package com.eni.android.helloandroid.test;

import android.test.ActivityInstrumentationTestCase2;
import android.widget.TextView;

import com.eni.android.helloandroid.HelloAndroidActivity;

public class HelloAndroidActivityTest extends
		ActivityInstrumentationTestCase2<HelloAndroidActivity> {
	
	private HelloAndroidActivity myActivity = null;
	private TextView myView = null;
	private String expectedStr = null;
	
	public HelloAndroidActivityTest()
	{
		super(HelloAndroidActivity.class);
	}

	@Override
	protected void setUp() throws Exception {
		super.setUp();
		myActivity = this.getActivity();
		myView = (TextView)
				myActivity.findViewById(com.eni.android.helloandroid.R.id.helloTxt);
		expectedStr = myActivity.getResources().getString(com.eni.android.helloandroid.R.string.hello_world);
	}
	
	public void testPrecondiciones() {
		assertNotNull(myActivity);
		assertNotNull(myView);
		assertNotNull(expectedStr);
	}
	
	public void testTexto() {
		assertEquals(expectedStr, (String) myView.getText());
	}
}
