@Test public void shouldSwitchWiFiStateOnOnClick() { val wifiSwitch = givenWifiSwitch(); val wifiToasts = givenWifiToasts(); val wifiManager = givenWifiManagerWithWifiEnabled(); val wifiController = new WifiSwitch.WifiController(wifiSwitch, wifiToasts, wifiManager); wifiController.onClick(mock(View.class)); then(wifiManager).should().setWifiEnabled(false); then(wifiToasts.newToast(false)).should().show(); then(wifiSwitch).should().setImageBasedOn(false); }
void setImageBasedOn(final boolean wifiState) { setImageResource(wifiState ? R.drawable.ic_wifi_on_toolbar : R.drawable.ic_wifi_off_toolbar); }
WifiSwitch extends AppCompatImageButton { void setImageBasedOn(final boolean wifiState) { setImageResource(wifiState ? R.drawable.ic_wifi_on_toolbar : R.drawable.ic_wifi_off_toolbar); } }
WifiSwitch extends AppCompatImageButton { void setImageBasedOn(final boolean wifiState) { setImageResource(wifiState ? R.drawable.ic_wifi_on_toolbar : R.drawable.ic_wifi_off_toolbar); } WifiSwitch(final Context context, final AttributeSet attrs); }
WifiSwitch extends AppCompatImageButton { void setImageBasedOn(final boolean wifiState) { setImageResource(wifiState ? R.drawable.ic_wifi_on_toolbar : R.drawable.ic_wifi_off_toolbar); } WifiSwitch(final Context context, final AttributeSet attrs);  }
WifiSwitch extends AppCompatImageButton { void setImageBasedOn(final boolean wifiState) { setImageResource(wifiState ? R.drawable.ic_wifi_on_toolbar : R.drawable.ic_wifi_off_toolbar); } WifiSwitch(final Context context, final AttributeSet attrs);   }