Code example for WifiManager

Methods: isWifiEnabled

0
  } 
 
  @Test(expected = SecurityException.class) 
  public void isWifiEnabled_shouldThrowSecurityExceptionWhenAccessWifiStatePermissionNotGranted() throws Exception { 
    shadowWifiManager.setAccessWifiStatePermission(false);
    wifiManager.isWifiEnabled();
  } 
 
  @Test(expected = SecurityException.class) 
  public void getConnectionInfo_shouldThrowSecurityExceptionWhenAccessWifiStatePermissionNotGranted() throws Exception { 
    shadowWifiManager.setAccessWifiStatePermission(false);
    wifiManager.getConnectionInfo();
  } 
 
  @Test 
  public void shouldEnableNetworks() throws Exception { 
    int networkId = 666;
    wifiManager.enableNetwork(networkId, true);
    Pair<Integer, Boolean> lastEnabled = shadowWifiManager.getLastEnabledNetwork();
    assertThat(lastEnabled).isEqualTo(new Pair<Integer, Boolean>(666, true));