@Test
public void should_return_is_online_when_network_is_ok() throws Exception {

    NetworkInfo networkInfo = mock(NetworkInfo.class);
    when(networkInfo.isAvailable()).thenReturn(true);
    when(networkInfo.isConnected()).thenReturn(true);
    when(connectivityManager.getActiveNetworkInfo()).thenReturn(networkInfo);
    assertThat("Should return true", loginService.isOnline(), is(true));
}