### Question:
UIInput extends UIOutput implements EditableValueHolder { @Override public Object saveState(FacesContext context) { if (context == null) { throw new NullPointerException(); } Object[] result = null; Object superState = super.saveState(context); Object validatorsState = ((validators != null) ? validators.saveState(context) : null); if (superState != null || validatorsState != null) { result = new Object[] { superState, validatorsState}; } return (result); } UIInput(); @Override String getFamily(); @Override Object getSubmittedValue(); @Override void setSubmittedValue(Object submittedValue); @Override Object getValue(); @Override void setValue(Object value); @Override void resetValue(); @Override boolean isLocalValueSet(); @Override void setLocalValueSet(boolean localValueSet); @Override boolean isRequired(); String getRequiredMessage(); void setRequiredMessage(String message); String getConverterMessage(); void setConverterMessage(String message); String getValidatorMessage(); void setValidatorMessage(String message); @Override boolean isValid(); @Override void setValid(boolean valid); @Override void setRequired(boolean required); @Override boolean isImmediate(); @Override void setImmediate(boolean immediate); @Override void markInitialState(); @Override void clearInitialState(); @Override void processDecodes(FacesContext context); @Override void processValidators(FacesContext context); @Override void processUpdates(FacesContext context); @Override void decode(FacesContext context); void updateModel(FacesContext context); void validate(FacesContext context); static boolean isEmpty(Object value); @Override void addValidator(Validator validator); @Override Validator[] getValidators(); @Override void removeValidator(Validator validator); @Override void addValueChangeListener(ValueChangeListener listener); @Override ValueChangeListener[] getValueChangeListeners(); @Override void removeValueChangeListener(ValueChangeListener listener); @Override Object saveState(FacesContext context); @Override void restoreState(FacesContext context, Object state); static final String COMPONENT_TYPE; static final String COMPONENT_FAMILY; static final String CONVERSION_MESSAGE_ID; static final String REQUIRED_MESSAGE_ID; static final String UPDATE_MESSAGE_ID; static final String VALIDATE_EMPTY_FIELDS_PARAM_NAME; static final String EMPTY_STRING_AS_NULL_PARAM_NAME; static final String ALWAYS_PERFORM_VALIDATION_WHEN_REQUIRED_IS_TRUE; }### Answer:
@Test public void testSaveState() { FacesContext context = EasyMock.createMock(FacesContext.class); UIInput input = new UIInput(); replay(context); assertNotNull(input.saveState(context)); verify(context); }
@Test(expected = NullPointerException.class) public void testSaveState2() { UIInput input = new UIInput(); input.saveState(null); }