// Path: sample/src/test/java/me/henrytao/mvvmlifecycledemo/RobolectricGradleTestRunner.java
// public class RobolectricGradleTestRunner extends org.robolectric.RobolectricGradleTestRunner {
// 
//   public static final int SDK = Build.VERSION_CODES.LOLLIPOP;
// 
//   public RobolectricGradleTestRunner(Class<?> klass) throws InitializationError {
//     super(klass);
//   }
// }


import static org.hamcrest.MatcherAssert.assertThat;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.annotation.Config;
import org.robolectric.util.ActivityController;
import android.os.Bundle;
import java.util.Arrays;
import me.henrytao.mvvmlifecycledemo.BuildConfig;
import me.henrytao.mvvmlifecycledemo.RobolectricGradleTestRunner;
        "TestViewModel.onCreate", "TestActivity.onCreate",
        "TestViewModel.onCreateView", "TestActivity.onCreateView",
        "TestViewModel.onStart", "TestActivity.onStart",
        "TestViewModel.onRestoreInstanceState", "TestActivity.onRestoreInstanceState",
        "TestViewModel.onResume", "TestActivity.onResume",
        "TestViewModel.onPause", "TestActivity.onPause",
        "TestViewModel.onSaveInstanceState", "TestActivity.onSaveInstanceState",
        "TestViewModel.onStop", "TestActivity.onStop",
        "TestViewModel.onDestroyView", "TestActivity.onDestroyView",
        "TestViewModel.onDestroy", "TestActivity.onDestroy")));
  }

  @Test
  public void testFragmentLifeCycle() throws Exception {
    ActivityController<TestActivity> activityController = Robolectric.buildActivity(TestActivity.class)
        .create()
        .start()
        .restoreInstanceState(new Bundle())
        .resume();

    TestFragment fragment = new TestFragment();

    activityController.get().getSupportFragmentManager()
        .beginTransaction()
        .add(fragment, null)
        .commit();

    activityController
        .pause()
        .saveInstanceState(new Bundle())
// Path: sample/src/test/java/me/henrytao/mvvmlifecycledemo/RobolectricGradleTestRunner.java
// public class RobolectricGradleTestRunner extends org.robolectric.RobolectricGradleTestRunner {
// 
//   public static final int SDK = Build.VERSION_CODES.LOLLIPOP;
// 
//   public RobolectricGradleTestRunner(Class<?> klass) throws InitializationError {
//     super(klass);
//   }
// }


// Path: sample/src/test/java/me/henrytao/mvvmlifecycledemo/test/MVVMTest.java
import static org.hamcrest.MatcherAssert.assertThat;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.annotation.Config;
import org.robolectric.util.ActivityController;
import android.os.Bundle;
import java.util.Arrays;
import me.henrytao.mvvmlifecycledemo.BuildConfig;
import me.henrytao.mvvmlifecycledemo.RobolectricGradleTestRunner;

        "TestViewModel.onCreate", "TestActivity.onCreate",
        "TestViewModel.onCreateView", "TestActivity.onCreateView",
        "TestViewModel.onStart", "TestActivity.onStart",
        "TestViewModel.onRestoreInstanceState", "TestActivity.onRestoreInstanceState",
        "TestViewModel.onResume", "TestActivity.onResume",
        "TestViewModel.onPause", "TestActivity.onPause",
        "TestViewModel.onSaveInstanceState", "TestActivity.onSaveInstanceState",
        "TestViewModel.onStop", "TestActivity.onStop",
        "TestViewModel.onDestroyView", "TestActivity.onDestroyView",
        "TestViewModel.onDestroy", "TestActivity.onDestroy")));
  }

  @Test
  public void testFragmentLifeCycle() throws Exception {
    ActivityController<TestActivity> activityController = Robolectric.buildActivity(TestActivity.class)
        .create()
        .start()
        .restoreInstanceState(new Bundle())
        .resume();

    TestFragment fragment = new TestFragment();

    activityController.get().getSupportFragmentManager()
        .beginTransaction()
        .add(fragment, null)
        .commit();

    activityController
        .pause()
        .saveInstanceState(new Bundle())
        .stop()