// Path: app/src/main/java/de/czyrux/store/core/domain/product/Product.java
// public class Product {
//     public final String sku;
//     public final String title;
//     public final String imageUrl;
//     public final double price;
// 
//     public Product(String sku, String title, String imageUrl, double price) {
//         this.sku = sku;
//         this.title = title;
//         this.imageUrl = imageUrl;
//         this.price = price;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         Product product = (Product) o;
// 
//         if (Double.compare(product.price, price) != 0) return false;
//         if (sku != null ? !sku.equals(product.sku) : product.sku != null) return false;
//         if (title != null ? !title.equals(product.title) : product.title != null) return false;
//         return imageUrl != null ? imageUrl.equals(product.imageUrl) : product.imageUrl == null;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result;
//         long temp;
//         result = sku != null ? sku.hashCode() : 0;
//         result = 31 * result + (title != null ? title.hashCode() : 0);
//         result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
//         temp = Double.doubleToLongBits(price);
//         result = 31 * result + (int) (temp ^ (temp >>> 32));
//         return result;
//     }
// 
//     @Override
//     public String toString() {
//         final StringBuilder sb = new StringBuilder("Product{");
//         sb.append("sku='").append(sku).append('\'');
//         sb.append(", title='").append(title).append('\'');
//         sb.append(", imageUrl='").append(imageUrl).append('\'');
//         sb.append(", price=").append(price);
//         sb.append('}');
//         return sb.toString();
//     }
// }
// 
// Path: app/src/androidTest/java/de/czyrux/store/toolbox/matchers/recyclerview/RecyclerViewInteraction.java
// public class RecyclerViewInteraction<A> {
// 
//   private Matcher<View> viewMatcher;
//   private List<A> items;
// 
//   private RecyclerViewInteraction(Matcher<View> viewMatcher) {
//     this.viewMatcher = viewMatcher;
//   }
// 
//   public static <A> RecyclerViewInteraction<A> onRecyclerView(Matcher<View> viewMatcher) {
//     return new RecyclerViewInteraction<>(viewMatcher);
//   }
// 
//   public RecyclerViewInteraction<A> withItems(List<A> items) {
//     this.items = items;
//     return this;
//   }
// 
//   public RecyclerViewInteraction<A> check(ItemViewAssertion<A> itemViewAssertion) {
//     for (int i = 0; i < items.size(); i++) {
//       onView(viewMatcher)
//           .perform(scrollToPosition(i))
//           .check(new RecyclerItemViewAssertion<>(i, items.get(i), itemViewAssertion));
//     }
//     return this;
//   }
// 
//   public interface ItemViewAssertion<A> {
//     void check(A item, View view, NoMatchingViewException e);
//   }
// }
// 
// Path: app/src/androidTest/java/de/czyrux/store/toolbox/matchers/recyclerview/RecyclerViewItemsCountMatcher.java
// public class RecyclerViewItemsCountMatcher extends BaseMatcher<View> {
// 
//   private final int expectedItemCount;
// 
//   public RecyclerViewItemsCountMatcher(int expectedItemCount) {
//     this.expectedItemCount = expectedItemCount;
//   }
// 
//   @Override public boolean matches(Object item) {
//     RecyclerView recyclerView = (RecyclerView) item;
//     if (recyclerView.getAdapter() == null) {
//       return false;
//     }
//     return recyclerView.getAdapter().getItemCount() == expectedItemCount;
//   }
// 
//   @Override public void describeTo(Description description) {
//     description.appendText("recycler view does not contains " + expectedItemCount + " items");
//   }
// 
//   public static Matcher<View> recyclerViewHasItemCount(int itemCount) {
//     return new RecyclerViewItemsCountMatcher(itemCount);
//   }
// }


import android.support.test.espresso.matcher.ViewMatchers;
import java.util.List;
import de.czyrux.store.R;
import de.czyrux.store.core.domain.product.Product;
import de.czyrux.store.toolbox.matchers.recyclerview.RecyclerViewInteraction;
import de.czyrux.store.toolbox.matchers.recyclerview.RecyclerViewItemsCountMatcher;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
import static android.support.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
package de.czyrux.store.screen;





public class CatalogScreen {

