// Path: app/src/main/java/com/tobi/movies/popularstream/MoviePosterAdapter.java
// public class MoviePosterAdapter extends RecyclerView.Adapter<MoviePosterAdapter.MoviePosterViewHolder> {
// 
//     private final List<MoviePoster> moviePosters;
//     private final ImageLoader imageLoader;
//     private final Navigator navigator;
// 
//     public MoviePosterAdapter(List<MoviePoster> moviePosters, ImageLoader imageLoader, Navigator navigator) {
//         this.moviePosters = moviePosters;
//         this.imageLoader = imageLoader;
//         this.navigator = navigator;
//     }
// 
//     @Override
//     public MoviePosterViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//         View moviePosterView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_movie_poster, parent, false);
//         return new MoviePosterViewHolder(moviePosterView);
//     }
// 
//     @Override
//     public void onBindViewHolder(MoviePosterViewHolder holder, int position) {
//         final MoviePoster moviePoster = moviePosters.get(position);
//         String posterPath = moviePoster.getPosterPath();
//         imageLoader.loadWebImageInto(Uri.parse(posterPath), holder.posterImage);
//         holder.posterImage.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
//                 navigator.toMovieDetails(moviePoster.getMovieId());
//             }
//         });
//     }
// 
//     @Override
//     public int getItemCount() {
//         return moviePosters.size();
//     }
// 
//     @VisibleForTesting
//     public MoviePoster getItemAt(int position) {
//         return moviePosters.get(position);
//     }
// 
//     public static class MoviePosterViewHolder extends RecyclerView.ViewHolder {
// 
//         @BindView(R.id.posterImage)
//         ImageView posterImage;
// 
//         public MoviePosterViewHolder(View itemView) {
//             super(itemView);
//             ButterKnife.bind(this, itemView);
//         }
//     }
// }


import android.support.test.espresso.matcher.BoundedMatcher;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.tobi.movies.popularstream.MoviePoster;
import com.tobi.movies.popularstream.MoviePosterAdapter;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
package com.tobi.movies.matchers;




public class PosterMatcher {

    public static Matcher<? super View> hasPosterAt(final int position, final String posterPath) {
        return new BoundedMatcher<View, RecyclerView>(RecyclerView.class) {
            @Override
            public void describeTo(Description description) {
                description.appendText("has poster with path:" + posterPath + " at position:" + position);
            }

            @Override
            protected boolean matchesSafely(RecyclerView item) {
// Path: app/src/main/java/com/tobi/movies/popularstream/MoviePosterAdapter.java
// public class MoviePosterAdapter extends RecyclerView.Adapter<MoviePosterAdapter.MoviePosterViewHolder> {
// 
//     private final List<MoviePoster> moviePosters;
//     private final ImageLoader imageLoader;
//     private final Navigator navigator;
// 
//     public MoviePosterAdapter(List<MoviePoster> moviePosters, ImageLoader imageLoader, Navigator navigator) {
//         this.moviePosters = moviePosters;
//         this.imageLoader = imageLoader;
//         this.navigator = navigator;
//     }
// 
//     @Override
//     public MoviePosterViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//         View moviePosterView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_movie_poster, parent, false);
//         return new MoviePosterViewHolder(moviePosterView);
//     }
// 
//     @Override
//     public void onBindViewHolder(MoviePosterViewHolder holder, int position) {
//         final MoviePoster moviePoster = moviePosters.get(position);
//         String posterPath = moviePoster.getPosterPath();
//         imageLoader.loadWebImageInto(Uri.parse(posterPath), holder.posterImage);
//         holder.posterImage.setOnClickListener(new View.OnClickListener() {
//             @Override
//             public void onClick(View v) {
//                 navigator.toMovieDetails(moviePoster.getMovieId());
//             }
//         });
//     }
// 
//     @Override
//     public int getItemCount() {
//         return moviePosters.size();
//     }
// 
//     @VisibleForTesting
//     public MoviePoster getItemAt(int position) {
//         return moviePosters.get(position);
//     }
// 
//     public static class MoviePosterViewHolder extends RecyclerView.ViewHolder {
// 
//         @BindView(R.id.posterImage)
//         ImageView posterImage;
// 
//         public MoviePosterViewHolder(View itemView) {
//             super(itemView);
//             ButterKnife.bind(this, itemView);
//         }
//     }
// }


// Path: app/src/androidTest/java/com/tobi/movies/matchers/PosterMatcher.java
import android.support.test.espresso.matcher.BoundedMatcher;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.tobi.movies.popularstream.MoviePoster;
import com.tobi.movies.popularstream.MoviePosterAdapter;
import org.hamcrest.Description;
import org.hamcrest.Matcher;

package com.tobi.movies.matchers;




public class PosterMatcher {

    public static Matcher<? super View> hasPosterAt(final int position, final String posterPath) {
        return new BoundedMatcher<View, RecyclerView>(RecyclerView.class) {
            @Override
            public void describeTo(Description description) {
                description.appendText("has poster with path:" + posterPath + " at position:" + position);
            }

            @Override
            protected boolean matchesSafely(RecyclerView item) {
                MoviePosterAdapter adapter = (MoviePosterAdapter) item.getAdapter();