### Question:
NamedParamsDefault implements NamedParams { @Override public void addParameterDefinition( String key, String defValue, String description ) throws DuplicateParamException { if ( params.get( key ) == null ) { OneNamedParam oneParam = new OneNamedParam(); oneParam.key = key; oneParam.defaultValue = defValue; oneParam.description = description; oneParam.value = ""; params.put( key, oneParam ); } else { throw new DuplicateParamException( "Duplicate parameter '" + key + "' detected." ); } } NamedParamsDefault(); @Override void addParameterDefinition( String key, String defValue, String description ); @Override String getParameterDescription( String key ); @Override String getParameterValue( String key ); @Override String getParameterDefault( String key ); @Override String[] listParameters(); @Override void setParameterValue( String key, String value ); @Override void eraseParameters(); @Override void clearParameters(); @Override void activateParameters(); @Override void copyParametersFrom( NamedParams aParam ); @Override void mergeParametersWith( NamedParams aParam, boolean replace );  }### Answer:
@Test( expected = DuplicateParamException.class ) public void testAddParameterDefinitionWithException() throws DuplicateParamException { namedParams.addParameterDefinition( "key", "value", "description" ); namedParams.addParameterDefinition( "key", "value", "description" ); }