NetworkManager { public int getNetworkIBType() { NetworkInfo info = getNetworkInfo(); int networkType = info != null ? info.getType() : 0; switch (networkType) { case ConnectivityManager.TYPE_MOBILE: return IronBeast.NETWORK_MOBILE; case ConnectivityManager.TYPE_WIFI: return IronBeast.NETWORK_WIFI; default: return 0; } } NetworkManager(Context context); static NetworkManager getInstance(Context context); boolean isOnline(); String getConnectedNetworkType(); boolean isDataRoamingEnabled(); int getNetworkIBType();  }
@Test public void getNetworkIBTypeTest() { when(mNetworkInfo.getType()).thenReturn(ConnectivityManager.TYPE_WIFI); assertEquals(mNetManager.getNetworkIBType(), IronBeast.NETWORK_WIFI); when(mNetworkInfo.getType()).thenReturn(ConnectivityManager.TYPE_MOBILE); assertEquals(mNetManager.getNetworkIBType(), IronBeast.NETWORK_MOBILE); when(mNetworkInfo.getType()).thenReturn(ConnectivityManager.TYPE_BLUETOOTH); assertEquals(mNetManager.getNetworkIBType(), 0); }