/*
 * MIT License
 *
 * Copyright (c) 2017 Stan Mots (Storix)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.stolets.rxdiffutil;

import android.app.Activity;
import android.support.annotation.NonNull;

import org.junit.After;
import org.junit.Before;
import org.robolectric.Robolectric;
import org.robolectric.util.ActivityController;

public abstract class BaseRoboTest {
    private Activity mActivity;
    private ActivityController<Activity> mActivityController;

    @Before
    public void setupBase() {
        setActivityController(Robolectric.buildActivity(Activity.class));
        setActivity(getActivityController().create().get());
    }

    @After
    public void tearDownBase() {
        mActivityController.pause()
                .stop()
                .destroy();
    }

    @NonNull
    @SuppressWarnings("WeakerAccess")
    public Activity getActivity() {
        return mActivity;
    }

    @SuppressWarnings("WeakerAccess")
    public void setActivity(@NonNull final Activity activity) {
        mActivity = activity;
    }

    @NonNull
    @SuppressWarnings("WeakerAccess")
    public ActivityController<Activity> getActivityController() {
        return mActivityController;
    }

    @SuppressWarnings("WeakerAccess")
    public void setActivityController(@NonNull final ActivityController<Activity> activityController) {
        mActivityController = activityController;
    }
}

@@ -1187,20 +1187,17 @@
 oid.
-app.Activity
+os.Bundle
 ;%0Aim
@@ -1236,16 +1236,109 @@
 NonNull;
+%0Aimport android.support.annotation.Nullable;%0Aimport android.support.v7.app.AppCompatActivity;
 %0A%0Aimport
@@ -1506,32 +1506,41 @@
 t %7B%0A    private 
+AppCompat
 Activity mActivi
@@ -1566,32 +1566,43 @@
 ivityController%3C
+ThemeCompat
 Activity%3E mActiv
@@ -1715,16 +1715,27 @@
 ctivity(
+ThemeCompat
 Activity
@@ -1797,16 +1797,43 @@
 reate().
+start().resume().visible().
 get());%0A
@@ -2032,32 +2032,41 @@
 ss%22)%0A    public 
+AppCompat
 Activity getActi
@@ -2180,32 +2180,41 @@
 (@NonNull final 
+AppCompat
 Activity activit
@@ -2328,32 +2328,43 @@
 ivityController%3C
+ThemeCompat
 Activity%3E getAct
@@ -2536,16 +2536,27 @@
 troller%3C
+ThemeCompat
 Activity
@@ -2634,11 +2634,290 @@
 r;%0A    %7D
+%0A%0A    static class ThemeCompatActivity extends AppCompatActivity %7B%0A        @Override%0A        protected void onCreate(@Nullable Bundle savedInstanceState) %7B%0A            setTheme(R.style.Robolectric_Test_CompatTheme);%0A            super.onCreate(savedInstanceState);%0A        %7D%0A    %7D
 %0A%7D%0A

Fix java.lang.IllegalStateException: You need to use a Theme.AppCompat theme