summaryrefslogtreecommitdiff
path: root/test/source/container
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2019-03-11 04:34:16 +0000
committerJens Carl <j.carl43@gmx.de>2019-03-11 06:44:13 +0100
commitdc28443e1ae7d160127e0ccbc7362b9756660152 (patch)
tree6d7eeedc959b2f89bb6581ebc4490ace4ec0074a /test/source/container
parent17eb345d999ce8db78453e804af678384846acbc (diff)
tdf#45904 Move XNameContainer Java tests to C++
Move XNameContainer Java tests to C++ for ScStyleFamilyObj. Change-Id: I8ff465262258ef5277d470369cc05f48bba25ce4 Reviewed-on: https://gerrit.libreoffice.org/69029 Tested-by: Jenkins Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'test/source/container')
-rw-r--r--test/source/container/xnamecontainer.cxx25
1 files changed, 18 insertions, 7 deletions
diff --git a/test/source/container/xnamecontainer.cxx b/test/source/container/xnamecontainer.cxx
index c871debaecce..e5e8d8dead8e 100644
--- a/test/source/container/xnamecontainer.cxx
+++ b/test/source/container/xnamecontainer.cxx
@@ -56,13 +56,24 @@ void XNameContainer::testInsertByNameDuplicate()
{
uno::Reference<container::XNameContainer> xNameContainer(init(), uno::UNO_QUERY_THROW);
- uno::Any aAny;
- CPPUNIT_ASSERT(!xNameContainer->hasByName(m_aName));
- xNameContainer->insertByName(m_aName, aAny);
- CPPUNIT_ASSERT(xNameContainer->hasByName(m_aName));
-
- CPPUNIT_ASSERT_THROW(xNameContainer->insertByName(m_aName, aAny),
- container::ElementExistException);
+ CPPUNIT_ASSERT(!xNameContainer->hasByName(m_aName + "Duplicate"));
+ xNameContainer->insertByName(m_aName + "Duplicate", m_aElement);
+ CPPUNIT_ASSERT(xNameContainer->hasByName(m_aName + "Duplicate"));
+
+ bool bExceptionThrown = false;
+ try
+ {
+ xNameContainer->insertByName(m_aName + "Duplicate", m_aElement);
+ }
+ catch (const container::ElementExistException&)
+ {
+ bExceptionThrown = true;
+ }
+ catch (const lang::IllegalArgumentException&)
+ {
+ bExceptionThrown = true;
+ }
+ CPPUNIT_ASSERT(bExceptionThrown);
}
void XNameContainer::testRemoveByName()