diff --git a/tests/dataset-fixtures.hpp b/tests/dataset-fixtures.hpp
index 1a4e272..0d93347 100644
--- a/tests/dataset-fixtures.hpp
+++ b/tests/dataset-fixtures.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2018, Regents of the University of California.
+/*
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -21,6 +21,7 @@
 #define REPO_TESTS_DATASET_FIXTURES_HPP
 
 #include "identity-management-fixture.hpp"
+
 #include <vector>
 #include <boost/mpl/vector.hpp>
 
@@ -33,11 +34,7 @@
   class Error : public std::runtime_error
   {
   public:
-    explicit
-    Error(const std::string& what)
-      : std::runtime_error(what)
-    {
-    }
+    using std::runtime_error::runtime_error;
   };
 
   using DataContainer = std::list<std::shared_ptr<ndn::Data>>;
@@ -56,11 +53,10 @@
     if (map.count(name) > 0)
       return map[name];
 
-    static std::vector<uint8_t> content(1500, '-');
+    static const std::vector<uint8_t> content(1500, '-');
 
-    std::shared_ptr<ndn::Data> data = std::make_shared<ndn::Data>();
-    data->setName(name);
-    data->setContent(&content[0], content.size());
+    auto data = std::make_shared<ndn::Data>(name);
+    data->setContent(content);
     m_keyChain.sign(*data);
 
     map.insert(std::make_pair(name, data));
@@ -73,7 +69,7 @@
     if (map.count(name) > 0)
       return map[name];
     else
-      BOOST_THROW_EXCEPTION(Error("Data with name " + name.toUri() + " is not found"));
+      NDN_THROW(Error("Data with name " + name.toUri() + " is not found"));
   }
 
 private:
diff --git a/tests/integrated/test-basic-command-insert-delete.cpp b/tests/integrated/test-basic-command-insert-delete.cpp
index 03e9a54..5ed5b9b 100644
--- a/tests/integrated/test-basic-command-insert-delete.cpp
+++ b/tests/integrated/test-basic-command-insert-delete.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2021, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -32,7 +32,6 @@
 #include <ndn-cxx/util/random.hpp>
 #include <ndn-cxx/util/time.hpp>
 
-#include <boost/asio/io_service.hpp>
 #include <boost/mpl/vector.hpp>
 #include <boost/test/unit_test.hpp>
 
@@ -44,7 +43,7 @@
 // All the test cases in this test suite should be run at once.
 BOOST_AUTO_TEST_SUITE(TestBasicCommandInsertDelete)
 
-const static uint8_t content[8] = {3, 1, 4, 1, 5, 9, 2, 6};
+const uint8_t CONTENT[] = {3, 1, 4, 1, 5, 9, 2, 6};
 
 template<class Dataset>
 class Fixture : public CommandFixture, public RepoStorageFixture, public Dataset
@@ -59,7 +58,7 @@
   {
     Name cmdPrefix("/repo/command");
     repoFace.registerPrefix(cmdPrefix, nullptr,
-      [] (const Name& cmdPrefix, const std::string& reason) {
+      [] (const Name&, const std::string& reason) {
         BOOST_FAIL("Command prefix registration error: " << reason);
       });
   }
@@ -113,11 +112,12 @@
   ndn::security::InterestSigner signer;
 };
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::onInsertInterest(const Interest& interest)
 {
   Data data(Name(interest.getName()));
-  data.setContent(content, sizeof(content));
+  data.setContent(CONTENT);
   data.setFreshnessPeriod(0_ms);
   keyChain.sign(data);
   insertFace.put(data);
@@ -126,56 +126,62 @@
     eventIt->second.cancel();
     insertEvents.erase(eventIt);
   }
-  // schedule an event 50ms later to check whether insert is Ok
-  scheduler.schedule(500_ms, std::bind(&Fixture<T>::checkInsertOk, this, interest));
+
+  // schedule an event to check whether insert is ok
+  scheduler.schedule(500_ms, [=] { this->checkInsertOk(interest); });
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::onRegisterFailed(const std::string& reason)
 {
   BOOST_ERROR("ERROR: Failed to register prefix in local hub's daemon" + reason);
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::delayedInterest()
 {
   BOOST_ERROR("Fetching interest does not come. It may be satisfied in CS or something is wrong");
 }
 
-template<class T> void
-Fixture<T>::onInsertData(const Interest& interest, const Data& data)
+template<class T>
+void
+Fixture<T>::onInsertData(const Interest&, const Data& data)
 {
   RepoCommandResponse response;
   response.wireDecode(data.getContent().blockFromValue());
-  int statusCode = response.getCode();
-  BOOST_CHECK_EQUAL(statusCode, 100);
+  BOOST_CHECK_EQUAL(response.getCode(), 100);
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::onDeleteData(const Interest& interest, const Data& data)
 {
   RepoCommandResponse response;
   response.wireDecode(data.getContent().blockFromValue());
-  int statusCode = response.getCode();
-  BOOST_CHECK_EQUAL(statusCode, 200);
+  BOOST_CHECK_EQUAL(response.getCode(), 200);
 
-  //schedlute an event to check whether delete is Ok.
-  scheduler.schedule(100_ms, std::bind(&Fixture<T>::checkDeleteOk, this, interest));
+  // schedule an event to check whether delete is ok
+  scheduler.schedule(100_ms, [=] { this->checkDeleteOk(interest); });
 }
 
-template<class T> void
-Fixture<T>::onInsertTimeout(const Interest& interest)
+template<class T>
+void
+Fixture<T>::onInsertTimeout(const Interest&)
 {
   BOOST_ERROR("Insert command timeout");
 }
 
-template<class T> void
-Fixture<T>::onDeleteTimeout(const Interest& interest)
+template<class T>
+void
+Fixture<T>::onDeleteTimeout(const Interest&)
 {
   BOOST_ERROR("Delete command timeout");
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::sendInsertInterest(const Interest& insertInterest)
 {
   insertFace.expressInterest(insertInterest,
@@ -184,7 +190,8 @@
                              std::bind(&Fixture<T>::onInsertTimeout, this, _1));
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::sendDeleteInterest(const Interest& deleteInterest)
 {
   deleteFace.expressInterest(deleteInterest,
@@ -193,41 +200,43 @@
                              std::bind(&Fixture<T>::onDeleteTimeout, this, _1));
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::checkInsertOk(const Interest& interest)
 {
-  BOOST_TEST_MESSAGE(interest);
-  std::shared_ptr<Data> data = handle->readData(interest);
-  if (data) {
-    int rc = memcmp(data->getContent().value(), content, sizeof(content));
-    BOOST_CHECK_EQUAL(rc, 0);
-  }
-  else {
-    BOOST_ERROR("Check Insert Failed");
+  BOOST_TEST_CONTEXT("Interest " << interest) {
+    auto data = handle->readData(interest);
+    if (data) {
+      BOOST_TEST(data->getContent().value_bytes() == CONTENT, boost::test_tools::per_element());
+    }
+    else {
+      BOOST_ERROR("Insert check failed");
+    }
   }
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::checkDeleteOk(const Interest& interest)
 {
-  std::map<Name, Name>::iterator name = deleteNamePairs.find(interest.getName());
-  BOOST_CHECK_MESSAGE(name != deleteNamePairs.end(), "Delete name not found: " << interest.getName());
-  Interest dataInterest(name->second);
-  std::shared_ptr<Data> data = handle->readData(dataInterest);
+  auto nameIt = deleteNamePairs.find(interest.getName());
+  BOOST_CHECK_MESSAGE(nameIt != deleteNamePairs.end(), "Delete name not found: " << interest.getName());
+  Interest dataInterest(nameIt->second);
+  auto data = handle->readData(dataInterest);
   BOOST_CHECK(!data);
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::scheduleInsertEvent()
 {
   int timeCount = 1;
-  for (typename T::DataContainer::iterator i = this->data.begin();
-       i != this->data.end(); ++i) {
+  for (auto i = this->data.begin(); i != this->data.end(); ++i) {
     Name insertCommandName("/repo/command/insert");
     RepoCommandParameter insertParameter;
     insertParameter.setName(Name((*i)->getName())
                             .appendNumber(ndn::random::generateWord64()));
-    insertCommandName.append(insertParameter.wireEncode());
+    insertCommandName.append(tlv::GenericNameComponent, insertParameter.wireEncode());
     Interest insertInterest = signer.makeCommandInterest(insertCommandName);
     // schedule a job to express insertInterest every 50ms
     scheduler.schedule(milliseconds(timeCount * 50 + 1000),
@@ -245,17 +254,17 @@
   }
 }
 
-template<class T> void
+template<class T>
+void
 Fixture<T>::scheduleDeleteEvent()
 {
   int timeCount = 1;
-  for (typename T::DataContainer::iterator i = this->data.begin();
-       i != this->data.end(); ++i) {
+  for (auto i = this->data.begin(); i != this->data.end(); ++i) {
     Name deleteCommandName("/repo/command/delete");
     RepoCommandParameter deleteParameter;
     deleteParameter.setProcessId(ndn::random::generateWord64());
     deleteParameter.setName((*i)->getName());
-    deleteCommandName.append(deleteParameter.wireEncode());
+    deleteCommandName.append(tlv::GenericNameComponent, deleteParameter.wireEncode());
     Interest deleteInterest = signer.makeCommandInterest(deleteCommandName);
     deleteNamePairs[deleteInterest.getName()] = (*i)->getName();
     scheduler.schedule(milliseconds(4000 + timeCount * 50),
@@ -271,8 +280,8 @@
 BOOST_FIXTURE_TEST_CASE_TEMPLATE(InsertDelete, T, Datasets, Fixture<T>)
 {
   // schedule events
-  this->scheduler.schedule(0_s, std::bind(&Fixture<T>::scheduleInsertEvent, this));
-  this->scheduler.schedule(10_s, std::bind(&Fixture<T>::scheduleDeleteEvent, this));
+  this->scheduler.schedule(0_s,  [this] { this->scheduleInsertEvent(); });
+  this->scheduler.schedule(10_s, [this] { this->scheduleDeleteEvent(); });
 
   this->repoFace.processEvents(30_s);
 }
diff --git a/tests/integrated/test-basic-interest-read.cpp b/tests/integrated/test-basic-interest-read.cpp
index 81ace5b..ab3da01 100644
--- a/tests/integrated/test-basic-interest-read.cpp
+++ b/tests/integrated/test-basic-interest-read.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019, Regents of the University of California.
+ * Copyright (c) 2014-2022, Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -27,17 +27,14 @@
 #include <boost/asio/io_service.hpp>
 #include <boost/test/unit_test.hpp>
 
-#include <ndn-cxx/util/logger.hpp>
 #include <ndn-cxx/util/time.hpp>
 
 namespace repo {
 namespace tests {
 
-NDN_LOG_INIT(repo.tests.read);
+BOOST_AUTO_TEST_SUITE(TestBasicInterestRead)
 
-BOOST_AUTO_TEST_SUITE(TestBasicInerestRead)
-
-const static uint8_t content[8] = {3, 1, 4, 1, 5, 9, 2, 6};
+const uint8_t CONTENT[] = {3, 1, 4, 1, 5, 9, 2, 6};
 
 template<class Dataset>
 class BasicInterestReadFixture : public RepoStorageFixture, public Dataset
@@ -65,17 +62,13 @@
   scheduleReadEvent()
   {
     int timeCount = 1;
-    for (typename Dataset::DataContainer::iterator i = this->data.begin();
-         i != this->data.end(); ++i) {
-      //First insert a data into database;
-      (*i)->setContent(content, sizeof(content));
+    for (auto i = this->data.begin(); i != this->data.end(); ++i) {
+      // First insert a data into database
+      (*i)->setContent(CONTENT);
       (*i)->setFreshnessPeriod(36000_ms);
       keyChain.sign(**i);
-      NDN_LOG_DEBUG(**i);
       bool rc = handle->insertData(**i);
-
       BOOST_CHECK_EQUAL(rc, true);
-      NDN_LOG_DEBUG("Inserted Data " << (**i).getName());
 
       Interest readInterest((*i)->getName());
       readInterest.setMustBeFresh(true);
@@ -86,30 +79,26 @@
   }
 
   void
-  onReadData(const ndn::Interest& interest, const ndn::Data& data)
+  onReadData(const ndn::Interest&, const ndn::Data& data) const
   {
-    int rc = memcmp(data.getContent().value(), content, sizeof(content));
-    BOOST_CHECK_EQUAL(rc, 0);
+    BOOST_TEST(data.getContent().value_bytes() == CONTENT, boost::test_tools::per_element());
   }
 
   void
-  onReadTimeout(const ndn::Interest& interest)
+  onReadTimeout(const ndn::Interest& interest) const
   {
-    NDN_LOG_DEBUG("Timed out " << interest.getName());
-    BOOST_ERROR("Insert or read not successfull");
+    BOOST_ERROR("Read timeout " << interest.getName());
   }
 
   void
-  onReadNack(const ndn::Interest& interest, const ndn::lp::Nack& nack)
+  onReadNack(const ndn::Interest& interest, const ndn::lp::Nack& nack) const
   {
-    NDN_LOG_DEBUG("Nacked " << interest.getName() << nack.getReason());
-    BOOST_ERROR("Read nacked");
+    BOOST_ERROR("Read nack " << interest.getName() << " " << nack.getReason());
   }
 
   void
   sendInterest(const ndn::Interest& interest)
   {
-    NDN_LOG_DEBUG("Sending Interest " << interest.getName());
     readFace.expressInterest(interest,
                              std::bind(&BasicInterestReadFixture::onReadData, this, _1, _2),
                              std::bind(&BasicInterestReadFixture::onReadNack, this, _1, _2),
@@ -124,7 +113,6 @@
   ndn::Face readFace;
 };
 
-
 using Datasets = boost::mpl::vector<BasicDataset,
                                     FetchByPrefixDataset,
                                     SamePrefixDataset<10>>;
@@ -132,7 +120,7 @@
 BOOST_FIXTURE_TEST_CASE_TEMPLATE(Read, T, Datasets, BasicInterestReadFixture<T>)
 {
   this->startListen();
-  this->scheduler.schedule(1_s, std::bind(&BasicInterestReadFixture<T>::scheduleReadEvent, this));
+  this->scheduler.schedule(1_s, [this] { this->scheduleReadEvent(); });
 
   this->repoFace.processEvents(20_s);
 }
diff --git a/tests/unit/read-handle.t.cpp b/tests/unit/read-handle.t.cpp
index 1e22b4e..60a2ee2 100644
--- a/tests/unit/read-handle.t.cpp
+++ b/tests/unit/read-handle.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020,  Regents of the University of California.
+ * Copyright (c) 2014-2022,  Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -86,8 +86,8 @@
   auto data1 = std::make_shared<Data>(Name{dataPrefix}.appendNumber(1));
   auto data2 = std::make_shared<Data>(Name{dataPrefix}.appendNumber(2));
 
-  data1->setContent(&content[0], content.size());
-  data2->setContent(&content[0], content.size());
+  data1->setContent(content);
+  data2->setContent(content);
 
   keyChain.createIdentity(identity);
   keyChain.sign(*data1, ndn::security::SigningInfo(ndn::security::SigningInfo::SIGNER_TYPE_ID,
diff --git a/tests/unit/tcp-bulk-insert-handle.cpp b/tests/unit/tcp-bulk-insert-handle.cpp
index 48d1ae3..da90117 100644
--- a/tests/unit/tcp-bulk-insert-handle.cpp
+++ b/tests/unit/tcp-bulk-insert-handle.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California.
+ * Copyright (c) 2014-2022,  Regents of the University of California.
  *
  * This file is part of NDN repo-ng (Next generation of NDN repository).
  * See AUTHORS.md for complete list of repo-ng authors and contributors.
@@ -101,8 +101,7 @@
     // scatter-gather is limited to at most `min(64,IOV_MAX)` buffers to be transmitted
     // in a single operation
     for (auto i = this->data.begin(); i != this->data.end(); ++i) {
-
-      socket.async_send(boost::asio::buffer((*i)->wireEncode().wire(), (*i)->wireEncode().size()),
+      socket.async_send(boost::asio::buffer((*i)->wireEncode()),
                         std::bind(&TcpBulkInsertFixture::onSendFinished, this, _1, false));
     }
     onSendFinished(error, true);
@@ -148,7 +147,6 @@
   repo::TcpBulkInsertHandle bulkInserter;
 };
 
-
 BOOST_FIXTURE_TEST_CASE_TEMPLATE(BulkInsertAndRead, T, CommonDatasets, TcpBulkInsertFixture<T>)
 {
   BOOST_TEST_MESSAGE(T::getName());
