tests: cleanup FaceManager test cases

Change-Id: I1fd379fc1e01de331523260bd98ba96d6a7de88e
Refs: #3903
diff --git a/tests/daemon/mgmt/face-manager.t.cpp b/tests/daemon/mgmt/face-manager.t.cpp
index 90e99af..5f8eef0 100644
--- a/tests/daemon/mgmt/face-manager.t.cpp
+++ b/tests/daemon/mgmt/face-manager.t.cpp
@@ -34,7 +34,6 @@
 #include <ndn-cxx/encoding/tlv.hpp>
 #include <ndn-cxx/encoding/tlv-nfd.hpp>
 #include <ndn-cxx/mgmt/nfd/channel-status.hpp>
-#include <ndn-cxx/mgmt/nfd/face-event-notification.hpp>
 #include <ndn-cxx/net/network-monitor-stub.hpp>
 
 namespace nfd {
@@ -57,14 +56,14 @@
     REMOVE_LAST_NOTIFICATION = 1 << 0,
     SET_SCOPE_LOCAL          = 1 << 1,
     SET_URI_TEST             = 1 << 2,
-    RANDOMIZE_COUNTERS       = 1 << 3
+    RANDOMIZE_COUNTERS       = 1 << 3,
   };
 
   /** \brief adds a face to the FaceTable
    *  \param options bitwise OR'ed AddFaceFlags
    */
   shared_ptr<Face>
