// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/MockSnackbarLogic.java
// public class MockSnackbarLogic extends SnackbarLogic {
//     @NonNull
//     @Override
//     public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
//         return new MockSnackbarWrapper();
//     }
// 
//     @NonNull
//     @Override
//     public ISnackbarWrapper make(@NonNull View view, int resId, int duration) {
//         return new MockSnackbarWrapper();
//     }
// 
//     public static class MockSnackbarWrapper implements ISnackbarWrapper {
//         @Override
//         public void show() {
//             // no-op
//         }
//     }
// }
// 
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
//     return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }


import android.support.test.rule.ActivityTestRule;
import android.view.View;
import net.cattaka.android.adaptertoolbox.example.test.MockSnackbarLogic;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.contrib.RecyclerViewActions.scrollToPosition;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
package net.cattaka.android.adaptertoolbox.example;





/**
 * Created by cattaka on 16/06/08.
 */
public class FizzBuzzExampleActivityTest {
    @Rule
    public ActivityTestRule<FizzBuzzExampleActivity> mActivityTestRule = new ActivityTestRule<>(FizzBuzzExampleActivity.class, false, false);

    @Test
    public void click_FizzBuzz() {
        FizzBuzzExampleActivity activity = mActivityTestRule.launchActivity(null);

        activity.mSnackbarLogic = spy(new MockSnackbarLogic());

        {   // Click Integer
            int target = 2;
            int position = target - 1;
            onView(withId(R.id.recycler)).perform(scrollToPosition(position));
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/MockSnackbarLogic.java
// public class MockSnackbarLogic extends SnackbarLogic {
//     @NonNull
//     @Override
//     public ISnackbarWrapper make(@NonNull View view, @NonNull CharSequence text, int duration) {
//         return new MockSnackbarWrapper();
//     }
// 
//     @NonNull
//     @Override
//     public ISnackbarWrapper make(@NonNull View view, int resId, int duration) {
//         return new MockSnackbarWrapper();
//     }
// 
//     public static class MockSnackbarWrapper implements ISnackbarWrapper {
//         @Override
//         public void show() {
//             // no-op
//         }
//     }
// }
// 
// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/test/TestUtils.java
// public static Matcher<View> withIdInRecyclerView(int id, int recyclerViewId, int position) {
//     return allOf(withId(id), isDescendantOfRecyclerView(recyclerViewId, position));
// }


// Path: example/src/androidTest/java/net/cattaka/android/adaptertoolbox/example/FizzBuzzExampleActivityTest.java
import android.support.test.rule.ActivityTestRule;
import android.view.View;
import net.cattaka.android.adaptertoolbox.example.test.MockSnackbarLogic;
import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.contrib.RecyclerViewActions.scrollToPosition;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static net.cattaka.android.adaptertoolbox.example.test.TestUtils.withIdInRecyclerView;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;

package net.cattaka.android.adaptertoolbox.example;





/**
 * Created by cattaka on 16/06/08.
 */
public class FizzBuzzExampleActivityTest {
    @Rule
    public ActivityTestRule<FizzBuzzExampleActivity> mActivityTestRule = new ActivityTestRule<>(FizzBuzzExampleActivity.class, false, false);

    @Test
    public void click_FizzBuzz() {
        FizzBuzzExampleActivity activity = mActivityTestRule.launchActivity(null);

        activity.mSnackbarLogic = spy(new MockSnackbarLogic());

        {   // Click Integer
            int target = 2;
            int position = target - 1;
            onView(withId(R.id.recycler)).perform(scrollToPosition(position));
            onView(withIdInRecyclerView(R.id.text, R.id.recycler, position)).perform(click());