### Question:
RadioToggler { public void refreshRadioState() { Message msg = mHandler.obtainMessage(MSG_REFRESH_RADIO_STATE); if (!mHandler.hasMessages(MSG_REFRESH_RADIO_STATE)) { mHandler.sendMessage(msg); } } RadioToggler(Radio radio, PartialWakeLock wakeLock, long radioToggleWaitMs); boolean getRadioEnabled(); void refreshRadioState(); void toggleRadio(boolean enable);  }### Answer:
@Test public void testRefreshRadioState() { mockRadio.setEnabled(true); radioToggler.refreshRadioState(); shadowLooper.runToEndOfTasks(); Assert.assertTrue(radioToggler.getRadioEnabled()); mockRadio.setEnabled(false); radioToggler.refreshRadioState(); shadowLooper.runToEndOfTasks(); Assert.assertFalse(radioToggler.getRadioEnabled()); }
@Test public void testRefreshRadioState() { mockRadio.setEnabled(true); radioToggler.refreshRadioState(); shadowLooper.runToEndOfTasks(); assertTrue(radioToggler.getRadioEnabled()); mockRadio.setEnabled(false); radioToggler.refreshRadioState(); shadowLooper.runToEndOfTasks(); assertFalse(radioToggler.getRadioEnabled()); }