// Path: sample/src/androidTest/java/com/hibrianlee/sample/mvvm/BaseTest.java
// public class BaseTest {
// 
//     @Inject
//     protected MockViewModelFactory viewModelFactory;
// 
//     @CallSuper
//     @Before
//     public void setUp() throws Exception {
//         Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
//         MvvmSampleApplication application = (MvvmSampleApplication) instrumentation
//                 .getTargetContext().getApplicationContext();
//         TestComponent testComponent = DaggerTestComponent.builder()
//                 .appContextModule(new AppContextModule(application))
//                 .build();
//         application.setAppComponent(testComponent);
//         testComponent.inject(this);
//         viewModelFactory.clear();
//     }
// 
//     public static Matcher<View> withRecyclerViewPosition(final int position) {
//         return new TypeSafeMatcher<View>() {
// 
//             @Override
//             public void describeTo(Description description) {
//                 description.appendText("with RecyclerView position: " + position);
//             }
// 
//             @Override
//             protected boolean matchesSafely(View view) {
//                 if (!(view.getParent() instanceof RecyclerView)) {
//                     return false;
//                 }
// 
//                 RecyclerView recyclerView = (RecyclerView) view.getParent();
//                 RecyclerView.Adapter adapter = recyclerView.getAdapter();
//                 if (!(adapter instanceof RecyclerViewAdapter)) {
//                     return false;
//                 }
//                 return position == recyclerView.getChildAdapterPosition(view);
//             }
//         };
//     }
// }
// 
// Path: sample/src/main/java/com/hibrianlee/sample/mvvm/activity/MainActivity.java
// public class MainActivity extends BaseActivity {
// 
//     private MainViewModel mainViewModel;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_main);
//         ButterKnife.bind(this);
//     }
// 
//     @Nullable
//     @Override
//     protected ViewModel createViewModel(@Nullable ViewModel.State savedViewModelState) {
//         mainViewModel = viewModelFactory.createMainViewModel(getActivityComponent(),
//                 savedViewModelState);
//         return mainViewModel;
//     }
// 
//     @OnClick(R.id.buttonClicks)
//     void onClickButtonClicks() {
//         mainViewModel.onClickButtonClicks();
//     }
// 
//     @OnClick(R.id.buttonRecyclerView)
//     void onClickButtonRecyclerView() {
//         mainViewModel.onClickButtonRecyclerView();
//     }
// 
//     @OnClick(R.id.hiBrianLee)
//     void onClickHiBrianLee() {
//         mainViewModel.onClickHiBrianLee();
//     }
// }


import android.support.test.rule.ActivityTestRule;
import com.hibrianlee.sample.mvvm.BaseTest;
import com.hibrianlee.sample.mvvm.R;
import com.hibrianlee.sample.mvvm.activity.MainActivity;
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.matcher.ViewMatchers.withId;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.verify;
/*
 * Copyright (C) 2015 Brian Lee (@hiBrianLee)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hibrianlee.sample.mvvm.viewmodel;





public class MainActivityTest extends BaseTest {

    @Rule
// Path: sample/src/androidTest/java/com/hibrianlee/sample/mvvm/BaseTest.java
// public class BaseTest {
// 
//     @Inject
//     protected MockViewModelFactory viewModelFactory;
// 
//     @CallSuper
//     @Before
//     public void setUp() throws Exception {
//         Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
//         MvvmSampleApplication application = (MvvmSampleApplication) instrumentation
//                 .getTargetContext().getApplicationContext();
//         TestComponent testComponent = DaggerTestComponent.builder()
//                 .appContextModule(new AppContextModule(application))
//                 .build();
//         application.setAppComponent(testComponent);
//         testComponent.inject(this);
//         viewModelFactory.clear();
//     }
// 
//     public static Matcher<View> withRecyclerViewPosition(final int position) {
//         return new TypeSafeMatcher<View>() {
// 
//             @Override
//             public void describeTo(Description description) {
//                 description.appendText("with RecyclerView position: " + position);
//             }
// 
//             @Override
//             protected boolean matchesSafely(View view) {
//                 if (!(view.getParent() instanceof RecyclerView)) {
//                     return false;
//                 }
// 
//                 RecyclerView recyclerView = (RecyclerView) view.getParent();
//                 RecyclerView.Adapter adapter = recyclerView.getAdapter();
//                 if (!(adapter instanceof RecyclerViewAdapter)) {
//                     return false;
//                 }
//                 return position == recyclerView.getChildAdapterPosition(view);
//             }
//         };
//     }
// }
// 
// Path: sample/src/main/java/com/hibrianlee/sample/mvvm/activity/MainActivity.java
// public class MainActivity extends BaseActivity {
// 
//     private MainViewModel mainViewModel;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_main);
//         ButterKnife.bind(this);
//     }
// 
//     @Nullable
//     @Override
//     protected ViewModel createViewModel(@Nullable ViewModel.State savedViewModelState) {
//         mainViewModel = viewModelFactory.createMainViewModel(getActivityComponent(),
//                 savedViewModelState);
//         return mainViewModel;
//     }
// 
//     @OnClick(R.id.buttonClicks)
//     void onClickButtonClicks() {
//         mainViewModel.onClickButtonClicks();
//     }
// 
//     @OnClick(R.id.buttonRecyclerView)
//     void onClickButtonRecyclerView() {
//         mainViewModel.onClickButtonRecyclerView();
//     }
// 
//     @OnClick(R.id.hiBrianLee)
//     void onClickHiBrianLee() {
//         mainViewModel.onClickHiBrianLee();
//     }
// }


// Path: sample/src/androidTest/java/com/hibrianlee/sample/mvvm/viewmodel/MainActivityTest.java
import android.support.test.rule.ActivityTestRule;
import com.hibrianlee.sample.mvvm.BaseTest;
import com.hibrianlee.sample.mvvm.R;
import com.hibrianlee.sample.mvvm.activity.MainActivity;
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.matcher.ViewMatchers.withId;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.verify;

/*
 * Copyright (C) 2015 Brian Lee (@hiBrianLee)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hibrianlee.sample.mvvm.viewmodel;





public class MainActivityTest extends BaseTest {

    @Rule
    public ActivityTestRule<MainActivity> activityTestRule = new ActivityTestRule<>(