package io.github.plastix.forage.data.network;

public class NetworkInteractorTest {
}

@@ -45,43 +45,2296 @@
 k;%0A%0A
-public class NetworkInteractorTest %7B
+import android.net.ConnectivityManager;%0Aimport android.net.NetworkInfo;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport rx.Completable;%0A%0Aimport static com.google.common.truth.Truth.assertThat;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Apublic class NetworkInteractorTest %7B%0A%0A    private NetworkInteractor networkInteractor;%0A    private ConnectivityManager connectivityManager;%0A    private NetworkInfo networkInfo;%0A%0A    @Before%0A    public void beforeEachTest() %7B%0A        networkInfo = mock(NetworkInfo.class);%0A        connectivityManager = mock(ConnectivityManager.class);%0A        networkInteractor = new NetworkInteractor(connectivityManager);%0A    %7D%0A%0A    @Test%0A    public void hasInternetConnection_shouldReturnFalseWhenNoNetwork() %7B%0A        when(connectivityManager.getActiveNetworkInfo()).thenReturn(null);%0A%0A        assertThat(networkInteractor.hasInternetConnection()).isFalse();%0A    %7D%0A%0A    @Test%0A    public void hasInternetConnection_shouldReturnFalseWhenNotConnected() %7B%0A        when(networkInfo.isConnectedOrConnecting()).thenReturn(false);%0A        when(connectivityManager.getActiveNetworkInfo()).thenReturn(networkInfo);%0A%0A        assertThat(networkInteractor.hasInternetConnection()).isFalse();%0A    %7D%0A%0A    @Test%0A    public void hasInternetConnection_shouldReturnTrueWhenConnected() %7B%0A        when(networkInfo.isConnectedOrConnecting()).thenReturn(true);%0A        when(connectivityManager.getActiveNetworkInfo()).thenReturn(networkInfo);%0A%0A        assertThat(networkInteractor.hasInternetConnection()).isTrue();%0A    %7D%0A%0A    @Test%0A    public void hasInternetConnectionCompletable_shouldCompleteWhenConnected() %7B%0A        when(networkInfo.isConnectedOrConnecting()).thenReturn(true);%0A        when(connectivityManager.getActiveNetworkInfo()).thenReturn(networkInfo);%0A%0A        assertThat(networkInteractor.hasInternetConnectionCompletable()).isEqualTo(Completable.complete());%0A    %7D%0A%0A    @Test%0A    public void hasInternetConnectionCompletable_shouldErrorWhenNotConnected() %7B%0A        when(networkInfo.isConnectedOrConnecting()).thenReturn(false);%0A        when(connectivityManager.getActiveNetworkInfo()).thenReturn(networkInfo);%0A%0A        assertThat(networkInteractor.hasInternetConnectionCompletable().get()).isInstanceOf(Throwable.class);%0A    %7D
 %0A%7D%0A

Add NetworkInteractor unit tests