### Question:
SwitchItem extends Item implements CompoundButton.OnCheckedChangeListener { public void toggle(View view) { checked = !checked; final SwitchCompat switchView = (SwitchCompat) view.findViewById(R.id.suw_items_switch); switchView.setChecked(checked); } SwitchItem();  SwitchItem(Context context, AttributeSet attrs); void setChecked(boolean checked); boolean isChecked(); void toggle(View view); @Override void onBindView(View view); void setOnCheckedChangeListener(OnCheckedChangeListener listener); @Override void onCheckedChanged(CompoundButton buttonView, boolean isChecked);  }### Answer:
@Test public void testToggle() { SwitchItem item = new SwitchItem(); item.setTitle("TestTitle"); item.setSummary("TestSummary"); View view = createLayout(); item.setChecked(true); item.onBindView(view); assertTrue("Switch should be checked", mSwitch.isChecked()); item.toggle(view); assertFalse("Switch should be unchecked", mSwitch.isChecked()); }