Code example for WifiManager

Methods: getConfiguredNetworksupdateNetwork

0
 
  @Test 
  public void updateNetwork_shouldRejectNullandNewConfigs() throws Exception { 
    WifiConfiguration config = new WifiConfiguration();
    config.networkId = -1;
    assertThat(wifiManager.updateNetwork(config)).isEqualTo(-1);
    assertThat(wifiManager.updateNetwork(null)).isEqualTo(-1);
    assertTrue(wifiManager.getConfiguredNetworks().isEmpty());
  } 
 
  @Test 
  public void shouldSaveConfigurations() throws Exception { 
    shadowWifiManager.wasSaved = false;
    assertThat(wifiManager.saveConfiguration()).isTrue();
    assertThat(shadowWifiManager.wasSaved).isTrue();
  } 
 
  @Test 
  public void shouldCreateWifiLock() throws Exception { 
    assertNotNull(wifiManager.createWifiLock("TAG"));
    assertNotNull(wifiManager.createWifiLock(1, "TAG"));