// Path: androidunittest/src/main/java/com/github/florent37/androidunittest/AndroidUnitTest.java
// public class AndroidUnitTest implements MethodRule {
// 
//     ControllerActivity controllerActivity;
//     ControllerFragment controllerFragment;
//     @Nullable ActivityController activityController;
//     private AndroidUnitTestAnnotations androidUnitTestAnnotations;
// 
//     protected AndroidUnitTest() {
//         androidUnitTestAnnotations = new AndroidUnitTestAnnotations(AndroidUnitTest.this);
//         controllerActivity = new ControllerActivity(this);
//         controllerFragment = new ControllerFragment(this);
//     }
// 
//     public static AndroidUnitTest rule() {
//         return new AndroidUnitTest();
//     }
// 
//     @Override
//     public Statement apply(final Statement base, FrameworkMethod method, final Object target) {
//         return new Statement() {
//             @Override
//             public void evaluate() throws Throwable {
//                 MockitoAnnotations.initMocks(target);
//                 androidUnitTestAnnotations.init(target);
//                 base.evaluate();
//                 Mockito.validateMockitoUsage();
//             }
//         };
//     }
// 
//     @Nullable
//     public ActivityController getActivityController() {
//         return activityController;
//     }
// 
//     public void setActivityController(@Nullable ActivityController activityController) {
//         this.activityController = activityController;
//     }
// 
//     public AndroidUnitTestAnnotations getAndroidUnitTestAnnotations() {
//         return androidUnitTestAnnotations;
//     }
// 
//     public ControllerActivity activity() {
//         return controllerActivity;
//     }
// 
//     public ControllerFragment fragment() {
//         return controllerFragment;
//     }
// 
// }
// 
// Path: androidunittest/src/main/java/com/github/florent37/androidunittest/states/ActivityState.java
// public enum ActivityState {
//     //reverse ordered to prevent illegal forward reference
//     DESTROYED(null),
//     STOPPED(ActivityState.DESTROYED),
//     PAUSED(ActivityState.STOPPED),
//     RESUMED(ActivityState.PAUSED),
//     STARTED(ActivityState.RESUMED),
//     CREATED(ActivityState.STARTED);
// 
// 
//     private ActivityState mNext;
// 
//     ActivityState(ActivityState next) {
//         mNext = next;
//     }
// 
//     public ActivityState next() {
//         return mNext;
//     }
// 
//     /**
//      * Check wether the given ActivityState is before or at least the same element as this instance
//      *
//      * commonly used to check if the previous state can be call
//      * for instance, checking if Resume can be used before Paused, it will returns true
//      * whereas, testing destroy against resume will return false
//      * @param state
//      * @return
//      */
//     public boolean isLowerOrEquals(@NonNull ActivityState state) {
//         return ordinal() >= state.ordinal(); //since we are in the reverse order
//         //it is not <= but =>
//     }
// }


import android.app.Activity;
import android.support.annotation.Nullable;
import com.github.florent37.androidunittest.AndroidUnitTest;
import com.github.florent37.androidunittest.annotations.RActivity;
import com.github.florent37.androidunittest.states.ActivityState;
import org.mockito.Mockito;
import org.robolectric.Robolectric;
import org.robolectric.util.ActivityController;
            androidUnitTest.getActivityController().start();
            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();
        }
        return this;
    }

    public ControllerActivity pause() {
        if (androidUnitTest.getActivityController() != null) {
            androidUnitTest.getActivityController().pause();
            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();
        }
        return this;
    }

    public ControllerActivity stop() {
        if (androidUnitTest.getActivityController() != null) {
            androidUnitTest.getActivityController().stop();
            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();
        }
        return this;
    }

    public ControllerActivity destroy() {
        if (androidUnitTest.getActivityController() != null) {
            androidUnitTest.getActivityController().destroy();
            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();
        }
        return this;
    }

