// 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/main/java/io/petros/posts/activity/post/model/PostModel.java
// public interface PostModel {
// 
//     @Nullable
//     User getUser(final Integer userId);
// 
// }
// 
// Path: app/src/main/java/io/petros/posts/activity/post/view/PostView.java
// public interface PostView {
// 
//     void loadPostUserAndPost();
// 
//     void loadPostUser(final String userEmail, final String userName, final String userUsername);
// 
//     void notifyUserAboutUserUnavailability();
// 
//     void notifyUserAboutInternetUnavailability();
// 
//     void loadPost(final String postTitle, final String postBody, final String numberOfComments);
// 
//     void notifyUserAboutPostUnavailability();
// 
//     void showError();
// 
// }
// 
// Path: app/src/main/java/io/petros/posts/service/detector/InternetAvailabilityDetector.java
// public class InternetAvailabilityDetector implements AvailabilityDetector {
// 
//     private final ConnectivityManager connectivityManager;
// 
//     public InternetAvailabilityDetector(final PostsApplication application) {
//         this.connectivityManager = (ConnectivityManager) application.getSystemService(Context.CONNECTIVITY_SERVICE);
//     }
// 
//     @Override
//     public boolean isAvailable() {
//         @Nullable final NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
//         if (activeNetworkInfo != null) {
//             if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
//                 Timber.v("Internet connection is available; Connected to WiFi.");
//                 return true;
//             } else if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
//                 Timber.v("Internet connection is available; Connected to the mobile provider's data plan.");
//                 return true;
//             } else {
//                 Timber.v("Internet connection is available. [Network Type: %d]", activeNetworkInfo.getType());
//                 return true;
//             }
//         } else {
//             Timber.d("Internet connection is not available at the moment.");
//             return false;
//         }
//     }
// 
// }
// 
// Path: app/src/main/java/io/petros/posts/service/retrofit/RetrofitService.java
// public interface RetrofitService {
// 
//     @GET("/posts")
//     Observable<List<Post>> posts();
// 
//     @GET("/users")
//     Observable<List<User>> users();
// 
//     @GET("/comments")
//     Observable<List<Comment>> comments(@Query("postId") int postId);
// 
// }


import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import io.petros.posts.PreconfiguredRobolectricTestRunner;
import io.petros.posts.RobolectricGeneralTestHelper;
import io.petros.posts.activity.post.model.PostModel;
import io.petros.posts.activity.post.view.PostView;
import io.petros.posts.service.detector.InternetAvailabilityDetector;
import io.petros.posts.service.retrofit.RetrofitService;
import io.reactivex.Observable;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
package io.petros.posts.activity.post.presenter;




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

    private PostPresenterImpl postPresenter;
    @Mock private PostModel postModelMock;
// 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/main/java/io/petros/posts/activity/post/model/PostModel.java
// public interface PostModel {
// 
//     @Nullable
//     User getUser(final Integer userId);
// 
// }
// 
// Path: app/src/main/java/io/petros/posts/activity/post/view/PostView.java
// public interface PostView {
// 
//     void loadPostUserAndPost();
// 
//     void loadPostUser(final String userEmail, final String userName, final String userUsername);
// 
//     void notifyUserAboutUserUnavailability();
// 
//     void notifyUserAboutInternetUnavailability();
// 
//     void loadPost(final String postTitle, final String postBody, final String numberOfComments);
// 
//     void notifyUserAboutPostUnavailability();
// 
//     void showError();
// 
// }
// 
// Path: app/src/main/java/io/petros/posts/service/detector/InternetAvailabilityDetector.java
// public class InternetAvailabilityDetector implements AvailabilityDetector {
// 
//     private final ConnectivityManager connectivityManager;
// 
//     public InternetAvailabilityDetector(final PostsApplication application) {
//         this.connectivityManager = (ConnectivityManager) application.getSystemService(Context.CONNECTIVITY_SERVICE);
//     }
// 
//     @Override
//     public boolean isAvailable() {
//         @Nullable final NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
//         if (activeNetworkInfo != null) {
//             if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
//                 Timber.v("Internet connection is available; Connected to WiFi.");
//                 return true;
//             } else if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
//                 Timber.v("Internet connection is available; Connected to the mobile provider's data plan.");
//                 return true;
//             } else {
//                 Timber.v("Internet connection is available. [Network Type: %d]", activeNetworkInfo.getType());
//                 return true;
//             }
//         } else {
//             Timber.d("Internet connection is not available at the moment.");
//             return false;
//         }
//     }
// 
// }
// 
// Path: app/src/main/java/io/petros/posts/service/retrofit/RetrofitService.java
// public interface RetrofitService {
// 
//     @GET("/posts")
//     Observable<List<Post>> posts();
// 
//     @GET("/users")
//     Observable<List<User>> users();
// 
//     @GET("/comments")
//     Observable<List<Comment>> comments(@Query("postId") int postId);
// 
// }


// Path: app/src/test/java/io/petros/posts/activity/post/presenter/PostPresenterImplTest.java
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import io.petros.posts.PreconfiguredRobolectricTestRunner;
import io.petros.posts.RobolectricGeneralTestHelper;
import io.petros.posts.activity.post.model.PostModel;
import io.petros.posts.activity.post.view.PostView;
import io.petros.posts.service.detector.InternetAvailabilityDetector;
import io.petros.posts.service.retrofit.RetrofitService;
import io.reactivex.Observable;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

package io.petros.posts.activity.post.presenter;




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

    private PostPresenterImpl postPresenter;
    @Mock private PostModel postModelMock;
    @Mock private RetrofitService retrofitServiceMock;