### Question:
GOLDParser extends Parser { public boolean setup(File grammarFile) throws IOException { if (grammarFile == null) { throw new IOException(FormatHelper.formatMessage("messages", "error.cgt_missing")); } return loadTables(grammarFile); } GOLDParser();  GOLDParser(GOLDParserBuildContext context);  GOLDParser(File cgtFile, String rulesPackage, boolean trimReductions);  GOLDParser(InputStream cgtFile, String rulesPackage, boolean trimReductions); void clear(); void clearProgramVariables(); void clearProgramVariable(String name); Variable getProgramVariable(String name); void setProgramVariable(String name, Variable value); Map<String, Scope> getScopes(); Scope getCurrentScope(); Scope setCurrentScope(Scope newScope); boolean getGenerateTree(); void setGenerateTree(boolean generateTree); void raiseParserException(String msg); void raiseParserException(String msg, Throwable cause); List<String> getErrorMessages(); String getErrorMessage(); void addErrorMessage(String message); boolean isReady(); boolean isIgnoreCaseOfVariables(); void setIgnoreCaseOfVariables(boolean ignoreCaseOfVariableNames); boolean setup(File grammarFile); boolean parseSourceStatements(String sourceStatements); boolean parseSourceStatements(Reader sourceReader); boolean processInternalError(); String getParseTree(); void loadRuleHandlers(String packageName); void loadRuleHandlers(List<Class> ruleClasses); List<String> validateHandlersExist(); void validateHandlerExists(Production rule); static final String VT_INDENT_DECREASE; static final String VT_INDENT_INCREASE; }### Answer:
@Test public void testSetup_no_grammar_file() throws Exception { GOLDParser parser = new GOLDParser(); try { parser.setup(null); fail("Expected IOException"); } catch (IOException e) { assertEquals("wrong msg", "A grammar file must be specified.", e.getMessage()); } }
@Test public void testSetup_missing_grammar_file() throws Exception { GOLDParser parser = new GOLDParser(); try { parser.setup(new File("no_such_file")); fail("Expected FileNotFoundException"); } catch (FileNotFoundException e) { } }