// Path: app/src/main/java/io/github/marktony/espresso/mvp/addpackage/AddPackageActivity.java
// public class AddPackageActivity extends AppCompatActivity {
// 
//     private AddPackageFragment fragment;
// 
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.container);
// 
//         // Set the navigation bar color
//         if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("navigation_bar_tint", true)) {
//             getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
//         }
// 
//         if (savedInstanceState != null) {
//             fragment = (AddPackageFragment) getSupportFragmentManager().getFragment(savedInstanceState, "AddPackageFragment");
//         } else {
//             fragment = AddPackageFragment.newInstance();
//         }
// 
//         if (!fragment.isAdded()) {
//             getSupportFragmentManager().beginTransaction()
//                     .replace(R.id.view_pager, fragment, "AddPackageFragment")
//                     .commit();
//         }
// 
//         // Create the presenter.
//         new AddPackagePresenter(PackagesRepository.getInstance(
//                 PackagesRemoteDataSource.getInstance(),
//                 PackagesLocalDataSource.getInstance()),
//                 CompaniesRepository.getInstance(CompaniesLocalDataSource.getInstance()),
//                 fragment);
// 
//     }
// 
//     // Save the fragment state to bundle.
//     @Override
//     protected void onSaveInstanceState(Bundle outState) {
//         super.onSaveInstanceState(outState);
//         getSupportFragmentManager().putFragment(outState, "AddPackageFragment", fragment);
//     }
// 
// }


import android.os.Build;
import android.support.test.espresso.matcher.ViewMatchers;
import android.support.test.filters.LargeTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.github.marktony.espresso.R;
import io.github.marktony.espresso.mvp.addpackage.AddPackageActivity;
import static android.support.test.InstrumentationRegistry.getInstrumentation;
import static android.support.test.InstrumentationRegistry.getTargetContext;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed;
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.addpackage;





/**
 * Created by lizhaotailang on 2017/5/14.
 * Tests the components of {@link AddPackageActivity} layout.
 */

@RunWith(AndroidJUnit4.class)
@LargeTest
public class AddPackageScreenTest {

    private String validPackageNumber;
    private String invalidPackageNumber;

    /**
     * {@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/mvp/addpackage/AddPackageActivity.java
// public class AddPackageActivity extends AppCompatActivity {
// 
//     private AddPackageFragment fragment;
// 
//     @Override
//     protected void onCreate(@Nullable Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.container);
// 
//         // Set the navigation bar color
//         if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("navigation_bar_tint", true)) {
//             getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
//         }
// 
//         if (savedInstanceState != null) {
//             fragment = (AddPackageFragment) getSupportFragmentManager().getFragment(savedInstanceState, "AddPackageFragment");
//         } else {
//             fragment = AddPackageFragment.newInstance();
//         }
// 
//         if (!fragment.isAdded()) {
//             getSupportFragmentManager().beginTransaction()
//                     .replace(R.id.view_pager, fragment, "AddPackageFragment")
//                     .commit();
//         }
// 
//         // Create the presenter.
//         new AddPackagePresenter(PackagesRepository.getInstance(
//                 PackagesRemoteDataSource.getInstance(),
//                 PackagesLocalDataSource.getInstance()),
//                 CompaniesRepository.getInstance(CompaniesLocalDataSource.getInstance()),
//                 fragment);
// 
//     }
// 
//     // Save the fragment state to bundle.
//     @Override
//     protected void onSaveInstanceState(Bundle outState) {
//         super.onSaveInstanceState(outState);
//         getSupportFragmentManager().putFragment(outState, "AddPackageFragment", fragment);
//     }
// 
// }


// Path: app/src/androidTest/java/io/github/marktony/espresso/addpackage/AddPackageScreenTest.java
import android.os.Build;
import android.support.test.espresso.matcher.ViewMatchers;
import android.support.test.filters.LargeTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import io.github.marktony.espresso.R;
import io.github.marktony.espresso.mvp.addpackage.AddPackageActivity;
import static android.support.test.InstrumentationRegistry.getInstrumentation;
import static android.support.test.InstrumentationRegistry.getTargetContext;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed;
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.addpackage;





/**
 * Created by lizhaotailang on 2017/5/14.
 * Tests the components of {@link AddPackageActivity} layout.
 */

@RunWith(AndroidJUnit4.class)
@LargeTest
public class AddPackageScreenTest {

    private String validPackageNumber;
    private String invalidPackageNumber;

    /**
     * {@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<AddPackageActivity> mAddPackageActivityTestRule