// Path: app/src/test/java/io/petros/posts/PreconfiguredRobolectricTestRunner.java
// public class PreconfiguredRobolectricTestRunner extends RobolectricTestRunner {
// 
//     private static final int SDK_API_LEVEL_TO_EMULATE = 25;
// 
//     /**
//      * Creates a runner to run {@code testClass}. Looks in your working directory for your AndroidManifest.xml file and res directory by
//      * default. Use the {@link Config} annotation to configure.
//      *
//      * @param testClass The test class to be run.
//      * @throws InitializationError If junit says so.
//      */
//     public PreconfiguredRobolectricTestRunner(final Class<?> testClass) throws InitializationError {
//         super(testClass);
//     }
// 
//     @Override
//     protected Config buildGlobalConfig() {
//         return new Config.Builder()
//                 .setSdk(SDK_API_LEVEL_TO_EMULATE)
//                 .setManifest(Config.NONE)
//                 .setApplication(TestPostsApplication.class)
//                 .build();
//     }
// 
// }
// 
// Path: app/src/test/java/io/petros/posts/RobolectricGeneralTestHelper.java
// public class RobolectricGeneralTestHelper extends GeneralTestHelper {
// 
//     // Application specific fields.
//     protected final Context context = getTestContext();
//     protected final PostsApplication application = getTestApplication();
// 
//     // System specific fields.
//     @Mock protected ConnectivityManager connectivityManagerMock;
// 
//     // Activity specific fields.
//     @Mock protected PostsApplication applicationMock;
//     @Mock protected SnackbarActions snackbarActionsMock;
// 
//     // ROBOLECTRIC // *******************************************************************************************************
// 
//     private Context getTestContext() {
//         return getShadowApplication().getApplicationContext();
//     }
// 
//     private ShadowApplication getShadowApplication() {
//         return ShadowApplication.getInstance();
//     }
// 
//     private PostsApplication getTestApplication() {
//         return (PostsApplication) RuntimeEnvironment.application;
//     }
// 
//     // MOCKS // *************************************************************************************************************
// 
//     protected void setUpMocks() {
//         super.setUpMocks();
//         setUpApplicationMocks();
//     }
// 
//     private void setUpApplicationMocks() {
//         when(applicationMock.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(connectivityManagerMock);
//         when(applicationMock.snackbar()).thenReturn(snackbarActionsMock);
//     }
// 
//     // POST // **************************************************************************************************************
// 
//     protected Bundle getExtras(final Post post) {
//         final Bundle extras = new Bundle();
//         extras.putInt(Post.USER_ID, post.getUserId());
//         extras.putInt(Post.ID, post.getId());
//         extras.putString(Post.TITLE, post.getTitle());
//         extras.putString(Post.BODY, post.getBody());
//         return extras;
//     }
// 
// }
// 
// Path: app/src/test/java/io/petros/posts/util/WhiteboxTestUtilities.java
// public static final String SDK_INT = "SDK_INT";


import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.robolectric.util.ReflectionHelpers;
import io.petros.posts.PreconfiguredRobolectricTestRunner;
import io.petros.posts.RobolectricGeneralTestHelper;
import static io.petros.posts.util.WhiteboxTestUtilities.SDK_INT;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
package io.petros.posts.util;





@RunWith(PreconfiguredRobolectricTestRunner.class)
public class VersionUtilitiesTest extends RobolectricGeneralTestHelper {

    @Mock private Activity activityMock;
    @Mock private Intent intentMock;
    @Mock private Bundle optionsMock;

    @Before
    public void setUp() {
        setUpMocks();
    }

    @Test
    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
    public void startActivityTestForJellyBeanAndAfter() {
        VersionUtilities.startActivity(activityMock, intentMock, optionsMock);

        verify(activityMock, times(1)).startActivity(intentMock, optionsMock);
        verifyNoMoreInteractions(activityMock);
    }

