Back to project page droidcon-android-espresso.
The source code is released under:
Apache License
If you think the Android project droidcon-android-espresso listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.xrigau.droidcon.espresso; /*from w ww .j a va 2 s . c o m*/ import android.app.Activity; import android.widget.TextView; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.Robolectric; import org.robolectric.RobolectricTestRunner; import org.robolectric.util.ActivityController; import static org.junit.Assert.assertEquals; @RunWith(RobolectricTestRunner.class) public class AndroidUnitTest { @Test public void testInstantiation() { String expected = "Robolectric is running with Gradle"; ActivityController<Activity> activity = Robolectric.buildActivity(Activity.class); TextView textView = new TextView(activity.get().getApplicationContext()); textView.setText(expected); assertEquals(expected, textView.getText()); } }