### Question:
WXSwitch extends WXComponent<WXSwitchView> { @Override public void addEvent(String type) { super.addEvent(type); if (type != null && type.equals(Constants.Event.CHANGE) && getHostView() != null) { if (mListener == null) { mListener = new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Map<String, Object> params = new HashMap<>(2); params.put("value", isChecked); Map<String, Object> domChanges = new HashMap<>(); Map<String, Object> attrsChanges = new HashMap<>(); attrsChanges.put("checked",Boolean.toString(isChecked)); domChanges.put("attrs",attrsChanges); fireEvent(Constants.Event.CHANGE, params,domChanges); } }; } getHostView().setOnCheckedChangeListener(mListener); } } @Deprecated  WXSwitch(WXSDKInstance instance, WXVContainer parent, String instanceId, boolean isLazy, BasicComponentData basicComponentData);  WXSwitch(final WXSDKInstance instance, WXVContainer parent, boolean isLazy, BasicComponentData basicComponentData); @Override void addEvent(String type); @WXComponentProp(name = Constants.Name.CHECKED) void setChecked(boolean checked);  }### Answer:
@Test public void testAddEvent() throws Exception { component.addEvent(Constants.Event.CHANGE); }