// Path: androidunittest/src/main/java/com/github/florent37/androidunittest/AndroidUnitTest.java
// public class AndroidUnitTest implements MethodRule {
// 
//     ControllerActivity controllerActivity;
//     ControllerFragment controllerFragment;
//     @Nullable ActivityController activityController;
//     private AndroidUnitTestAnnotations androidUnitTestAnnotations;
// 
//     protected AndroidUnitTest() {
//         androidUnitTestAnnotations = new AndroidUnitTestAnnotations(AndroidUnitTest.this);
//         controllerActivity = new ControllerActivity(this);
//         controllerFragment = new ControllerFragment(this);
//     }
// 
//     public static AndroidUnitTest rule() {
//         return new AndroidUnitTest();
//     }
// 
//     @Override
//     public Statement apply(final Statement base, FrameworkMethod method, final Object target) {
//         return new Statement() {
//             @Override
//             public void evaluate() throws Throwable {
//                 MockitoAnnotations.initMocks(target);
//                 androidUnitTestAnnotations.init(target);
//                 base.evaluate();
//                 Mockito.validateMockitoUsage();
//             }
//         };
//     }
// 
//     @Nullable
//     public ActivityController getActivityController() {
//         return activityController;
//     }
// 
//     public void setActivityController(@Nullable ActivityController activityController) {
//         this.activityController = activityController;
//     }
// 
//     public AndroidUnitTestAnnotations getAndroidUnitTestAnnotations() {
//         return androidUnitTestAnnotations;
//     }
// 
//     public ControllerActivity activity() {
//         return controllerActivity;
//     }
// 
//     public ControllerFragment fragment() {
//         return controllerFragment;
//     }
// 
// }
// 
// Path: androidunittest/src/main/java/com/github/florent37/androidunittest/states/ActivityState.java
// public enum ActivityState {
//     //reverse ordered to prevent illegal forward reference
//     DESTROYED(null),
//     STOPPED(ActivityState.DESTROYED),
//     PAUSED(ActivityState.STOPPED),
//     RESUMED(ActivityState.PAUSED),
//     STARTED(ActivityState.RESUMED),
//     CREATED(ActivityState.STARTED);
// 
// 
//     private ActivityState mNext;
// 
//     ActivityState(ActivityState next) {
//         mNext = next;
//     }
// 
//     public ActivityState next() {
//         return mNext;
//     }
// 
//     /**
//      * Check wether the given ActivityState is before or at least the same element as this instance
//      *
//      * commonly used to check if the previous state can be call
//      * for instance, checking if Resume can be used before Paused, it will returns true
//      * whereas, testing destroy against resume will return false
//      * @param state
//      * @return
//      */
//     public boolean isLowerOrEquals(@NonNull ActivityState state) {
//         return ordinal() >= state.ordinal(); //since we are in the reverse order
//         //it is not <= but =>
//     }
// }


// Path: androidunittest/src/main/java/com/github/florent37/androidunittest/controllers/ControllerActivity.java
import android.app.Activity;
import android.support.annotation.Nullable;
import com.github.florent37.androidunittest.AndroidUnitTest;
import com.github.florent37.androidunittest.annotations.RActivity;
import com.github.florent37.androidunittest.states.ActivityState;
import org.mockito.Mockito;
import org.robolectric.Robolectric;
import org.robolectric.util.ActivityController;

            androidUnitTest.getActivityController().start();
            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();
        }
        return this;
    }

    public ControllerActivity pause() {
        if (androidUnitTest.getActivityController() != null) {
            androidUnitTest.getActivityController().pause();
            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();
        }
        return this;
    }

    public ControllerActivity stop() {
        if (androidUnitTest.getActivityController() != null) {
            androidUnitTest.getActivityController().stop();
            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();
        }
        return this;
    }

    public ControllerActivity destroy() {
        if (androidUnitTest.getActivityController() != null) {
            androidUnitTest.getActivityController().destroy();
            androidUnitTest.getAndroidUnitTestAnnotations().updateActivity();
        }
        return this;
    }

    public ControllerActivity setActivityState(ActivityState activityState) {