diff --git a/tests/daemon/mgmt/command-authenticator.t.cpp b/tests/daemon/mgmt/command-authenticator.t.cpp
index 7d2ed6e..498f44f 100644
--- a/tests/daemon/mgmt/command-authenticator.t.cpp
+++ b/tests/daemon/mgmt/command-authenticator.t.cpp
@@ -24,16 +24,15 @@
  */
 
 #include "mgmt/command-authenticator.hpp"
-#include <ndn-cxx/security/signing-helpers.hpp>
 #include <boost/filesystem.hpp>
 
 #include "tests/test-common.hpp"
-#include "tests/identity-management-fixture.hpp"
+#include "tests/manager-common-fixture.hpp"
 
 namespace nfd {
 namespace tests {
 
-class CommandAuthenticatorFixture : public IdentityManagementTimeFixture
+class CommandAuthenticatorFixture : public CommandInterestSignerFixture
 {
 protected:
   CommandAuthenticatorFixture()
@@ -63,17 +62,17 @@
   authorize(const std::string& module, const Name& identity,
             const function<void(Interest&)>& modifyInterest = nullptr)
   {
-    auto interest = makeInterest(Name("/prefix").append(module).append("verb"));
-    m_keyChain.sign(*interest, signingByIdentity(identity));
+    Interest interest = this->makeControlCommandRequest(Name("/prefix/" + module + "/verb"),
+                        ControlParameters(), identity);
     if (modifyInterest != nullptr) {
-      modifyInterest(*interest);
+      modifyInterest(interest);
     }
 
     ndn::mgmt::Authorization authorization = authorizations.at(module);
 
     bool isAccepted = false;
     bool isRejected = false;
-    authorization(Name("/prefix"), *interest, nullptr,
+    authorization(Name("/prefix"), interest, nullptr,
       [this, &isAccepted, &isRejected] (const std::string& requester) {
         BOOST_REQUIRE_MESSAGE(!isAccepted && !isRejected,
                               "authorization function should invoke only one continuation");
diff --git a/tests/daemon/mgmt/face-manager-command-fixture.hpp b/tests/daemon/mgmt/face-manager-command-fixture.hpp
index bf376f5..b00b9cc 100644
--- a/tests/daemon/mgmt/face-manager-command-fixture.hpp
+++ b/tests/daemon/mgmt/face-manager-command-fixture.hpp
@@ -29,10 +29,7 @@
 #include "mgmt/face-manager.hpp"
 #include "fw/face-table.hpp"
 
-#include "tests/identity-management-fixture.hpp"
-
-#include <ndn-cxx/mgmt/dispatcher.hpp>
-#include <ndn-cxx/util/dummy-client-face.hpp>
+#include "tests/manager-common-fixture.hpp"
 
 namespace nfd {
 namespace tests {
@@ -61,7 +58,7 @@
   FaceManager manager;
 };
 
-class FaceManagerCommandFixture : public IdentityManagementTimeFixture
+class FaceManagerCommandFixture : public CommandInterestSignerFixture
 {
 public:
   FaceManagerCommandFixture();
diff --git a/tests/daemon/mgmt/face-manager-create-face.t.cpp b/tests/daemon/mgmt/face-manager-create-face.t.cpp
index 428e517..ac50913 100644
--- a/tests/daemon/mgmt/face-manager-create-face.t.cpp
+++ b/tests/daemon/mgmt/face-manager-create-face.t.cpp
@@ -228,15 +228,11 @@
   using FaceType = typename T::first;
   using CreateResult = typename T::second;
 
-  Name commandName("/localhost/nfd/faces");
-  commandName.append("create");
-  commandName.append(FaceType::getParameters().wireEncode());
-  auto command = makeInterest(commandName);
-  m_keyChain.sign(*command);
+  Interest req = makeControlCommandRequest("/localhost/nfd/faces/create", FaceType::getParameters());
 
   bool hasCallbackFired = false;
-  this->node1.face.onSendData.connect([this, command, &hasCallbackFired] (const Data& response) {
-    if (!command->getName().isPrefixOf(response.getName())) {
+  this->node1.face.onSendData.connect([this, req, &hasCallbackFired] (const Data& response) {
+    if (!req.getName().isPrefixOf(response.getName())) {
       return;
     }
 
@@ -284,7 +280,7 @@
     hasCallbackFired = true;
   });
 
-  this->node1.face.receive(*command);
+  this->node1.face.receive(req);
   this->advanceClocks(time::milliseconds(1), 5);
 
   BOOST_CHECK(hasCallbackFired);
@@ -296,14 +292,8 @@
 
   {
     // create face
-
-    Name commandName("/localhost/nfd/faces");
-    commandName.append("create");
-    commandName.append(FaceType::getParameters().wireEncode());
-    auto command = makeInterest(commandName);
-    m_keyChain.sign(*command);
-
-    this->node1.face.receive(*command);
+    Interest req = makeControlCommandRequest("/localhost/nfd/faces/create", FaceType::getParameters());
+    this->node1.face.receive(req);
     this->advanceClocks(time::milliseconds(1), 5);
   }
 
@@ -313,17 +303,12 @@
 
   {
     // re-create face
-
-    Name commandName("/localhost/nfd/faces");
-    commandName.append("create");
-    commandName.append(FaceType::getParameters().wireEncode());
-    auto command = makeInterest(commandName);
-    m_keyChain.sign(*command);
+    Interest req = makeControlCommandRequest("/localhost/nfd/faces/create", FaceType::getParameters());
 
     bool hasCallbackFired = false;
     this->node1.face.onSendData.connect(
-      [this, command, &hasCallbackFired, foundFace] (const Data& response) {
-        if (!command->getName().isPrefixOf(response.getName())) {
+      [this, req, &hasCallbackFired, foundFace] (const Data& response) {
+        if (!req.getName().isPrefixOf(response.getName())) {
           return;
         }
 
@@ -338,7 +323,7 @@
         hasCallbackFired = true;
       });
 
-    this->node1.face.receive(*command);
+    this->node1.face.receive(req);
     this->advanceClocks(time::milliseconds(1), 5);
 
     BOOST_CHECK(hasCallbackFired);
diff --git a/tests/daemon/mgmt/face-manager-update-face.t.cpp b/tests/daemon/mgmt/face-manager-update-face.t.cpp
index 6757622..e81e3be 100644
--- a/tests/daemon/mgmt/face-manager-update-face.t.cpp
+++ b/tests/daemon/mgmt/face-manager-update-face.t.cpp
@@ -68,18 +68,15 @@
   createFace(const ControlParameters& createParams,
              bool isForOnDemandFace = false)
   {
-    Name commandName("/localhost/nfd/faces/create");
-    commandName.append(createParams.wireEncode());
-    auto command = makeInterest(commandName);
-    m_keyChain.sign(*command);
+    Interest req = makeControlCommandRequest("/localhost/nfd/faces/create", createParams);
 
     // if this creation if for on-demand face then create it on node2
     FaceManagerCommandNode& target = isForOnDemandFace ? this->node2 : this->node1;
 
     bool hasCallbackFired = false;
     signal::ScopedConnection connection = target.face.onSendData.connect(
-      [&, command, isForOnDemandFace, this] (const Data& response) {
-        if (!command->getName().isPrefixOf(response.getName())) {
+      [&, req, isForOnDemandFace, this] (const Data& response) {
+        if (!req.getName().isPrefixOf(response.getName())) {
           return;
         }
 
@@ -101,7 +98,7 @@
         }
       });
 
-    target.face.receive(*command);
+    target.face.receive(req);
     this->advanceClocks(time::milliseconds(1), 5);
 
     if (isForOnDemandFace) {
@@ -117,19 +114,16 @@
              bool isSelfUpdating,
              const function<void(const ControlResponse& resp)>& checkResp)
   {
-    Name commandName("/localhost/nfd/faces/update");
-    commandName.append(requestParams.wireEncode());
-    auto command = makeInterest(commandName);
+    Interest req = makeControlCommandRequest("/localhost/nfd/faces/update", requestParams);
     if (isSelfUpdating) {
       // Attach IncomingFaceIdTag to interest
-      command->setTag(make_shared<lp::IncomingFaceIdTag>(faceId));
+      req.setTag(make_shared<lp::IncomingFaceIdTag>(faceId));
     }
-    m_keyChain.sign(*command);
 
     bool hasCallbackFired = false;
     signal::ScopedConnection connection = this->node1.face.onSendData.connect(
-      [this, command, &hasCallbackFired, &checkResp] (const Data& response) {
-        if (!command->getName().isPrefixOf(response.getName())) {
+      [this, req, &hasCallbackFired, &checkResp] (const Data& response) {
+        if (!req.getName().isPrefixOf(response.getName())) {
           return;
         }
 
@@ -139,7 +133,7 @@
         hasCallbackFired = true;
       });
 
-    this->node1.face.receive(*command);
+    this->node1.face.receive(req);
     this->advanceClocks(time::milliseconds(1), 5);
 
     BOOST_CHECK(hasCallbackFired);
@@ -156,15 +150,12 @@
     ControlParameters params;
     params.setFaceId(faceId);
 
-    Name commandName("/localhost/nfd/faces/destroy");
-    commandName.append(params.wireEncode());
-    auto command = makeInterest(commandName);
-    m_keyChain.sign(*command);
+    Interest req = makeControlCommandRequest("/localhost/nfd/faces/destroy", params);
 
     bool hasCallbackFired = false;
     signal::ScopedConnection connection = this->node1.face.onSendData.connect(
-      [this, command, &hasCallbackFired] (const Data& response) {
-        if (!command->getName().isPrefixOf(response.getName())) {
+      [this, req, &hasCallbackFired] (const Data& response) {
+        if (!req.getName().isPrefixOf(response.getName())) {
           return;
         }
 
@@ -175,7 +166,7 @@
         hasCallbackFired = true;
       });
 
-    this->node1.face.receive(*command);
+    this->node1.face.receive(req);
     this->advanceClocks(time::milliseconds(1), 5);
 
     BOOST_CHECK(hasCallbackFired);
diff --git a/tests/daemon/mgmt/face-manager.t.cpp b/tests/daemon/mgmt/face-manager.t.cpp
index 41dcb90..52e2a11 100644
--- a/tests/daemon/mgmt/face-manager.t.cpp
+++ b/tests/daemon/mgmt/face-manager.t.cpp
@@ -125,14 +125,13 @@
   auto addedFace = addFace(REMOVE_LAST_NOTIFICATION | SET_SCOPE_LOCAL); // clear notification for creation
 
   auto parameters = ControlParameters().setFaceId(addedFace->getId());
-  auto command = makeControlCommandRequest("/localhost/nfd/faces/destroy", parameters);
-
-  receiveInterest(command);
+  auto req = makeControlCommandRequest("/localhost/nfd/faces/destroy", parameters);
+  receiveInterest(req);
 
   BOOST_REQUIRE_EQUAL(m_responses.size(), 2); // one response and one notification
   // notification is already tested, so ignore it
 
-  BOOST_CHECK_EQUAL(checkResponse(1, command->getName(), makeResponse(200, "OK", parameters)),
+  BOOST_CHECK_EQUAL(checkResponse(1, req.getName(), makeResponse(200, "OK", parameters)),
                     CheckResponseResult::OK);
 
   BOOST_CHECK_EQUAL(addedFace->getId(), face::INVALID_FACEID);
@@ -141,13 +140,11 @@
 BOOST_AUTO_TEST_CASE(NonExisting)
 {
   auto parameters = ControlParameters().setFaceId(65535);
-  auto command = makeControlCommandRequest("/localhost/nfd/faces/destroy", parameters);
-
-  receiveInterest(command);
+  auto req = makeControlCommandRequest("/localhost/nfd/faces/destroy", parameters);
+  receiveInterest(req);
 
   BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
-
-  BOOST_CHECK_EQUAL(checkResponse(0, command->getName(), makeResponse(200, "OK", parameters)),
+  BOOST_CHECK_EQUAL(checkResponse(0, req.getName(), makeResponse(200, "OK", parameters)),
                     CheckResponseResult::OK);
 }
 
@@ -162,7 +159,7 @@
     addFace(REMOVE_LAST_NOTIFICATION | SET_URI_TEST | RANDOMIZE_COUNTERS);
   }
 
-  receiveInterest(makeInterest("/localhost/nfd/faces/list"));
+  receiveInterest(Interest("/localhost/nfd/faces/list"));
 
   Block content;
   BOOST_CHECK_NO_THROW(content = concatenateResponses());
@@ -202,10 +199,10 @@
   auto invalidQueryName =
     Name("/localhost/nfd/faces/query").append(ndn::makeStringBlock(tlv::Content, "invalid"));
 
-  receiveInterest(makeInterest(querySchemeName)); // face1 and face2 expected
-  receiveInterest(makeInterest(queryIdName)); // face1 expected
-  receiveInterest(makeInterest(queryScopeName)); // face1 and face3 expected
-  receiveInterest(makeInterest(invalidQueryName)); // nack expected
+  receiveInterest(Interest(querySchemeName)); // face1 and face2 expected
+  receiveInterest(Interest(queryIdName)); // face1 expected
+  receiveInterest(Interest(queryScopeName)); // face1 and face3 expected
+  receiveInterest(Interest(invalidQueryName)); // nack expected
 
   BOOST_REQUIRE_EQUAL(m_responses.size(), 4);
 
@@ -311,7 +308,7 @@
     addedChannels[channel->getUri().toString()] = channel;
   }
 
-  receiveInterest(makeInterest("/localhost/nfd/faces/channels"));
+  receiveInterest(Interest("/localhost/nfd/faces/channels"));
 
   Block content;
   BOOST_CHECK_NO_THROW(content = concatenateResponses());
diff --git a/tests/daemon/mgmt/fib-manager.t.cpp b/tests/daemon/mgmt/fib-manager.t.cpp
index 6fc59d1..7c86e28 100644
--- a/tests/daemon/mgmt/fib-manager.t.cpp
+++ b/tests/daemon/mgmt/fib-manager.t.cpp
@@ -158,13 +158,13 @@
 
 BOOST_AUTO_TEST_CASE(UnknownFaceId)
 {
-  auto command = makeControlCommandRequest("/localhost/nfd/fib/add-nexthop",
-                                           makeParameters("hello", face::FACEID_NULL, 101));
-  receiveInterest(command);
+  auto req = makeControlCommandRequest("/localhost/nfd/fib/add-nexthop",
+                                       makeParameters("hello", face::FACEID_NULL, 101));
+  receiveInterest(req);
   BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
 
   // check response
-  BOOST_CHECK_EQUAL(checkResponse(0, command->getName(), ControlResponse(410, "Face not found")),
+  BOOST_CHECK_EQUAL(checkResponse(0, req.getName(), ControlResponse(410, "Face not found")),
                     CheckResponseResult::OK);
 
   // double check that the next hop was not added
@@ -181,14 +181,12 @@
   Name expectedName;
   ControlResponse expectedResponse;
   auto testAddNextHop = [&] (ControlParameters parameters, const FaceId& faceId) {
-    auto command = makeControlCommandRequest("/localhost/nfd/fib/add-nexthop", parameters,
-                   [&faceId] (shared_ptr<Interest> interest) {
-                     interest->setTag(make_shared<lp::IncomingFaceIdTag>(faceId));
-                   });
+    auto req = makeControlCommandRequest("/localhost/nfd/fib/add-nexthop", parameters);
+    req.setTag(make_shared<lp::IncomingFaceIdTag>(faceId));
     m_responses.clear();
-    expectedName = command->getName();
+    expectedName = req.getName();
     expectedResponse = makeResponse(200, "Success", parameters.setFaceId(faceId));
-    receiveInterest(command);
+    receiveInterest(req);
   };
 
   testAddNextHop(ControlParameters().setName("/hello").setCost(100).setFaceId(0), face1);
@@ -208,11 +206,11 @@
   BOOST_REQUIRE_NE(addedFaceId, face::INVALID_FACEID);
 
   auto parameters = makeParameters("hello", addedFaceId, 101);
-  auto command = makeControlCommandRequest("/localhost/nfd/fib/add-nexthop", parameters);
+  auto req = makeControlCommandRequest("/localhost/nfd/fib/add-nexthop", parameters);
+  receiveInterest(req);
 
-  receiveInterest(command);
   BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
-  BOOST_CHECK_EQUAL(checkResponse(0, command->getName(), makeResponse(200, "Success", parameters)),
+  BOOST_CHECK_EQUAL(checkResponse(0, req.getName(), makeResponse(200, "Success", parameters)),
                     CheckResponseResult::OK);
   BOOST_CHECK_EQUAL(checkNextHop("/hello", 1, addedFaceId, 101), CheckNextHopResult::OK);
 }
@@ -224,11 +222,11 @@
 
   auto originalParameters = ControlParameters().setName("/hello").setFaceId(addedFaceId);
   auto parameters = makeParameters("/hello", addedFaceId, 0);
-  auto command = makeControlCommandRequest("/localhost/nfd/fib/add-nexthop", originalParameters);
+  auto req = makeControlCommandRequest("/localhost/nfd/fib/add-nexthop", originalParameters);
+  receiveInterest(req);
 
-  receiveInterest(command);
   BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
-  BOOST_CHECK_EQUAL(checkResponse(0, command->getName(), makeResponse(200, "Success", parameters)),
+  BOOST_CHECK_EQUAL(checkResponse(0, req.getName(), makeResponse(200, "Success", parameters)),
                     CheckResponseResult::OK);
   BOOST_CHECK_EQUAL(checkNextHop("/hello", 1, addedFaceId, 0), CheckNextHopResult::OK);
 }
@@ -242,10 +240,10 @@
   ControlResponse expectedResponse;
   auto testAddNextHop = [&] (const ControlParameters& parameters) {
     m_responses.clear();
-    auto command = makeControlCommandRequest("/localhost/nfd/fib/add-nexthop", parameters);
-    expectedName = command->getName();
+    auto req = makeControlCommandRequest("/localhost/nfd/fib/add-nexthop", parameters);
+    expectedName = req.getName();
     expectedResponse = makeResponse(200, "Success", parameters);
-    receiveInterest(command);
+    receiveInterest(req);
   };
 
   // add initial, succeeds
@@ -273,10 +271,10 @@
   ControlResponse expectedResponse;
   auto testRemoveNextHop = [&] (const ControlParameters& parameters) {
     m_responses.clear();
-    auto command = makeControlCommandRequest("/localhost/nfd/fib/remove-nexthop", parameters);
-    expectedName = command->getName();
+    auto req = makeControlCommandRequest("/localhost/nfd/fib/remove-nexthop", parameters);
+    expectedName = req.getName();
     expectedResponse = makeResponse(200, "Success", parameters);
-    receiveInterest(command);
+    receiveInterest(req);
   };
 
   FaceId face1 = addFace();
@@ -313,12 +311,12 @@
   BOOST_REQUIRE_NE(addedFaceId, face::INVALID_FACEID);
 
   auto parameters = makeParameters("hello", addedFaceId);
-  auto command = makeControlCommandRequest("/localhost/nfd/fib/remove-nexthop", parameters);
-  auto response = makeResponse(200, "Success", parameters);
-
-  receiveInterest(command);
+  auto req = makeControlCommandRequest("/localhost/nfd/fib/remove-nexthop", parameters);
+  receiveInterest(req);
   BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
-  BOOST_CHECK_EQUAL(checkResponse(0, command->getName(), response), CheckResponseResult::OK);
+
+  auto expectedResponse = makeResponse(200, "Success", parameters);
+  BOOST_CHECK_EQUAL(checkResponse(0, req.getName(), expectedResponse), CheckResponseResult::OK);
 }
 
 BOOST_AUTO_TEST_CASE(ImplicitFaceId)
@@ -332,13 +330,11 @@
   ControlResponse expectedResponse;
   auto testWithImplicitFaceId = [&] (ControlParameters parameters, FaceId face) {
     m_responses.clear();
-    auto command = makeControlCommandRequest("/localhost/nfd/fib/remove-nexthop", parameters,
-                   [face] (shared_ptr<Interest> interest) {
-                     interest->setTag(make_shared<lp::IncomingFaceIdTag>(face));
-                   });
-    expectedName = command->getName();
+    auto req = makeControlCommandRequest("/localhost/nfd/fib/remove-nexthop", parameters);
+    req.setTag(make_shared<lp::IncomingFaceIdTag>(face));
+    expectedName = req.getName();
     expectedResponse = makeResponse(200, "Success", parameters.setFaceId(face));
-    receiveInterest(command);
+    receiveInterest(req);
   };
 
   fib::Entry* entry = m_fib.insert("/hello").first;
@@ -367,10 +363,10 @@
   ControlResponse expectedResponse;
   auto testRemoveNextHop = [&] (ControlParameters parameters) {
     m_responses.clear();
-    auto command = makeControlCommandRequest("/localhost/nfd/fib/remove-nexthop", parameters);
-    expectedName = command->getName();
+    auto req = makeControlCommandRequest("/localhost/nfd/fib/remove-nexthop", parameters);
+    expectedName = req.getName();
     expectedResponse = makeResponse(200, "Success", parameters);
-    receiveInterest(command);
+    receiveInterest(req);
   };
 
   m_fib.insert("/hello").first->addNextHop(*m_faceTable.get(face1), 101);
@@ -402,7 +398,7 @@
     fibEntry->addNextHop(*m_faceTable.get(addFace()), std::numeric_limits<uint8_t>::max() - 2);
   }
 
-  receiveInterest(makeInterest("/localhost/nfd/fib/list"));
+  receiveInterest(Interest("/localhost/nfd/fib/list"));
 
   Block content = concatenateResponses();
   content.parse();
diff --git a/tests/daemon/mgmt/forwarder-status-manager.t.cpp b/tests/daemon/mgmt/forwarder-status-manager.t.cpp
index b9cade3..3b30b5c 100644
--- a/tests/daemon/mgmt/forwarder-status-manager.t.cpp
+++ b/tests/daemon/mgmt/forwarder-status-manager.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -70,9 +70,8 @@
 
   // request
   time::system_clock::TimePoint beforeRequest = time::system_clock::now();
-  auto request = makeInterest("ndn:/localhost/nfd/status/general");
-  request->setMustBeFresh(true);
-  request->setChildSelector(1);
+  Interest request("/localhost/nfd/status/general");
+  request.setMustBeFresh(true).setChildSelector(1);
   this->receiveInterest(request);
   time::system_clock::TimePoint afterRequest = time::system_clock::now();
 
diff --git a/tests/daemon/mgmt/nfd-manager-common-fixture.cpp b/tests/daemon/mgmt/nfd-manager-common-fixture.cpp
index 47a1655..f39e983 100644
--- a/tests/daemon/mgmt/nfd-manager-common-fixture.cpp
+++ b/tests/daemon/mgmt/nfd-manager-common-fixture.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -42,7 +42,7 @@
 void
 NfdManagerCommonFixture::setPrivilege(const std::string& privilege)
 {
-  this->saveIdentityCertificate(m_identityName, "ManagerCommonFixture.ndncert");
+  this->saveIdentityCertificate(DEFAULT_COMMAND_SIGNER_IDENTITY, "ManagerCommonFixture.ndncert");
 
   const std::string& config = R"CONFIG(
     authorizations
diff --git a/tests/daemon/mgmt/strategy-choice-manager.t.cpp b/tests/daemon/mgmt/strategy-choice-manager.t.cpp
index 609fc5c..e0933e4 100644
--- a/tests/daemon/mgmt/strategy-choice-manager.t.cpp
+++ b/tests/daemon/mgmt/strategy-choice-manager.t.cpp
@@ -94,7 +94,7 @@
   expectedResp.setCode(200)
               .setText("OK")
               .setBody(expectedParams.wireEncode());
-  BOOST_CHECK_EQUAL(checkResponse(0, req->getName(), expectedResp),
+  BOOST_CHECK_EQUAL(checkResponse(0, req.getName(), expectedResp),
                     CheckResponseResult::OK);
 
   BOOST_CHECK_EQUAL(getInstanceName("/A"), strategyNameP);
@@ -114,7 +114,7 @@
   ControlResponse expectedResp;
   expectedResp.setCode(404)
               .setText("Strategy not registered");
-  BOOST_CHECK_EQUAL(checkResponse(0, req->getName(), expectedResp),
+  BOOST_CHECK_EQUAL(checkResponse(0, req.getName(), expectedResp),
                     CheckResponseResult::OK);
 
   BOOST_CHECK_EQUAL(hasEntry("/A"), false);
@@ -135,7 +135,7 @@
   expectedResp.setCode(200)
               .setText("OK")
               .setBody(expectedParams.wireEncode());
-  BOOST_CHECK_EQUAL(checkResponse(0, req->getName(), expectedResp),
+  BOOST_CHECK_EQUAL(checkResponse(0, req.getName(), expectedResp),
                     CheckResponseResult::OK);
 
   BOOST_CHECK_EQUAL(hasEntry("/A"), false);
@@ -153,7 +153,7 @@
   expectedResp.setCode(200)
               .setText("OK")
               .setBody(expectedParams.wireEncode());
-  BOOST_CHECK_EQUAL(checkResponse(0, req->getName(), expectedResp),
+  BOOST_CHECK_EQUAL(checkResponse(0, req.getName(), expectedResp),
                     CheckResponseResult::OK);
 
   BOOST_CHECK_EQUAL(hasEntry("/A"), false);
@@ -169,7 +169,7 @@
   ControlResponse expectedResp;
   expectedResp.setCode(400)
               .setText("failed in validating parameters");
-  BOOST_CHECK_EQUAL(checkResponse(0, req->getName(), expectedResp),
+  BOOST_CHECK_EQUAL(checkResponse(0, req.getName(), expectedResp),
                     CheckResponseResult::OK);
 
   BOOST_CHECK_EQUAL(hasEntry("/"), true);
@@ -192,7 +192,7 @@
     expected[name] = strategy;
   }
 
-  receiveInterest(makeInterest("/localhost/nfd/strategy-choice/list"));
+  receiveInterest(Interest("/localhost/nfd/strategy-choice/list"));
   Block dataset = concatenateResponses();
   dataset.parse();
   BOOST_CHECK_EQUAL(dataset.elements_size(), expected.size());
