package com.shentuo.builditbigger;

import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
 * Created by ShentuoZhan on 16/10/17.
 */
@RunWith(AndroidJUnit4.class)
public class RetrieveJokesTest {

    @Rule
    public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class);

    @Before
    public void setup() {
        mActivityRule.getActivity();
    }

    @Test
    public void retrieveJokes() {
        new EndpointsAsyncTask().execute(mActivityRule.getActivity());
    }
}

@@ -240,425 +240,1257 @@
 h;%0A%0A
-/**%0A * Created by ShentuoZhan on 16/10/17.%0A */%0A@RunWith(AndroidJUnit4.class)%0Apublic class RetrieveJokesTest %7B%0A%0A    @Rule%0A    public ActivityTestRule%3CMainActivity%3E mActivityRule = new ActivityTestRule%3C%3E(MainActivity.class);%0A%0A    @Before%0A    public void setup() %7B%0A        mActivityRule.getActivity();%0A    %7D%0A%0A    @Test%0A    public void retrieveJokes() %7B%0A        new EndpointsAsyncTask().execute(mActivityRule.getActivity(
+import static android.support.test.espresso.Espresso.onView;%0Aimport static android.support.test.espresso.action.ViewActions.click;%0Aimport static android.support.test.espresso.assertion.ViewAssertions.matches;%0Aimport static android.support.test.espresso.matcher.ViewMatchers.withId;%0Aimport static android.support.test.espresso.matcher.ViewMatchers.withText;%0Aimport static org.hamcrest.Matchers.not;%0Aimport static org.hamcrest.Matchers.notNullValue;%0A%0A/**%0A * Created by ShentuoZhan on 16/10/17.%0A */%0A@RunWith(AndroidJUnit4.class)%0Apublic class RetrieveJokesTest %7B%0A%0A    @Rule%0A    public ActivityTestRule%3CMainActivity%3E mActivityRule = new ActivityTestRule%3C%3E(MainActivity.class);%0A%0A    @Before%0A    public void setup() %7B%0A        mActivityRule.getActivity();%0A    %7D%0A%0A    @Test%0A    public void retrieveJokes() %7B%0A        // Press the button.%0A        onView(withId(R.id.tell_joke_btn)).perform(click());%0A%0A        // Check that the text not empty or error message.%0A        onView(withId(R.id.jokeContents)).check(matches(notNullValue()));%0A        onView(withId(R.id.jokeContents)).check(matches(not(withText(%22%22))));%0A        onView(withId(R.id.jokeContents))%0A                .check(matches(not(withText(mActivityRule.getActivity().getString(R.string.error_message)))
 ));%0A

Add functional test