From e55d52654dd13cf61b344b915d5d923122fb9377 Mon Sep 17 00:00:00 2001 From: Kristian Flikka Date: Tue, 27 Aug 2013 10:10:12 +0200 Subject: [PATCH] Added test to check that getKeyword throws when asked for non-existing keyword --- opm/parser/eclipse/Parser/tests/ParserTests.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/opm/parser/eclipse/Parser/tests/ParserTests.cpp b/opm/parser/eclipse/Parser/tests/ParserTests.cpp index 9b764c289..6bde0f818 100644 --- a/opm/parser/eclipse/Parser/tests/ParserTests.cpp +++ b/opm/parser/eclipse/Parser/tests/ParserTests.cpp @@ -59,13 +59,20 @@ BOOST_AUTO_TEST_CASE(hasKeyword_hasKeyword_returnstrue) { } -BOOST_AUTO_TEST_CASE(Keyword_getKeyword_returnskeyword) { +BOOST_AUTO_TEST_CASE(getKeyword_haskeyword_returnskeyword) { ParserPtr parser(new Parser()); ParserKeywordConstPtr parserKeyword(new ParserKeyword("FJAS")); parser->addKeyword(parserKeyword); BOOST_CHECK_EQUAL(parserKeyword, parser->getKeyword("FJAS")); } +BOOST_AUTO_TEST_CASE(getKeyword_hasnotkeyword_throws) { + ParserPtr parser(new Parser()); + ParserKeywordConstPtr parserKeyword(new ParserKeyword("FJAS")); + parser->addKeyword(parserKeyword); + BOOST_CHECK_THROW(parser->getKeyword("FJASS"), std::invalid_argument); +} + /************************ JSON config related tests **********************'*/