// Path: app/src/main/java/com/xurxodev/moviesandroidkata/presentation/view/activity/MoviesActivity.java
// public class MoviesActivity extends AppCompatActivity {
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_movies);
// 
//         initializeToolBar();
// 
//         if (savedInstanceState == null) {
//             showDetailFragment();
//         }
//     }
// 
//     private void showDetailFragment() {
//         MoviesFragment fragment = new MoviesFragment();
// 
//         getSupportFragmentManager().beginTransaction()
//                 .add(R.id.movies_list_container, fragment)
//                 .commit();
//     }
// 
//     private void initializeToolBar() {
//         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//         setSupportActionBar(toolbar);
//     }
// }
// 
// Path: app/src/androidTest/java/com/xurxodev/moviesandroidkata/robot/MoviesRobot.java
// public class MoviesRobot {
//     private MoviesActivity activity;
//     RecyclerView recyclerView;
//     ProgressbarIdlingResource progressbarIdlingResource;
// 
//     public MoviesRobot(MoviesActivity activity) {
//         this.activity = activity;
//         this.recyclerView = (RecyclerView) activity.findViewById(R.id.recyclerview_movies);
//         this.progressbarIdlingResource = new ProgressbarIdlingResource(activity);
// 
//         removeAnimateDrawableFromProgressForTest();
//     }
// 
//     public int getNumMoviesRows() {
//         return recyclerView.getAdapter().getItemCount();
//     }
// 
//     public MoviesRobot waitForMovies() {
//         Espresso.registerIdlingResources(progressbarIdlingResource);
// 
//         onView(withId(R.id.recyclerview_movies)).check(matches(isDisplayed()));
// 
//         Espresso.unregisterIdlingResources(progressbarIdlingResource);
// 
//         return this;
//     }
// 
//     public String getMovieTitle(int i) {
//         return ((MoviesAdapter) recyclerView.getAdapter()).movies.get(i).getTitle();
//     }
// 
//     public MovieDetailRobot navigateToMovie(int position) {
//         onView(withId(R.id.recyclerview_movies))
//                 .perform(RecyclerViewActions.actionOnItemAtPosition(position, click()));
// 
//         return new MovieDetailRobot(this);
//     }
// 
//     public MoviesRobot verifyTextWithMoviesCount(int numMovies) {
//         String formatCountText = activity.getString(R.string.movies_count_text);
//         String expectedText = String.format(formatCountText, numMovies);
// 
//         onView(withId(R.id.movies_title_text_view)).check(matches(withText(expectedText)));
// 
//         return this;
//     }
// 
//     public MoviesRobot refreshMovies() {
//         onView(withId(R.id.refresh_button)).perform(click());
//         return this;
//     }
// 
//     public MoviesRobot verifyLoadingText() {
//         String text = activity.getString(R.string.loading_movies_text);
// 
//         onView(withId(R.id.movies_title_text_view)).check(
//                 matches(withText(text)));
// 
//         return this;
//     }
// 
//     public MoviesRobot verifyProgressIsVisible() {
//         onView(withId(R.id.pb_loading)).check(
//                 matches(isDisplayed()));
// 
//         return this;
//     }
// 
//     public MoviesRobot verifyProgressIsHide() {
//         onView(withId(R.id.pb_loading)).check(
//                 matches(not(isDisplayed())));
// 
//         return this;
//     }
// 
//     private void removeAnimateDrawableFromProgressForTest() {
//         Drawable notAnimatedDrawable = ContextCompat.getDrawable(activity, R.drawable.ic_refresh);
//         ((ProgressBar) activity.findViewById(R.id.pb_loading)).setIndeterminateDrawable(
//                 notAnimatedDrawable);
// 
//     }
// }


import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import com.xurxodev.moviesandroidkata.presentation.view.activity.MoviesActivity;
import com.xurxodev.moviesandroidkata.robot.MoviesRobot;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
package com.xurxodev.moviesandroidkata.test;




@RunWith(AndroidJUnit4.class)
public class MoviesProgressBarFeature {
    @Rule
    public ActivityTestRule<MoviesActivity> activityTestRule =
            new ActivityTestRule<>(MoviesActivity.class);

