### Question:
Procedure { public void addParameter (String name, boolean isOutput) throws ParameterNameException { if (!PARAMETER_NAME_PATTERN.matcher (name).matches ()) { throw new ParameterNameException ("invalid parameter name '%s'", name); } for (ProcedureParameter parameter : mParameters) { if (parameter.getName ().equalsIgnoreCase (name)) { throw new ParameterNameException ("duplicate parameter name '%s'", name); } } mParameters.add (new ProcedureParameter (name, isOutput)); } Procedure(String name); String getName(); void addParameter(String name, boolean isOutput); void addTable(List<List<String>> table);  }### Answer:
@Test public void testAddParameterInvalid () { try { mProcedure.addParameter ("a a", false); fail ("no exception"); } catch (ParameterNameException pne) { } }
@Test public void testAddParameterDuplicate () { try { mProcedure.addParameter ("x", false); mProcedure.addParameter ("y", false); } catch (ParameterNameException pne) { fail ("exception: " + pne.getMessage ()); } try { mProcedure.addParameter ("y", false); fail ("no exception"); } catch (ParameterNameException pne) { } }