@Test public void testShouldReturnFalseForNoConnection() throws Exception { when(networkData.getState()).thenReturn(NOT_CONNECTED); assertFalse(service.isInternetConnectionExists()); }
@Override public boolean isInternetConnectionExists() { final NetworkData networkData = networkStateService.getNetworkData(); if (networkData.getState() == NetworkState.UNKNOWN) { return isConnected(); } else { return networkData.getState() == NetworkState.CONNECTED; } }
DefaultAccountConnectionsService implements AccountConnectionsService, NetworkStateListener { @Override public boolean isInternetConnectionExists() { final NetworkData networkData = networkStateService.getNetworkData(); if (networkData.getState() == NetworkState.UNKNOWN) { return isConnected(); } else { return networkData.getState() == NetworkState.CONNECTED; } } }
DefaultAccountConnectionsService implements AccountConnectionsService, NetworkStateListener { @Override public boolean isInternetConnectionExists() { final NetworkData networkData = networkStateService.getNetworkData(); if (networkData.getState() == NetworkState.UNKNOWN) { return isConnected(); } else { return networkData.getState() == NetworkState.CONNECTED; } } @Inject  DefaultAccountConnectionsService(@Nonnull Application context); }
DefaultAccountConnectionsService implements AccountConnectionsService, NetworkStateListener { @Override public boolean isInternetConnectionExists() { final NetworkData networkData = networkStateService.getNetworkData(); if (networkData.getState() == NetworkState.UNKNOWN) { return isConnected(); } else { return networkData.getState() == NetworkState.CONNECTED; } } @Inject  DefaultAccountConnectionsService(@Nonnull Application context); @Override void init(); @Override void tryStopAll(); @Override void tryStartAll(); @Override boolean isInternetConnectionExists(); @Override void onNetworkEvent(@Nonnull final NetworkData networkData); }
DefaultAccountConnectionsService implements AccountConnectionsService, NetworkStateListener { @Override public boolean isInternetConnectionExists() { final NetworkData networkData = networkStateService.getNetworkData(); if (networkData.getState() == NetworkState.UNKNOWN) { return isConnected(); } else { return networkData.getState() == NetworkState.CONNECTED; } } @Inject  DefaultAccountConnectionsService(@Nonnull Application context); @Override void init(); @Override void tryStopAll(); @Override void tryStartAll(); @Override boolean isInternetConnectionExists(); @Override void onNetworkEvent(@Nonnull final NetworkData networkData);  }