-  addFace(int flags = 0)
+  addFace(unsigned int flags = 0)
   {
     std::string uri = "dummy://";
     ndn::nfd::FaceScope scope = ndn::nfd::FACE_SCOPE_NON_LOCAL;
@@ -103,7 +102,7 @@
 
 private:
   template<typename T>
-  static typename std::enable_if<std::is_base_of<SimpleCounter, T>::value>::type
+  static void
   randomizeCounter(const T& counter)
   {
     static std::uniform_int_distribution<typename T::rep> dist;
@@ -155,24 +154,20 @@
 
 BOOST_AUTO_TEST_CASE(FaceDataset)
 {
-  size_t nEntries = 303;
+  const size_t nEntries = 303;
   for (size_t i = 0; i < nEntries; ++i) {
     addFace(REMOVE_LAST_NOTIFICATION | SET_URI_TEST | RANDOMIZE_COUNTERS);
   }
 
   receiveInterest(Interest("/localhost/nfd/faces/list"));
 
-  Block content;
-  BOOST_CHECK_NO_THROW(content = concatenateResponses());
-  BOOST_CHECK_NO_THROW(content.parse());
+  Block content = concatenateResponses();
+  content.parse();
   BOOST_REQUIRE_EQUAL(content.elements().size(), nEntries);
 
   std::set<FaceId> faceIds;
   for (size_t idx = 0; idx < nEntries; ++idx) {
-    BOOST_TEST_MESSAGE("processing element: " << idx);
-
-    ndn::nfd::FaceStatus decodedStatus;
-    BOOST_REQUIRE_NO_THROW(decodedStatus.wireDecode(content.elements()[idx]));
+    ndn::nfd::FaceStatus decodedStatus(content.elements()[idx]);
     BOOST_CHECK(m_faceTable.get(decodedStatus.getFaceId()) != nullptr);
     faceIds.insert(decodedStatus.getFaceId());
   }
@@ -183,22 +178,21 @@
 
 BOOST_AUTO_TEST_CASE(FaceQuery)
 {
+  using ndn::nfd::FaceQueryFilter;
+
   auto face1 = addFace(REMOVE_LAST_NOTIFICATION); // dummy://
   auto face2 = addFace(REMOVE_LAST_NOTIFICATION | SET_SCOPE_LOCAL); // dummy://, local
   auto face3 = addFace(REMOVE_LAST_NOTIFICATION | SET_URI_TEST); // test://
 
-  auto generateQueryName = [] (const ndn::nfd::FaceQueryFilter& filter) {
+  auto generateQueryName = [] (const FaceQueryFilter& filter) {
     return Name("/localhost/nfd/faces/query").append(filter.wireEncode());
   };
 
-  auto querySchemeName =
-    generateQueryName(ndn::nfd::FaceQueryFilter().setUriScheme("dummy"));
-  auto queryIdName =
-    generateQueryName(ndn::nfd::FaceQueryFilter().setFaceId(face1->getId()));
-  auto queryScopeName =
-    generateQueryName(ndn::nfd::FaceQueryFilter().setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL));
-  auto invalidQueryName =
-    Name("/localhost/nfd/faces/query").append(ndn::makeStringBlock(tlv::Content, "invalid"));
+  auto querySchemeName = generateQueryName(FaceQueryFilter().setUriScheme("dummy"));
+  auto queryIdName = generateQueryName(FaceQueryFilter().setFaceId(face1->getId()));
+  auto queryScopeName = generateQueryName(FaceQueryFilter().setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL));
+  auto invalidQueryName = Name("/localhost/nfd/faces/query")
+                          .append(ndn::makeStringBlock(tlv::Content, "invalid"));
 
   receiveInterest(Interest(querySchemeName)); // face1 and face2 expected
   receiveInterest(Interest(queryIdName)); // face1 expected
@@ -211,25 +205,25 @@
   ndn::nfd::FaceStatus status;
 
   content = m_responses[0].getContent();
-  BOOST_CHECK_NO_THROW(content.parse());
+  content.parse();
   BOOST_CHECK_EQUAL(content.elements().size(), 2); // face1 and face2
-  BOOST_CHECK_NO_THROW(status.wireDecode(content.elements()[0]));
+  status.wireDecode(content.elements()[0]);
   BOOST_CHECK_EQUAL(face1->getId(), status.getFaceId());
-  BOOST_CHECK_NO_THROW(status.wireDecode(content.elements()[1]));
+  status.wireDecode(content.elements()[1]);
   BOOST_CHECK_EQUAL(face2->getId(), status.getFaceId());
 
   content = m_responses[1].getContent();
-  BOOST_CHECK_NO_THROW(content.parse());
+  content.parse();
   BOOST_CHECK_EQUAL(content.elements().size(), 1); // face1
-  BOOST_CHECK_NO_THROW(status.wireDecode(content.elements()[0]));
+  status.wireDecode(content.elements()[0]);
   BOOST_CHECK_EQUAL(face1->getId(), status.getFaceId());
 
   content = m_responses[2].getContent();
-  BOOST_CHECK_NO_THROW(content.parse());
+  content.parse();
   BOOST_CHECK_EQUAL(content.elements().size(), 2); // face1 and face3
-  BOOST_CHECK_NO_THROW(status.wireDecode(content.elements()[0]));
+  status.wireDecode(content.elements()[0]);
   BOOST_CHECK_EQUAL(face1->getId(), status.getFaceId());
-  BOOST_CHECK_NO_THROW(status.wireDecode(content.elements()[1]));
+  status.wireDecode(content.elements()[1]);
   BOOST_CHECK_EQUAL(face3->getId(), status.getFaceId());
 
   ControlResponse expectedResponse(400, "Malformed filter"); // nack, 400, malformed filter
@@ -308,25 +302,21 @@
     make_unique<TestProtocolFactory>(m_faceSystem.makePFCtorParams());
   auto factory = static_cast<TestProtocolFactory*>(m_manager.m_faceSystem.getFactoryById("test"));
 
+  const size_t nEntries = 404;
   std::map<std::string, shared_ptr<TestChannel>> addedChannels;
-  size_t nEntries = 404;
   for (size_t i = 0; i < nEntries; i++) {
-    auto channel = factory->addChannel("test" + boost::lexical_cast<std::string>(i) + "://");
+    auto channel = factory->addChannel("test" + to_string(i) + "://");
     addedChannels[channel->getUri().toString()] = channel;
   }
 
   receiveInterest(Interest("/localhost/nfd/faces/channels"));
 
-  Block content;
-  BOOST_CHECK_NO_THROW(content = concatenateResponses());
-  BOOST_CHECK_NO_THROW(content.parse());
+  Block content = concatenateResponses();
+  content.parse();
   BOOST_REQUIRE_EQUAL(content.elements().size(), nEntries);
 
   for (size_t idx = 0; idx < nEntries; ++idx) {
-    BOOST_TEST_MESSAGE("processing element: " << idx);
-
-    ndn::nfd::ChannelStatus decodedStatus;
-    BOOST_CHECK_NO_THROW(decodedStatus.wireDecode(content.elements()[idx]));
+    ndn::nfd::ChannelStatus decodedStatus(content.elements()[idx]);
     BOOST_CHECK(addedChannels.find(decodedStatus.getLocalUri()) != addedChannels.end());
   }
 }
@@ -344,12 +334,10 @@
   BOOST_CHECK_EQUAL(m_manager.m_faceStateChangeConn.count(faceId), 1);
 
   // check notification
-  Block payload;
-  ndn::nfd::FaceEventNotification notification;
   BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
-  BOOST_CHECK_NO_THROW(payload = m_responses.back().getContent().blockFromValue());
+  Block payload = m_responses.back().getContent().blockFromValue();
   BOOST_CHECK_EQUAL(payload.type(), ndn::tlv::nfd::FaceEventNotification);
-  BOOST_CHECK_NO_THROW(notification.wireDecode(payload));
+  ndn::nfd::FaceEventNotification notification(payload);
   BOOST_CHECK_EQUAL(notification.getKind(), ndn::nfd::FACE_EVENT_CREATED);
   BOOST_CHECK_EQUAL(notification.getFaceId(), faceId);
   BOOST_CHECK_EQUAL(notification.getRemoteUri(), face->getRemoteUri().toString());
@@ -357,7 +345,7 @@
   BOOST_CHECK_EQUAL(notification.getFaceScope(), ndn::nfd::FACE_SCOPE_NON_LOCAL);
   BOOST_CHECK_EQUAL(notification.getFacePersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
   BOOST_CHECK_EQUAL(notification.getLinkType(), ndn::nfd::LinkType::LINK_TYPE_POINT_TO_POINT);
-  BOOST_CHECK_EQUAL(notification.getFlags(), 0x0);
+  BOOST_CHECK_EQUAL(notification.getFlags(), 0);
 }
 
 BOOST_AUTO_TEST_CASE(FaceEventDownUp)
@@ -373,12 +361,10 @@
 
   // check notification
   {
-    Block payload;
-    ndn::nfd::FaceEventNotification notification;
     BOOST_REQUIRE_EQUAL(m_responses.size(), 2);
-    BOOST_CHECK_NO_THROW(payload = m_responses.back().getContent().blockFromValue());
+    Block payload = m_responses.back().getContent().blockFromValue();
     BOOST_CHECK_EQUAL(payload.type(), ndn::tlv::nfd::FaceEventNotification);
-    BOOST_CHECK_NO_THROW(notification.wireDecode(payload));
+    ndn::nfd::FaceEventNotification notification(payload);
     BOOST_CHECK_EQUAL(notification.getKind(), ndn::nfd::FACE_EVENT_DOWN);
     BOOST_CHECK_EQUAL(notification.getFaceId(), faceId);
     BOOST_CHECK_EQUAL(notification.getRemoteUri(), face->getRemoteUri().toString());
@@ -386,7 +372,7 @@
     BOOST_CHECK_EQUAL(notification.getFaceScope(), ndn::nfd::FACE_SCOPE_NON_LOCAL);
     BOOST_CHECK_EQUAL(notification.getFacePersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
     BOOST_CHECK_EQUAL(notification.getLinkType(), ndn::nfd::LinkType::LINK_TYPE_POINT_TO_POINT);
-    BOOST_CHECK_EQUAL(notification.getFlags(), 0x0);
+    BOOST_CHECK_EQUAL(notification.getFlags(), 0);
   }
 
   // trigger FACE_EVENT_UP notification
@@ -396,12 +382,10 @@
 
   // check notification
   {
-    Block payload;
-    ndn::nfd::FaceEventNotification notification;
     BOOST_REQUIRE_EQUAL(m_responses.size(), 3);
-    BOOST_CHECK_NO_THROW(payload = m_responses.back().getContent().blockFromValue());
+    Block payload = m_responses.back().getContent().blockFromValue();
     BOOST_CHECK_EQUAL(payload.type(), ndn::tlv::nfd::FaceEventNotification);
-    BOOST_CHECK_NO_THROW(notification.wireDecode(payload));
+    ndn::nfd::FaceEventNotification notification(payload);
     BOOST_CHECK_EQUAL(notification.getKind(), ndn::nfd::FACE_EVENT_UP);
     BOOST_CHECK_EQUAL(notification.getFaceId(), faceId);
     BOOST_CHECK_EQUAL(notification.getRemoteUri(), face->getRemoteUri().toString());
@@ -409,7 +393,7 @@
     BOOST_CHECK_EQUAL(notification.getFaceScope(), ndn::nfd::FACE_SCOPE_NON_LOCAL);
     BOOST_CHECK_EQUAL(notification.getFacePersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
     BOOST_CHECK_EQUAL(notification.getLinkType(), ndn::nfd::LinkType::LINK_TYPE_POINT_TO_POINT);
-    BOOST_CHECK_EQUAL(notification.getFlags(), 0x0);
+    BOOST_CHECK_EQUAL(notification.getFlags(), 0);
   }
 }
 
@@ -425,12 +409,10 @@
   advanceClocks(time::milliseconds(1), 10);
 
   // check notification
-  Block payload;
-  ndn::nfd::FaceEventNotification notification;
   BOOST_REQUIRE_EQUAL(m_responses.size(), 2);
-  BOOST_CHECK_NO_THROW(payload = m_responses.back().getContent().blockFromValue());
+  Block payload = m_responses.back().getContent().blockFromValue();
   BOOST_CHECK_EQUAL(payload.type(), ndn::tlv::nfd::FaceEventNotification);
-  BOOST_CHECK_NO_THROW(notification.wireDecode(payload));
+  ndn::nfd::FaceEventNotification notification(payload);
   BOOST_CHECK_EQUAL(notification.getKind(), ndn::nfd::FACE_EVENT_DESTROYED);
   BOOST_CHECK_EQUAL(notification.getFaceId(), faceId);
   BOOST_CHECK_EQUAL(notification.getRemoteUri(), face->getRemoteUri().toString());
@@ -438,7 +420,7 @@
   BOOST_CHECK_EQUAL(notification.getFaceScope(), ndn::nfd::FACE_SCOPE_NON_LOCAL);
   BOOST_CHECK_EQUAL(notification.getFacePersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
   BOOST_CHECK_EQUAL(notification.getLinkType(), ndn::nfd::LinkType::LINK_TYPE_POINT_TO_POINT);
-  BOOST_CHECK_EQUAL(notification.getFlags(), 0x0);
+  BOOST_CHECK_EQUAL(notification.getFlags(), 0);
 
   BOOST_CHECK_EQUAL(face->getId(), face::INVALID_FACEID);
   BOOST_CHECK_EQUAL(m_manager.m_faceStateChangeConn.count(faceId), 0);