interest: declare default CanBePrefix setting

refs #4581

Change-Id: I82de3b13c3010242fa7999a2564d4a5442dfd14b
diff --git a/tests/unit-tests/face.t.cpp b/tests/unit-tests/face.t.cpp
index 2412c66..3f2b82a 100644
--- a/tests/unit-tests/face.t.cpp
+++ b/tests/unit-tests/face.t.cpp
@@ -27,9 +27,9 @@
 #include "util/scheduler.hpp"
 
 #include "boost-test.hpp"
+#include "make-interest-data.hpp"
 #include "identity-management-time-fixture.hpp"
 #include "test-home-fixture.hpp"
-#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace tests {
@@ -65,7 +65,7 @@
 BOOST_AUTO_TEST_CASE(ExpressInterestData)
 {
   size_t nData = 0;
-  face.expressInterest(Interest("/Hello/World", 50_ms),
+  face.expressInterest(*makeInterest("/Hello/World", true, 50_ms),
                        [&] (const Interest& i, const Data& d) {
                          BOOST_CHECK(i.getName().isPrefixOf(d.getName()));
                          BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
@@ -86,7 +86,7 @@
   BOOST_CHECK_EQUAL(face.sentData.size(), 0);
 
   size_t nTimeouts = 0;
-  face.expressInterest(Interest("/Hello/World/a/2", 50_ms),
+  face.expressInterest(*makeInterest("/Hello/World/a/2", false, 50_ms),
                        bind([]{}),
                        bind([]{}),
                        bind([&nTimeouts] { ++nTimeouts; }));
@@ -98,14 +98,14 @@
 {
   size_t nData = 0;
 
-  face.expressInterest(Interest("/Hello/World", 50_ms),
+  face.expressInterest(*makeInterest("/Hello/World", true, 50_ms),
                        [&] (const Interest& i, const Data& d) {
                          ++nData;
                        },
                        bind([] { BOOST_FAIL("Unexpected Nack"); }),
                        bind([] { BOOST_FAIL("Unexpected timeout"); }));
 
-  face.expressInterest(Interest("/Hello/World/a", 50_ms),
+  face.expressInterest(*makeInterest("/Hello/World/a", true, 50_ms),
                        [&] (const Interest& i, const Data& d) {
                          ++nData;
                        },
@@ -125,7 +125,7 @@
 
 BOOST_AUTO_TEST_CASE(ExpressInterestEmptyDataCallback)
 {
-  face.expressInterest(Interest("/Hello/World"),
+  face.expressInterest(*makeInterest("/Hello/World", true),
                        nullptr,
                        bind([] { BOOST_FAIL("Unexpected Nack"); }),
                        bind([] { BOOST_FAIL("Unexpected timeout"); }));
@@ -140,7 +140,7 @@
 BOOST_AUTO_TEST_CASE(ExpressInterestTimeout)
 {
   size_t nTimeouts = 0;
-  face.expressInterest(Interest("/Hello/World", 50_ms),
+  face.expressInterest(*makeInterest("/Hello/World", false, 50_ms),
                        bind([] { BOOST_FAIL("Unexpected Data"); }),
                        bind([] { BOOST_FAIL("Unexpected Nack"); }),
                        [&nTimeouts] (const Interest& i) {
@@ -158,7 +158,7 @@
 
 BOOST_AUTO_TEST_CASE(ExpressInterestEmptyTimeoutCallback)
 {
-  face.expressInterest(Interest("/Hello/World", 50_ms),
+  face.expressInterest(*makeInterest("/Hello/World", false, 50_ms),
                        bind([] { BOOST_FAIL("Unexpected Data"); }),
                        bind([] { BOOST_FAIL("Unexpected Nack"); }),
                        nullptr);
@@ -173,9 +173,9 @@
 {
   size_t nNacks = 0;
 
-  Interest interest("/Hello/World", 50_ms);
+  auto interest = makeInterest("/Hello/World", false, 50_ms);
 
-  face.expressInterest(interest,
+  face.expressInterest(*interest,
                        bind([] { BOOST_FAIL("Unexpected Data"); }),
                        [&] (const Interest& i, const lp::Nack& n) {
                          BOOST_CHECK(i.getName().isPrefixOf(n.getInterest().getName()));
@@ -199,18 +199,16 @@
 {
   size_t nNacks = 0;
 
-  Interest interest("/Hello/World", 50_ms);
-  interest.setNonce(1);
-
-  face.expressInterest(interest,
+  auto interest = makeInterest("/Hello/World", false, 50_ms, 1);
+  face.expressInterest(*interest,
                        bind([] { BOOST_FAIL("Unexpected Data"); }),
                        [&] (const Interest& i, const lp::Nack& n) {
                          ++nNacks;
                        },
                        bind([] { BOOST_FAIL("Unexpected timeout"); }));
 
-  interest.setNonce(2);
-  face.expressInterest(interest,
+  interest->setNonce(2);
+  face.expressInterest(*interest,
                        bind([] { BOOST_FAIL("Unexpected Data"); }),
                        [&] (const Interest& i, const lp::Nack& n) {
                          ++nNacks;
@@ -229,7 +227,7 @@
 
 BOOST_AUTO_TEST_CASE(ExpressInterestEmptyNackCallback)
 {
-  face.expressInterest(Interest("/Hello/World"),
+  face.expressInterest(*makeInterest("/Hello/World"),
                        bind([] { BOOST_FAIL("Unexpected Data"); }),
                        nullptr,
                        bind([] { BOOST_FAIL("Unexpected timeout"); }));
@@ -244,7 +242,7 @@
 BOOST_AUTO_TEST_CASE(RemovePendingInterest)
 {
   const PendingInterestId* interestId =
-    face.expressInterest(Interest("/Hello/World", 50_ms),
+    face.expressInterest(*makeInterest("/Hello/World", true, 50_ms),
                          bind([] { BOOST_FAIL("Unexpected data"); }),
                          bind([] { BOOST_FAIL("Unexpected nack"); }),
                          bind([] { BOOST_FAIL("Unexpected timeout"); }));
@@ -262,12 +260,12 @@
 
 BOOST_AUTO_TEST_CASE(RemoveAllPendingInterests)
 {
-  face.expressInterest(Interest("/Hello/World/0", 50_ms),
+  face.expressInterest(*makeInterest("/Hello/World/0", false, 50_ms),
                        bind([] { BOOST_FAIL("Unexpected data"); }),
                        bind([] { BOOST_FAIL("Unexpected nack"); }),
                        bind([] { BOOST_FAIL("Unexpected timeout"); }));
 
-  face.expressInterest(Interest("/Hello/World/1", 50_ms),
+  face.expressInterest(*makeInterest("/Hello/World/1", false, 50_ms),
                        bind([] { BOOST_FAIL("Unexpected data"); }),
                        bind([] { BOOST_FAIL("Unexpected nack"); }),
                        bind([] { BOOST_FAIL("Unexpected timeout"); }));
@@ -288,7 +286,7 @@
 {
   {
     DummyClientFace face2(io, m_keyChain);
-    face2.expressInterest(Interest("/Hello/World", 50_ms),
+    face2.expressInterest(*makeInterest("/Hello/World", false, 50_ms),
                           nullptr, nullptr, nullptr);
     advanceClocks(50_ms, 2);
   }
@@ -301,14 +299,14 @@
 
 BOOST_AUTO_TEST_CASE(DataCallbackPutData) // Bug 4596
 {
-  face.expressInterest(Interest("/localhost/notification/1"),
+  face.expressInterest(*makeInterest("/localhost/notification/1"),
                        [&] (const Interest& i, const Data& d) {
                          face.put(*makeData("/chronosync/sampleDigest/1"));
                        }, nullptr, nullptr);
   advanceClocks(10_ms);
   BOOST_CHECK_EQUAL(face.sentInterests.back().getName(), "/localhost/notification/1");
 
-  face.receive(Interest("/chronosync/sampleDigest"));
+  face.receive(*makeInterest("/chronosync/sampleDigest", true));
   advanceClocks(10_ms);
 
   face.put(*makeData("/localhost/notification/1"));
@@ -355,7 +353,7 @@
   face.setInterestFilter(InterestFilter("/").allowLoopback(false),
     bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
 
-  face.expressInterest(Interest("/A"),
+  face.expressInterest(*makeInterest("/A", true),
                        bind([&] { hasData = true; }),
                        bind([] { BOOST_FAIL("Unexpected nack"); }),
                        bind([] { BOOST_FAIL("Unexpected timeout"); }));
@@ -382,7 +380,7 @@
   face.setInterestFilter("/", bind([]{}));
   advanceClocks(10_ms);
 
-  face.receive(*makeInterest("/A"));
+  face.receive(*makeInterest("/A", true));
   advanceClocks(10_ms);
   BOOST_CHECK(hasInterest1);
   BOOST_CHECK_EQUAL(face.sentData.size(), 1);
@@ -399,21 +397,24 @@
 
   BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
 
-  face.put(makeNack("/unsolicited", 18645250, lp::NackReason::NO_ROUTE));
+  face.put(makeNack(*makeInterest("/unsolicited", false, DEFAULT_INTEREST_LIFETIME, 18645250),
+                    lp::NackReason::NO_ROUTE));
   advanceClocks(10_ms);
   BOOST_CHECK_EQUAL(face.sentNacks.size(), 0); // unsolicited Nack would not be sent
 
-  face.receive(*makeInterest("/Hello/World", 14247162));
-  face.receive(*makeInterest("/another/prefix", 92203002));
+  auto interest1 = makeInterest("/Hello/World", false, DEFAULT_INTEREST_LIFETIME, 14247162);
+  face.receive(*interest1);
+  auto interest2 = makeInterest("/another/prefix", false, DEFAULT_INTEREST_LIFETIME, 92203002);
+  face.receive(*interest2);
   advanceClocks(10_ms);
 
-  face.put(makeNack("/Hello/World", 14247162, lp::NackReason::DUPLICATE));
+  face.put(makeNack(*interest1, lp::NackReason::DUPLICATE));
   advanceClocks(10_ms);
   BOOST_REQUIRE_EQUAL(face.sentNacks.size(), 1);
   BOOST_CHECK_EQUAL(face.sentNacks[0].getReason(), lp::NackReason::DUPLICATE);
   BOOST_CHECK(face.sentNacks[0].getTag<lp::CongestionMarkTag>() == nullptr);
 
-  auto nack = makeNack("/another/prefix", 92203002, lp::NackReason::NO_ROUTE);
+  auto nack = makeNack(*interest2, lp::NackReason::NO_ROUTE);
   nack.setTag(make_shared<lp::CongestionMarkTag>(1));
   face.put(nack);
   advanceClocks(10_ms);
@@ -434,7 +435,8 @@
   face.setInterestFilter("/", bind([&] { hasInterest2 = true; }));
   advanceClocks(10_ms);
 
-  face.receive(*makeInterest("/A", 14333271));
+  auto interest = makeInterest("/A", false, DEFAULT_INTEREST_LIFETIME, 14333271);
+  face.receive(*interest);
   advanceClocks(10_ms);
   BOOST_CHECK(hasInterest1);
   BOOST_CHECK(hasInterest2);
@@ -442,12 +444,12 @@
   // Nack from first destination is received, should wait for a response from the other destination
   BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
 
-  face.put(makeNack("/A", 14333271, lp::NackReason::NO_ROUTE)); // Nack from second destination
+  face.put(makeNack(*interest, lp::NackReason::NO_ROUTE)); // Nack from second destination
   advanceClocks(10_ms);
   BOOST_CHECK_EQUAL(face.sentNacks.size(), 1); // sending Nack after both destinations Nacked
   BOOST_CHECK_EQUAL(face.sentNacks.at(0).getReason(), lp::NackReason::CONGESTION); // least severe reason
 
-  face.put(makeNack("/A", 14333271, lp::NackReason::DUPLICATE));
+  face.put(makeNack(*interest, lp::NackReason::DUPLICATE));
   BOOST_CHECK_EQUAL(face.sentNacks.size(), 1); // additional Nacks are ignored
 }
 
@@ -464,7 +466,8 @@
   face.setInterestFilter(InterestFilter("/").allowLoopback(false),
     bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
 
-  face.expressInterest(*makeInterest("/A", 28395852),
+  auto interest = makeInterest("/A", false, DEFAULT_INTEREST_LIFETIME, 28395852);
+  face.expressInterest(*interest,
                        bind([] { BOOST_FAIL("Unexpected data"); }),
                        [&] (const Interest&, const lp::Nack& nack) {
                          hasNack = true;
@@ -476,7 +479,7 @@
   BOOST_CHECK_EQUAL(face.sentInterests.size(), 1); // Interest sent to forwarder
   BOOST_CHECK_EQUAL(hasNack, false); // waiting for Nack from forwarder
 
-  face.receive(makeNack("/A", 28395852, lp::NackReason::NO_ROUTE));
+  face.receive(makeNack(*interest, lp::NackReason::NO_ROUTE));
   advanceClocks(1_ms);
   BOOST_CHECK_EQUAL(hasNack, true);
 }
@@ -494,17 +497,17 @@
   BOOST_CHECK_EQUAL(nRegs, 1);
   BOOST_CHECK_EQUAL(nInterests, 0);
 
-  face.receive(Interest("/Hello/World/%21"));
+  face.receive(*makeInterest("/Hello/World/%21"));
   advanceClocks(25_ms, 4);
 
   BOOST_CHECK_EQUAL(nRegs, 1);
   BOOST_CHECK_EQUAL(nInterests, 1);
 
-  face.receive(Interest("/Bye/World/%21"));
+  face.receive(*makeInterest("/Bye/World/%21"));
   advanceClocks(10000_ms, 10);
   BOOST_CHECK_EQUAL(nInterests, 1);
 
-  face.receive(Interest("/Hello/World/%21/2"));
+  face.receive(*makeInterest("/Hello/World/%21/2"));
   advanceClocks(25_ms, 4);
   BOOST_CHECK_EQUAL(nInterests, 2);
 
@@ -512,7 +515,7 @@
   face.unsetInterestFilter(regPrefixId);
   advanceClocks(25_ms, 4);
 
-  face.receive(Interest("/Hello/World/%21/3"));
+  face.receive(*makeInterest("/Hello/World/%21/3"));
   BOOST_CHECK_EQUAL(nInterests, 2);
 
   face.unsetInterestFilter(static_cast<const RegisteredPrefixId*>(nullptr));
@@ -543,16 +546,16 @@
   advanceClocks(25_ms, 4);
   BOOST_CHECK_EQUAL(nInterests, 0);
 
-  face.receive(Interest("/Hello/World/%21"));
+  face.receive(*makeInterest("/Hello/World/%21"));
   advanceClocks(25_ms, 4);
 
   BOOST_CHECK_EQUAL(nInterests, 1);
 
-  face.receive(Interest("/Bye/World/%21"));
+  face.receive(*makeInterest("/Bye/World/%21"));
   advanceClocks(10000_ms, 10);
   BOOST_CHECK_EQUAL(nInterests, 1);
 
-  face.receive(Interest("/Hello/World/%21/2"));
+  face.receive(*makeInterest("/Hello/World/%21/2"));
   advanceClocks(25_ms, 4);
   BOOST_CHECK_EQUAL(nInterests, 2);
 
@@ -560,7 +563,7 @@
   face.unsetInterestFilter(regPrefixId);
   advanceClocks(25_ms, 4);
 
-  face.receive(Interest("/Hello/World/%21/3"));
+  face.receive(*makeInterest("/Hello/World/%21/3"));
   BOOST_CHECK_EQUAL(nInterests, 2);
 
   face.unsetInterestFilter(static_cast<const RegisteredPrefixId*>(nullptr));
@@ -655,7 +658,7 @@
 
   advanceClocks(25_ms, 4);
 
-  face.receive(Interest("/Hello/World/%21"));
+  face.receive(*makeInterest("/Hello/World/%21"));
   advanceClocks(25_ms, 4);
 
   BOOST_CHECK_EQUAL(nInInterests1, 1);
@@ -674,7 +677,7 @@
 
   advanceClocks(25_ms, 4);
 
-  BOOST_REQUIRE_THROW(face.receive(Interest("/Hello/World/XXX/b/c")), InterestFilter::Error);
+  BOOST_REQUIRE_THROW(face.receive(*makeInterest("/Hello/World/XXX/b/c")), InterestFilter::Error);
 }
 
 BOOST_AUTO_TEST_CASE(SetRegexFilter)
@@ -687,16 +690,16 @@
 
   advanceClocks(25_ms, 4);
 
-  face.receive(Interest("/Hello/World/a"));     // shouldn't match
+  face.receive(*makeInterest("/Hello/World/a"));     // shouldn't match
   BOOST_CHECK_EQUAL(nInInterests, 0);
 
-  face.receive(Interest("/Hello/World/a/b"));   // should match
+  face.receive(*makeInterest("/Hello/World/a/b"));   // should match
   BOOST_CHECK_EQUAL(nInInterests, 1);
 
-  face.receive(Interest("/Hello/World/a/b/c")); // should match
+  face.receive(*makeInterest("/Hello/World/a/b/c")); // should match
   BOOST_CHECK_EQUAL(nInInterests, 2);
 
-  face.receive(Interest("/Hello/World/a/b/d")); // should not match
+  face.receive(*makeInterest("/Hello/World/a/b/d")); // should not match
   BOOST_CHECK_EQUAL(nInInterests, 2);
 }
 
@@ -714,16 +717,16 @@
   advanceClocks(25_ms, 4);
   BOOST_CHECK_EQUAL(nRegSuccesses, 1);
 
-  face.receive(Interest("/Hello/World/a")); // shouldn't match
+  face.receive(*makeInterest("/Hello/World/a")); // shouldn't match
   BOOST_CHECK_EQUAL(nInInterests, 0);
 
-  face.receive(Interest("/Hello/World/a/b")); // should match
+  face.receive(*makeInterest("/Hello/World/a/b")); // should match
   BOOST_CHECK_EQUAL(nInInterests, 1);
 
-  face.receive(Interest("/Hello/World/a/b/c")); // should match
+  face.receive(*makeInterest("/Hello/World/a/b/c")); // should match
   BOOST_CHECK_EQUAL(nInInterests, 2);
 
-  face.receive(Interest("/Hello/World/a/b/d")); // should not match
+  face.receive(*makeInterest("/Hello/World/a/b/d")); // should not match
   BOOST_CHECK_EQUAL(nInInterests, 2);
 }
 
@@ -736,8 +739,7 @@
   face.setInterestFilter(Name("/"), bind([&hit] { ++hit; }));
   face.processEvents(time::milliseconds(-1));
 
-  auto interest = make_shared<Interest>("/A");
-  face.receive(*interest);
+  face.receive(*makeInterest("/A"));
   face.processEvents(time::milliseconds(-1));
 
   BOOST_CHECK_EQUAL(hit, 1);
diff --git a/tests/unit-tests/ims/in-memory-storage.t.cpp b/tests/unit-tests/ims/in-memory-storage.t.cpp
index 0cec78a..2304889 100644
--- a/tests/unit-tests/ims/in-memory-storage.t.cpp
+++ b/tests/unit-tests/ims/in-memory-storage.t.cpp
@@ -436,16 +436,18 @@
   shared_ptr<Data> data7 = makeData("/c/n");
   ims.insert(*data7);
 
-  shared_ptr<Interest> interest = makeInterest("/c");
+  shared_ptr<Interest> interest = makeInterest("/c", true);
   interest->setChildSelector(1);
 
   shared_ptr<const Data> found = ims.find(*interest);
+  BOOST_REQUIRE(found != nullptr);
   BOOST_CHECK_EQUAL(found->getName(), "/c/n");
 
-  shared_ptr<Interest> interest2 = makeInterest("/c");
+  shared_ptr<Interest> interest2 = makeInterest("/c", true);
   interest2->setChildSelector(0);
 
   shared_ptr<const Data> found2 = ims.find(*interest2);
+  BOOST_REQUIRE(found2 != nullptr);
   BOOST_CHECK_EQUAL(found2->getName(), "/c/c");
 }
 
@@ -465,10 +467,11 @@
   shared_ptr<Data> data4 = makeData("/a/z/2");
   ims.insert(*data4);
 
-  shared_ptr<Interest> interest = makeInterest("/a");
+  shared_ptr<Interest> interest = makeInterest("/a", true);
   interest->setChildSelector(1);
 
   shared_ptr<const Data> found = ims.find(*interest);
+  BOOST_REQUIRE(found != nullptr);
   BOOST_CHECK_EQUAL(found->getName(), "/a/z/1");
 }
 
@@ -544,18 +547,20 @@
   shared_ptr<Data> data8 = makeData("/c/c/1");
   ims.insert(*data8);
 
-  shared_ptr<Interest> interest = makeInterest("/c/c");
+  shared_ptr<Interest> interest = makeInterest("/c/c", true);
   interest->setMinSuffixComponents(3);
   interest->setChildSelector(0);
 
   shared_ptr<const Data> found = ims.find(*interest);
+  BOOST_REQUIRE(found != nullptr);
   BOOST_CHECK_EQUAL(found->getName(), "/c/c/1/2/3");
 
-  shared_ptr<Interest> interest2 = makeInterest("/c/c");
+  shared_ptr<Interest> interest2 = makeInterest("/c/c", true);
   interest2->setMinSuffixComponents(4);
   interest2->setChildSelector(1);
 
   shared_ptr<const Data> found2 = ims.find(*interest2);
+  BOOST_REQUIRE(found2 != nullptr);
   BOOST_CHECK_EQUAL(found2->getName(), "/c/c/6/7/8/9");
 
   shared_ptr<Interest> interest3 = makeInterest("/c/c");
@@ -563,6 +568,7 @@
   interest3->setChildSelector(1);
 
   shared_ptr<const Data> found3 = ims.find(*interest3);
+  BOOST_REQUIRE(found3 != nullptr);
   BOOST_CHECK_EQUAL(found3->getName(), "/c/c/1");
 }
 
@@ -591,33 +597,34 @@
   shared_ptr<Data> data7 = makeData("/c/n");
   ims.insert(*data7);
 
-  shared_ptr<Interest> interest = makeInterest("/c");
+  shared_ptr<Interest> interest = makeInterest("/c", true);
   interest->setChildSelector(1);
   Exclude e;
-  e.excludeOne (Name::Component("n"));
+  e.excludeOne(Name::Component("n"));
   interest->setExclude(e);
 
   shared_ptr<const Data> found = ims.find(*interest);
+  BOOST_REQUIRE(found != nullptr);
   BOOST_CHECK_EQUAL(found->getName(), "/c/f");
 
-  shared_ptr<Interest> interest2 = makeInterest("/c");
+  shared_ptr<Interest> interest2 = makeInterest("/c", true);
   interest2->setChildSelector(0);
-
   Exclude e2;
-  e2.excludeOne (Name::Component("a"));
+  e2.excludeOne(Name::Component("a"));
   interest2->setExclude(e2);
 
   shared_ptr<const Data> found2 = ims.find(*interest2);
+  BOOST_REQUIRE(found2 != nullptr);
   BOOST_CHECK_EQUAL(found2->getName(), "/c/c");
 
-  shared_ptr<Interest> interest3 = makeInterest("/c");
+  shared_ptr<Interest> interest3 = makeInterest("/c", true);
   interest3->setChildSelector(0);
-
   Exclude e3;
-  e3.excludeOne (Name::Component("c"));
+  e3.excludeOne(Name::Component("c"));
   interest3->setExclude(e3);
 
   shared_ptr<const Data> found3 = ims.find(*interest3);
+  BOOST_REQUIRE(found3 != nullptr);
   BOOST_CHECK_EQUAL(found3->getName(), "/c/a");
 }
 
@@ -642,11 +649,9 @@
 BOOST_AUTO_TEST_CASE_TEMPLATE(GetLimit, T, InMemoryStoragesLimited)
 {
   T ims(10000);
-
   BOOST_CHECK_EQUAL(ims.getLimit(), 10000);
 
   T ims2(4);
-
   BOOST_CHECK_EQUAL(ims2.getLimit(), 4);
 }
 
@@ -665,7 +670,6 @@
   }
 
   BOOST_CHECK_EQUAL(ims.size(), 11);
-
   BOOST_CHECK_EQUAL(ims.getCapacity(), 20);
 }
 
@@ -718,7 +722,7 @@
   Interest&
   startInterest(const Name& name)
   {
-    m_interest = makeInterest(name);
+    m_interest = makeInterest(name, true);
     return *m_interest;
   }
 
diff --git a/tests/unit-tests/interest-filter.t.cpp b/tests/unit-tests/interest-filter.t.cpp
index 157fa05..96f4ae9 100644
--- a/tests/unit-tests/interest-filter.t.cpp
+++ b/tests/unit-tests/interest-filter.t.cpp
@@ -27,6 +27,7 @@
 #include "util/dummy-client-face.hpp"
 
 #include "boost-test.hpp"
+#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace tests {
@@ -58,7 +59,7 @@
   face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
     [] (const Name&, const Interest&) { BOOST_ERROR("unexpected Interest"); });
   face.processEvents(1_ms);
-  BOOST_CHECK_THROW(face.receive(Interest("/Hello/World/a/b/c")), InterestFilter::Error);
+  BOOST_CHECK_THROW(face.receive(*makeInterest("/Hello/World/a/b/c")), InterestFilter::Error);
 }
 
 BOOST_AUTO_TEST_CASE(AllowLoopback)
diff --git a/tests/unit-tests/interest.t.cpp b/tests/unit-tests/interest.t.cpp
index f1e79dc..bf2389f 100644
--- a/tests/unit-tests/interest.t.cpp
+++ b/tests/unit-tests/interest.t.cpp
@@ -61,6 +61,7 @@
   };
 
   Interest i1("/local/ndn/prefix");
+  i1.setCanBePrefix(true);
   i1.setNonce(1);
   Block wire1 = i1.wireEncode();
   BOOST_CHECK_EQUAL_COLLECTIONS(wire1.begin(), wire1.end(), WIRE, WIRE + sizeof(WIRE));
@@ -96,6 +97,7 @@
 
   Interest i1;
   i1.setName("/local/ndn/prefix");
+  i1.setCanBePrefix(true);
   i1.setMinSuffixComponents(1);
   i1.setNonce(1);
   i1.setInterestLifetime(1000_ms);
@@ -395,6 +397,7 @@
 BOOST_AUTO_TEST_CASE(ModifyForwardingHint)
 {
   Interest i;
+  i.setCanBePrefix(false);
   i.setForwardingHint({{1, "/A"}});
   i.wireEncode();
   BOOST_CHECK(i.hasWire());
@@ -431,6 +434,7 @@
 BOOST_AUTO_TEST_CASE(SetNonce)
 {
   Interest i1("/A");
+  i1.setCanBePrefix(false);
   i1.setNonce(1);
   i1.wireEncode();
   BOOST_CHECK_EQUAL(i1.getNonce(), 1);
diff --git a/tests/unit-tests/mgmt/dispatcher.t.cpp b/tests/unit-tests/mgmt/dispatcher.t.cpp
index 69f389d..c75af4d 100644
--- a/tests/unit-tests/mgmt/dispatcher.t.cpp
+++ b/tests/unit-tests/mgmt/dispatcher.t.cpp
@@ -361,7 +361,7 @@
 
   face.sentData.clear();
 
-  auto interestSmall = *makeInterest("/root/test/small/valid");
+  auto interestSmall = *makeInterest("/root/test/small/valid", true);
   face.receive(interestSmall);
   advanceClocks(1_ms, 10);
 
diff --git a/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp b/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
index a819279..2f90302 100644
--- a/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
+++ b/tests/unit-tests/security/signature-sha256-with-ecdsa.t.cpp
@@ -25,6 +25,7 @@
 
 #include "boost-test.hpp"
 #include "../identity-management-time-fixture.hpp"
+#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace security {
@@ -124,21 +125,21 @@
 {
   Identity identity = addIdentity("/SecurityTestSignatureSha256WithEcdsa/InterestSignature", EcKeyParams());
 
-  Interest interest("/SecurityTestSignatureSha256WithEcdsa/InterestSignature/Interest1");
-  Interest interest11("/SecurityTestSignatureSha256WithEcdsa/InterestSignature/Interest1");
+  auto interest = makeInterest("/SecurityTestSignatureSha256WithEcdsa/InterestSignature/Interest1");
+  auto interest11 = makeInterest("/SecurityTestSignatureSha256WithEcdsa/InterestSignature/Interest1");
 
   scheduler.scheduleEvent(100_ms, [&] {
-      BOOST_CHECK_NO_THROW(m_keyChain.sign(interest, security::SigningInfo(identity)));
+      m_keyChain.sign(*interest, security::SigningInfo(identity));
     });
 
   advanceClocks(100_ms);
   scheduler.scheduleEvent(100_ms, [&] {
-      BOOST_CHECK_NO_THROW(m_keyChain.sign(interest11, security::SigningInfo(identity)));
+      m_keyChain.sign(*interest11, security::SigningInfo(identity));
     });
 
   advanceClocks(100_ms);
 
-  Block interestBlock(interest.wireEncode().wire(), interest.wireEncode().size());
+  Block interestBlock(interest->wireEncode().wire(), interest->wireEncode().size());
 
   Interest interest2;
   interest2.wireDecode(interestBlock);
diff --git a/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp b/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
index 86dbb37..7de3774 100644
--- a/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
+++ b/tests/unit-tests/security/signature-sha256-with-rsa.t.cpp
@@ -25,6 +25,7 @@
 
 #include "boost-test.hpp"
 #include "../identity-management-time-fixture.hpp"
+#include "make-interest-data.hpp"
 
 namespace ndn {
 namespace security {
@@ -129,21 +130,21 @@
 {
   Identity identity = addIdentity("/SecurityTestSignatureSha256WithRsa/InterestSignature", RsaKeyParams());
 
-  Interest interest("/SecurityTestSignatureSha256WithRsa/InterestSignature/Interest1");
-  Interest interest11("/SecurityTestSignatureSha256WithRsa/InterestSignature/Interest1");
+  auto interest = makeInterest("/SecurityTestSignatureSha256WithRsa/InterestSignature/Interest1");
+  auto interest11 = makeInterest("/SecurityTestSignatureSha256WithRsa/InterestSignature/Interest1");
 
   scheduler.scheduleEvent(100_ms, [&] {
-      BOOST_CHECK_NO_THROW(m_keyChain.sign(interest, security::SigningInfo(identity)));
+      m_keyChain.sign(*interest, security::SigningInfo(identity));
     });
 
   advanceClocks(100_ms);
   scheduler.scheduleEvent(100_ms, [&] {
-      BOOST_CHECK_NO_THROW(m_keyChain.sign(interest11, security::SigningInfo(identity)));
+      m_keyChain.sign(*interest11, security::SigningInfo(identity));
     });
 
   advanceClocks(100_ms);
 
-  Block interestBlock(interest.wireEncode().wire(), interest.wireEncode().size());
+  Block interestBlock(interest->wireEncode().wire(), interest->wireEncode().size());
 
   Interest interest2;
   interest2.wireDecode(interestBlock);
diff --git a/tests/unit-tests/util/dummy-client-face.t.cpp b/tests/unit-tests/util/dummy-client-face.t.cpp
index 5308e28..aed8cd6 100644
--- a/tests/unit-tests/util/dummy-client-face.t.cpp
+++ b/tests/unit-tests/util/dummy-client-face.t.cpp
@@ -29,6 +29,8 @@
 namespace util {
 namespace tests {
 
+using namespace ndn::tests;
+
 BOOST_AUTO_TEST_SUITE(Util)
 BOOST_FIXTURE_TEST_SUITE(TestDummyClientFace, ndn::tests::IdentityManagementTimeFixture)
 
@@ -71,12 +73,12 @@
 
   int nFace1Data = 0;
   int nFace2Nack = 0;
-  face1.expressInterest(Interest("/face2/data"),
+  face1.expressInterest(*makeInterest("/face2/data"),
                         [&] (const Interest& i, const Data& d) {
                           BOOST_CHECK_EQUAL(d.getName().toUri(), "/face2/data");
                           nFace1Data++;
                         }, nullptr, nullptr);
-  face2.expressInterest(Interest("/face1/data"),
+  face2.expressInterest(*makeInterest("/face1/data"),
                         [&] (const Interest& i, const Data& d) {
                           BOOST_CHECK(false);
                         },