    @Test
    public void show_loading_text_while_retrieve_movies() {
// Path: app/src/main/java/com/xurxodev/moviesandroidkata/presentation/view/activity/MoviesActivity.java
// public class MoviesActivity extends AppCompatActivity {
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_movies);
// 
//         initializeToolBar();
// 
//         if (savedInstanceState == null) {
//             showDetailFragment();
//         }
//     }
// 
//     private void showDetailFragment() {
//         MoviesFragment fragment = new MoviesFragment();
// 
//         getSupportFragmentManager().beginTransaction()
//                 .add(R.id.movies_list_container, fragment)
//                 .commit();
//     }
// 
//     private void initializeToolBar() {
//         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//         setSupportActionBar(toolbar);
//     }
// }
// 
// Path: app/src/androidTest/java/com/xurxodev/moviesandroidkata/robot/MoviesRobot.java
// public class MoviesRobot {
//     private MoviesActivity activity;
//     RecyclerView recyclerView;
//     ProgressbarIdlingResource progressbarIdlingResource;
// 
//     public MoviesRobot(MoviesActivity activity) {
//         this.activity = activity;
//         this.recyclerView = (RecyclerView) activity.findViewById(R.id.recyclerview_movies);
//         this.progressbarIdlingResource = new ProgressbarIdlingResource(activity);
// 
//         removeAnimateDrawableFromProgressForTest();
//     }
// 
//     public int getNumMoviesRows() {
//         return recyclerView.getAdapter().getItemCount();
//     }
// 
//     public MoviesRobot waitForMovies() {
//         Espresso.registerIdlingResources(progressbarIdlingResource);
// 
//         onView(withId(R.id.recyclerview_movies)).check(matches(isDisplayed()));
// 
//         Espresso.unregisterIdlingResources(progressbarIdlingResource);
// 
//         return this;
//     }
// 
//     public String getMovieTitle(int i) {
//         return ((MoviesAdapter) recyclerView.getAdapter()).movies.get(i).getTitle();
//     }
// 
//     public MovieDetailRobot navigateToMovie(int position) {
//         onView(withId(R.id.recyclerview_movies))
//                 .perform(RecyclerViewActions.actionOnItemAtPosition(position, click()));
// 
//         return new MovieDetailRobot(this);
//     }
// 
//     public MoviesRobot verifyTextWithMoviesCount(int numMovies) {
//         String formatCountText = activity.getString(R.string.movies_count_text);
//         String expectedText = String.format(formatCountText, numMovies);
// 
//         onView(withId(R.id.movies_title_text_view)).check(matches(withText(expectedText)));
// 
//         return this;
//     }
// 
//     public MoviesRobot refreshMovies() {
//         onView(withId(R.id.refresh_button)).perform(click());
//         return this;
//     }
// 
//     public MoviesRobot verifyLoadingText() {
//         String text = activity.getString(R.string.loading_movies_text);
// 
//         onView(withId(R.id.movies_title_text_view)).check(
//                 matches(withText(text)));
// 
//         return this;
//     }
// 
//     public MoviesRobot verifyProgressIsVisible() {
//         onView(withId(R.id.pb_loading)).check(
//                 matches(isDisplayed()));
// 
//         return this;
//     }
// 
//     public MoviesRobot verifyProgressIsHide() {
//         onView(withId(R.id.pb_loading)).check(
//                 matches(not(isDisplayed())));
// 
//         return this;
//     }
// 
//     private void removeAnimateDrawableFromProgressForTest() {
//         Drawable notAnimatedDrawable = ContextCompat.getDrawable(activity, R.drawable.ic_refresh);
//         ((ProgressBar) activity.findViewById(R.id.pb_loading)).setIndeterminateDrawable(
//                 notAnimatedDrawable);
// 
//     }
// }


// Path: app/src/androidTest/java/com/xurxodev/moviesandroidkata/test/MoviesProgressBarFeature.java
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import com.xurxodev.moviesandroidkata.presentation.view.activity.MoviesActivity;
import com.xurxodev.moviesandroidkata.robot.MoviesRobot;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

package com.xurxodev.moviesandroidkata.test;




@RunWith(AndroidJUnit4.class)
public class MoviesProgressBarFeature {
    @Rule
    public ActivityTestRule<MoviesActivity> activityTestRule =
            new ActivityTestRule<>(MoviesActivity.class);

    @Test
    public void show_loading_text_while_retrieve_movies() {
        MoviesRobot moviesRobot = new MoviesRobot(activityTestRule.getActivity());