summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2019-01-07 13:24:12 -0800
committerRatan Gupta <ratagupt@linux.vnet.ibm.com>2019-02-18 17:16:31 +0000
commit8fe594cfcb0c73084739bce996210dc222bb5758 (patch)
tree88c71ef57133791ff80acb2915ee549aba5656c1
parentd94d23e9b55cd1acd160f5c43fcf06f7e3ac8a86 (diff)
downloadphosphor-networkd-8fe594cfcb0c73084739bce996210dc222bb5758.tar.gz
phosphor-networkd-8fe594cfcb0c73084739bce996210dc222bb5758.zip
test: use expect_throw to catch expected exceptions
Use expect_throw to catch expected exceptions in tests. Change-Id: I410655a43328d44c5b9f95dff509c132499bcd07 Signed-off-by: Patrick Venture <venture@google.com>
-rw-r--r--test/test_network_manager.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/test/test_network_manager.cpp b/test/test_network_manager.cpp
index b68aa44..093a4a9 100644
--- a/test/test_network_manager.cpp
+++ b/test/test_network_manager.cpp
@@ -61,17 +61,7 @@ class TestNetworkManager : public testing::Test
TEST_F(TestNetworkManager, NoInterface)
{
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
- bool caughtException = false;
- try
- {
- createInterfaces();
- }
- catch (InternalFailure& e)
- {
- caughtException = true;
- }
-
- EXPECT_EQ(true, caughtException);
+ EXPECT_THROW(createInterfaces(), InternalFailure);
}
// getifaddrs returns single interface.
OpenPOWER on IntegriCloud