### Question:
WearWifiMediator implements
        UserAbsentRadiosOffObserver.Listener,
        PowerTracker.Listener,
        WearWifiMediatorSettings.Listener,
        WifiBackoff.Listener { public void onBootCompleted(boolean proxyConnected) { mContext.registerReceiver(exitWifiLingerReceiver, new IntentFilter(ACTION_EXIT_WIFI_LINGER)); mIsProxyConnected = proxyConnected; mWifiSetting = mSettings.getWifiSetting(); mEnableWifiWhenCharging = mSettings.getEnableWifiWhileCharging(); mDisableWifiMediator = mSettings.getDisableWifiMediator(); mInHardwareLowPowerMode = mSettings.getHardwareLowPowerMode(); mRadioToggler.refreshRadioState(); refreshNumConfiguredNetworks(); mWifiOnWhenProxyDisconnected = mSettings.getWifiOnWhenProxyDisconnected(); if (mNumConfiguredNetworks == 0) { mWifiNetworksWorkaroundHandler = new Handler(); mWifiNetworksWorkaroundHandler.postDelayed(new Runnable() { @Override public void run() { Log.d(TAG, "Re-checking configured networks ."); refreshNumConfiguredNetworks(); mWifiNetworksWorkaroundHandler = null; } }, WIFI_NETWORK_WORKAROUND_DELAY_MS); } mInitialized = true; updateWifiState("onBootCompleted"); } WearWifiMediator(Context context,
                            AlarmManager alarmManager,
                            WearWifiMediatorSettings wifiMediatorSettings,
                            CompanionTracker companionTracker,
                            PowerTracker powerTracker,
                            UserAbsentRadiosOffObserver userAbsentRadiosOffObserver,
                            WifiBackoff wifiBackoff,
                            WifiManager wifiManager,
                            WifiLogger wifiLogger); void onBootCompleted(boolean proxyConnected); void updateProxyConnected(boolean proxyConnected); void updateNumUnmeteredRequests(int numUnmeteredRequests); void updateNumHighBandwidthRequests(int numHighBandwidthRequests); void updateNumWifiRequests(int numWifiRequests); void updateActivityMode(boolean activityMode); @Override void onUserAbsentRadiosOffChanged(boolean isEnabled); @Override void onPowerSaveModeChanged(); @Override void onChargingStateChanged(); @Override void onDeviceIdleModeChanged(); @Override void onWifiSettingChanged(String newWifiSetting); @Override void onInWifiSettingsMenuChanged(boolean inWifiSettingsMenu); @Override void onEnableWifiWhileChargingChanged(boolean enableWifiWhileCharging); @Override void onDisableWifiMediatorChanged(boolean disableWifiMediator); @Override void onHardwareLowPowerModeChanged(boolean inHardwareLowPowerMode); @Override void onWifiOnWhenProxyDisconnectedChanged(boolean wifiOnWhenProxyDisconnected); @Override void onWifiBackoffChanged(); void dump(IndentingPrintWriter ipw);  }### Answer:
@Test public void testOnBootCompletedOffCharger() { Assert.assertTrue(shadowApplication.hasReceiverForIntent( new Intent(WearWifiMediator.ACTION_EXIT_WIFI_LINGER))); mWifiMediator.onBootCompleted(true); verifyWifiWanted(false); }
@Test public void testOnBootCompletedOnCharger() { Assert.assertTrue(shadowApplication.hasReceiverForIntent( new Intent(WearWifiMediator.ACTION_EXIT_WIFI_LINGER))); when(mockPowerTracker.isCharging()).thenReturn(true); mWifiMediator.onBootCompleted(true); verifyWifiWanted(true); }
@Test public void testOnBootCompletedProxyDisconnectedEnablesWifi() { Assert.assertTrue(shadowApplication.hasReceiverForIntent( new Intent(WearWifiMediator.ACTION_EXIT_WIFI_LINGER))); mWifiMediator.onBootCompleted(false); verifyWifiWanted(true); }
@Test public void testOnBootCompletedProxyDisonnectedNotEnableWifi() { when(mockWifiSettings.getWifiOnWhenProxyDisconnected()).thenReturn(false); mWifiMediator.onBootCompleted(false); verifyWifiWanted(false); }