    @Test
    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
    public void startActivityTestForPriorJellyBean() {
// Path: app/src/test/java/io/petros/posts/PreconfiguredRobolectricTestRunner.java
// public class PreconfiguredRobolectricTestRunner extends RobolectricTestRunner {
// 
//     private static final int SDK_API_LEVEL_TO_EMULATE = 25;
// 
//     /**
//      * Creates a runner to run {@code testClass}. Looks in your working directory for your AndroidManifest.xml file and res directory by
//      * default. Use the {@link Config} annotation to configure.
//      *
//      * @param testClass The test class to be run.
//      * @throws InitializationError If junit says so.
//      */
//     public PreconfiguredRobolectricTestRunner(final Class<?> testClass) throws InitializationError {
//         super(testClass);
//     }
// 
//     @Override
//     protected Config buildGlobalConfig() {
//         return new Config.Builder()
//                 .setSdk(SDK_API_LEVEL_TO_EMULATE)
//                 .setManifest(Config.NONE)
//                 .setApplication(TestPostsApplication.class)
//                 .build();
//     }
// 
// }
// 
// Path: app/src/test/java/io/petros/posts/RobolectricGeneralTestHelper.java
// public class RobolectricGeneralTestHelper extends GeneralTestHelper {
// 
//     // Application specific fields.
//     protected final Context context = getTestContext();
//     protected final PostsApplication application = getTestApplication();
// 
//     // System specific fields.
//     @Mock protected ConnectivityManager connectivityManagerMock;
// 
//     // Activity specific fields.
//     @Mock protected PostsApplication applicationMock;
//     @Mock protected SnackbarActions snackbarActionsMock;
// 
//     // ROBOLECTRIC // *******************************************************************************************************
// 
//     private Context getTestContext() {
//         return getShadowApplication().getApplicationContext();
//     }
// 
//     private ShadowApplication getShadowApplication() {
//         return ShadowApplication.getInstance();
//     }
// 
//     private PostsApplication getTestApplication() {
//         return (PostsApplication) RuntimeEnvironment.application;
//     }
// 
//     // MOCKS // *************************************************************************************************************
// 
//     protected void setUpMocks() {
//         super.setUpMocks();
//         setUpApplicationMocks();
//     }
// 
//     private void setUpApplicationMocks() {
//         when(applicationMock.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(connectivityManagerMock);
//         when(applicationMock.snackbar()).thenReturn(snackbarActionsMock);
//     }
// 
//     // POST // **************************************************************************************************************
// 
//     protected Bundle getExtras(final Post post) {
//         final Bundle extras = new Bundle();
//         extras.putInt(Post.USER_ID, post.getUserId());
//         extras.putInt(Post.ID, post.getId());
//         extras.putString(Post.TITLE, post.getTitle());
//         extras.putString(Post.BODY, post.getBody());
//         return extras;
//     }
// 
// }
// 
// Path: app/src/test/java/io/petros/posts/util/WhiteboxTestUtilities.java
// public static final String SDK_INT = "SDK_INT";


// Path: app/src/test/java/io/petros/posts/util/VersionUtilitiesTest.java
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.robolectric.util.ReflectionHelpers;
import io.petros.posts.PreconfiguredRobolectricTestRunner;
import io.petros.posts.RobolectricGeneralTestHelper;
import static io.petros.posts.util.WhiteboxTestUtilities.SDK_INT;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;

package io.petros.posts.util;





@RunWith(PreconfiguredRobolectricTestRunner.class)
public class VersionUtilitiesTest extends RobolectricGeneralTestHelper {

    @Mock private Activity activityMock;
    @Mock private Intent intentMock;
    @Mock private Bundle optionsMock;

    @Before
    public void setUp() {
        setUpMocks();
    }

    @Test
    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
    public void startActivityTestForJellyBeanAndAfter() {
        VersionUtilities.startActivity(activityMock, intentMock, optionsMock);

        verify(activityMock, times(1)).startActivity(intentMock, optionsMock);
        verifyNoMoreInteractions(activityMock);
    }

    @Test
    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
    public void startActivityTestForPriorJellyBean() {
        ReflectionHelpers.setStaticField(Build.VERSION.class, SDK_INT, Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1);