    public static void showsEmptyCatalog() {
        onView(withId(R.id.catalog_emptyView)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));
    }

    public static void matchesProductCount(int size) {
        onView(withId(R.id.catalog_recyclerview))
// Path: app/src/main/java/de/czyrux/store/core/domain/product/Product.java
// public class Product {
//     public final String sku;
//     public final String title;
//     public final String imageUrl;
//     public final double price;
// 
//     public Product(String sku, String title, String imageUrl, double price) {
//         this.sku = sku;
//         this.title = title;
//         this.imageUrl = imageUrl;
//         this.price = price;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         Product product = (Product) o;
// 
//         if (Double.compare(product.price, price) != 0) return false;
//         if (sku != null ? !sku.equals(product.sku) : product.sku != null) return false;
//         if (title != null ? !title.equals(product.title) : product.title != null) return false;
//         return imageUrl != null ? imageUrl.equals(product.imageUrl) : product.imageUrl == null;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result;
//         long temp;
//         result = sku != null ? sku.hashCode() : 0;
//         result = 31 * result + (title != null ? title.hashCode() : 0);
//         result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
//         temp = Double.doubleToLongBits(price);
//         result = 31 * result + (int) (temp ^ (temp >>> 32));
//         return result;
//     }
// 
//     @Override
//     public String toString() {
//         final StringBuilder sb = new StringBuilder("Product{");
//         sb.append("sku='").append(sku).append('\'');
//         sb.append(", title='").append(title).append('\'');
//         sb.append(", imageUrl='").append(imageUrl).append('\'');
//         sb.append(", price=").append(price);
//         sb.append('}');
//         return sb.toString();
//     }
// }
// 
// Path: app/src/androidTest/java/de/czyrux/store/toolbox/matchers/recyclerview/RecyclerViewInteraction.java
// public class RecyclerViewInteraction<A> {
// 
//   private Matcher<View> viewMatcher;
//   private List<A> items;
// 
//   private RecyclerViewInteraction(Matcher<View> viewMatcher) {
//     this.viewMatcher = viewMatcher;
//   }
// 
//   public static <A> RecyclerViewInteraction<A> onRecyclerView(Matcher<View> viewMatcher) {
//     return new RecyclerViewInteraction<>(viewMatcher);
//   }
// 
//   public RecyclerViewInteraction<A> withItems(List<A> items) {
//     this.items = items;
//     return this;
//   }
// 
//   public RecyclerViewInteraction<A> check(ItemViewAssertion<A> itemViewAssertion) {
//     for (int i = 0; i < items.size(); i++) {
//       onView(viewMatcher)
//           .perform(scrollToPosition(i))
//           .check(new RecyclerItemViewAssertion<>(i, items.get(i), itemViewAssertion));
//     }
//     return this;
//   }
// 
//   public interface ItemViewAssertion<A> {
//     void check(A item, View view, NoMatchingViewException e);
//   }
// }
// 
// Path: app/src/androidTest/java/de/czyrux/store/toolbox/matchers/recyclerview/RecyclerViewItemsCountMatcher.java
// public class RecyclerViewItemsCountMatcher extends BaseMatcher<View> {
// 
//   private final int expectedItemCount;
// 
//   public RecyclerViewItemsCountMatcher(int expectedItemCount) {
//     this.expectedItemCount = expectedItemCount;
//   }
// 
//   @Override public boolean matches(Object item) {
//     RecyclerView recyclerView = (RecyclerView) item;
//     if (recyclerView.getAdapter() == null) {
//       return false;
//     }
//     return recyclerView.getAdapter().getItemCount() == expectedItemCount;
//   }
// 
//   @Override public void describeTo(Description description) {
//     description.appendText("recycler view does not contains " + expectedItemCount + " items");
//   }
// 
//   public static Matcher<View> recyclerViewHasItemCount(int itemCount) {
//     return new RecyclerViewItemsCountMatcher(itemCount);
//   }
// }


// Path: app/src/androidTest/java/de/czyrux/store/screen/CatalogScreen.java
import android.support.test.espresso.matcher.ViewMatchers;
import java.util.List;
import de.czyrux.store.R;
import de.czyrux.store.core.domain.product.Product;
import de.czyrux.store.toolbox.matchers.recyclerview.RecyclerViewInteraction;
import de.czyrux.store.toolbox.matchers.recyclerview.RecyclerViewItemsCountMatcher;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant;
import static android.support.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;

package de.czyrux.store.screen;





public class CatalogScreen {

    public static void showsEmptyCatalog() {
        onView(withId(R.id.catalog_emptyView)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)));
    }

    public static void matchesProductCount(int size) {
        onView(withId(R.id.catalog_recyclerview))
                .check(matches(RecyclerViewItemsCountMatcher.recyclerViewHasItemCount(size)));