BooleanOptionItem extends OptionItem implements CompoundButton.OnCheckedChangeListener { public BooleanOptionItem setLabel(final String label) { if (label == null) { throw new IllegalArgumentException(getContext().getString(R.string.msdkui_exception_label_null)); } mLabelView.setText(label); return this; } BooleanOptionItem(final Context context);  BooleanOptionItem(final Context context, final AttributeSet attrs);  BooleanOptionItem(final Context context, final AttributeSet attrs, final int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  BooleanOptionItem(final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes); boolean isChecked(); void setChecked(final boolean checked); String getLabel(); BooleanOptionItem setLabel(final String label); @Override void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked);  }
@Test public void testLabel() { mBooleanOptionItem.setLabel(getString(R.string.msdkui_violate_truck_options)); final TextView labelView = (TextView) mBooleanOptionItem.findViewById(R.id.boolean_item_label); assertThat(labelView.getText().toString(), equalTo(getApplicationContext().getString(R.string.msdkui_violate_truck_options))); mBooleanOptionItem.setItemId(R.string.msdkui_violate_truck_options); assertThat(mBooleanOptionItem.getItemId(), equalTo(R.string.msdkui_violate_truck_options)); }
@Test(expected = IllegalArgumentException.class) public void testSetNullLabelException() { mBooleanOptionItem.setLabel(null); }