// Path: app/src/main/java/io/github/marktony/espresso/ui/PrefsActivity.java
// public class PrefsActivity extends AppCompatActivity {
// 
//     public static final String EXTRA_FLAG= "EXTRA_FLAG";
// 
//     public static final int FLAG_SETTINGS = 0, FLAG_ABOUT = 1, FLAG_LICENSES = 2;
// 
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_prefs);
// 
//         // Set the navigation bar color
//         if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("navigation_bar_tint", true)) {
//             getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
//         }
// 
//         initViews();
// 
//         Intent intent = getIntent();
//         Fragment fragment;
// 
//         if (intent.getIntExtra(EXTRA_FLAG, 0) == FLAG_SETTINGS) {
//             setTitle(R.string.nav_settings);
//             fragment = new SettingsFragment();
//         } else if (intent.getIntExtra(EXTRA_FLAG, 0) == FLAG_ABOUT){
//             setTitle(R.string.nav_about);
//             fragment = new AboutFragment();
//         } else if (intent.getIntExtra(EXTRA_FLAG, 0) == FLAG_LICENSES) {
//             setTitle(R.string.licenses);
//             fragment = new LicensesFragment();
//         } else {
//             throw new RuntimeException("Please set flag when launching PrefsActivity.");
//         }
// 
//         getSupportFragmentManager()
//                 .beginTransaction()
//                 .replace(R.id.view_pager,fragment)
//                 .commit();
// 
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         if (item.getItemId() == android.R.id.home) {
//             onBackPressed();
//         }
//         return true;
//     }
// 
//     private void initViews() {
//         setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
//         getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//     }
// 
// }


import android.content.Context;
import android.content.Intent;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.github.marktony.espresso.R;
import io.github.marktony.espresso.ui.PrefsActivity;
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.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.core.AllOf.allOf;
package io.github.marktony.espresso.settings;





/**
 * Created by lizhaotailang on 2017/5/14.
 * The tests for {@link io.github.marktony.espresso.ui.SettingsFragment}.
 */

@RunWith(AndroidJUnit4.class)
@SmallTest
public class SettingsScreenTest {

    /**
     * {@link ActivityTestRule} is a JUnit {@link Rule @Rule} to launch your activity under test.
     *
     * <p>
     * Rules are interceptors which are executed for each test method and are important building
     * blocks of Junit tests.
     */
    @Rule
// Path: app/src/main/java/io/github/marktony/espresso/ui/PrefsActivity.java
// public class PrefsActivity extends AppCompatActivity {
// 
//     public static final String EXTRA_FLAG= "EXTRA_FLAG";
// 
//     public static final int FLAG_SETTINGS = 0, FLAG_ABOUT = 1, FLAG_LICENSES = 2;
// 
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_prefs);
// 
//         // Set the navigation bar color
//         if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("navigation_bar_tint", true)) {
//             getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
//         }
// 
//         initViews();
// 
//         Intent intent = getIntent();
//         Fragment fragment;
// 
//         if (intent.getIntExtra(EXTRA_FLAG, 0) == FLAG_SETTINGS) {
//             setTitle(R.string.nav_settings);
//             fragment = new SettingsFragment();
//         } else if (intent.getIntExtra(EXTRA_FLAG, 0) == FLAG_ABOUT){
//             setTitle(R.string.nav_about);
//             fragment = new AboutFragment();
//         } else if (intent.getIntExtra(EXTRA_FLAG, 0) == FLAG_LICENSES) {
//             setTitle(R.string.licenses);
//             fragment = new LicensesFragment();
//         } else {
//             throw new RuntimeException("Please set flag when launching PrefsActivity.");
//         }
// 
//         getSupportFragmentManager()
//                 .beginTransaction()
//                 .replace(R.id.view_pager,fragment)
//                 .commit();
// 
//     }
// 
//     @Override
//     public boolean onOptionsItemSelected(MenuItem item) {
//         if (item.getItemId() == android.R.id.home) {
//             onBackPressed();
//         }
//         return true;
//     }
// 
//     private void initViews() {
//         setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
//         getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//     }
// 
// }


// Path: app/src/androidTest/java/io/github/marktony/espresso/settings/SettingsScreenTest.java
import android.content.Context;
import android.content.Intent;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.github.marktony.espresso.R;
import io.github.marktony.espresso.ui.PrefsActivity;
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.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.core.AllOf.allOf;

package io.github.marktony.espresso.settings;





/**
 * Created by lizhaotailang on 2017/5/14.
 * The tests for {@link io.github.marktony.espresso.ui.SettingsFragment}.
 */

@RunWith(AndroidJUnit4.class)
@SmallTest
public class SettingsScreenTest {

    /**
     * {@link ActivityTestRule} is a JUnit {@link Rule @Rule} to launch your activity under test.
     *
     * <p>
     * Rules are interceptors which are executed for each test method and are important building
     * blocks of Junit tests.
     */
    @Rule
    public ActivityTestRule<PrefsActivity> mPrefsActivityTestRule