[Libreoffice-commits] core.git: sax/qa

Matúš Kukan matus.kukan at gmail.com
Sun Jan 17 06:30:59 PST 2016


 sax/qa/cppunit/attributes.cxx |   11 +----------
 sax/qa/cppunit/parser.cxx     |   11 +----------
 2 files changed, 2 insertions(+), 20 deletions(-)

New commits:
commit 15a43283b83dd3179347c255b42aba0d116cb71b
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Sun Jan 17 11:23:21 2016 +0100

    sax: use CPPUNIT_ASSERT_THROW
    
    Change-Id: I34b0b559a91e77cc497e14d8ffad7e2c80e43d79
    Reviewed-on: https://gerrit.libreoffice.org/21531
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Matúš Kukan <matus at libreoffice.org>

diff --git a/sax/qa/cppunit/attributes.cxx b/sax/qa/cppunit/attributes.cxx
index 716b7b2..3697190 100644
--- a/sax/qa/cppunit/attributes.cxx
+++ b/sax/qa/cppunit/attributes.cxx
@@ -22,8 +22,6 @@ namespace {
 
 class AttributesTest: public CppUnit::TestFixture
 {
-    bool mbException;
-
 public:
     void test();
 
@@ -51,14 +49,7 @@ void AttributesTest::test()
     CPPUNIT_ASSERT_EQUAL( xAttributeList->getOptionalValue(3), OUString() );
 
     CPPUNIT_ASSERT_EQUAL( xAttributeList->getValue(1), OUString("1") );
-    mbException = false;
-
-    try { xAttributeList->getValue(3); }
-    catch (const sax::SAXException& )
-    {
-        mbException = true;
-    }
-    CPPUNIT_ASSERT( mbException );
+    CPPUNIT_ASSERT_THROW( xAttributeList->getValue(3), xml::sax::SAXException );
 
     xAttributeList->addUnknown("a", "a");
     xAttributeList->addUnknown("b", "b", "b");
diff --git a/sax/qa/cppunit/parser.cxx b/sax/qa/cppunit/parser.cxx
index e17538f..5381f36 100644
--- a/sax/qa/cppunit/parser.cxx
+++ b/sax/qa/cppunit/parser.cxx
@@ -92,16 +92,7 @@ void ParserTest::parse()
     mxParser->parseStream( maInput );
 
     maInput.aInputStream = createStream("<b></a>");
-    bool bException = false;
-    try
-    {
-        mxParser->parseStream( maInput );
-    }
-    catch (const SAXParseException &)
-    {
-        bException = true;
-    }
-    CPPUNIT_ASSERT_MESSAGE("No Exception!", bException);
+    CPPUNIT_ASSERT_THROW( mxParser->parseStream( maInput ), css::xml::sax::SAXParseException );
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ParserTest);


More information about the Libreoffice-commits mailing list