Program { public final void addFunction(final Function function) throws FunctionAlreadyDeclared { if (this.functions.containsKey(function.getId())) { throw new FunctionAlreadyDeclared(); } this.functions.put(function.getId(), function); } Program(final String id); final String getId(); final Variable getVariable(final String id); final void addVariable(final Variable var); final Function getFunction(final String id); final void addFunction(final Function function); final OperationSequence getBody(); Set<Variable> getVariables(); Set<Function> getFunctions(); @Override final String toString();  }
@Test(expected = FunctionAlreadyDeclared.class) public void testAddFunction() throws Exception { Program program = new Program("test"); Function f = new Function("f", Type.INT, Type.INT); program.addFunction(f); program.addFunction(new Function("f", Type.BOOL)); }