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>
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 @@
 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.