diff --git a/tests/core/segment-publisher.t.cpp b/tests/core/segment-publisher.t.cpp
index b72c198..4223d19 100644
--- a/tests/core/segment-publisher.t.cpp
+++ b/tests/core/segment-publisher.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  Regents of the University of California,
+ * Copyright (c) 2014-2016,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -27,6 +27,7 @@
 #include <ndn-cxx/encoding/tlv.hpp>
 
 #include "tests/test-common.hpp"
+#include "tests/identity-management-fixture.hpp"
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
 namespace nfd {
@@ -39,9 +40,9 @@
 {
 public:
   SegmentPublisherTester(ndn::util::DummyClientFace& face,
-                       const Name& prefix,
-                       ndn::KeyChain& keyChain,
-                       const time::milliseconds freshnessPeriod)
+                         const Name& prefix,
+                         ndn::KeyChain& keyChain,
+                         const time::milliseconds freshnessPeriod)
     : SegmentPublisher(face, prefix, keyChain, freshnessPeriod)
     , m_totalPayloadLength(0)
   {
@@ -49,9 +50,7 @@
   }
 
   virtual
-  ~SegmentPublisherTester()
-  {
-  }
+  ~SegmentPublisherTester() = default;
 
   uint16_t
   getLimit() const
@@ -71,10 +70,9 @@
   generate(ndn::EncodingBuffer& outBuffer)
   {
     size_t totalLength = 0;
-    for (int64_t i = 0; i < N; i++)
-      {
-        totalLength += prependNonNegativeIntegerBlock(outBuffer, tlv::Content, i);
-      }
+    for (int64_t i = 0; i < N; ++i) {
+      totalLength += prependNonNegativeIntegerBlock(outBuffer, tlv::Content, i);
+    }
     m_totalPayloadLength += totalLength;
     return totalLength;
   }
@@ -84,13 +82,13 @@
 };
 
 template<int64_t N>
-class SegmentPublisherFixture : public BaseFixture
+class SegmentPublisherFixture : public IdentityManagementFixture
 {
 public:
   SegmentPublisherFixture()
-    : m_face(ndn::util::makeDummyClientFace())
+    : m_face(m_keyChain)
     , m_expectedFreshnessPeriod(time::milliseconds(111))
-    , m_publisher(*m_face, "/localhost/nfd/SegmentPublisherFixture",
+    , m_publisher(m_face, "/localhost/nfd/SegmentPublisherFixture",
                   m_keyChain, m_expectedFreshnessPeriod)
   {
   }
@@ -106,10 +104,9 @@
     m_buffer.appendByteArray(payload.value(), payload.value_size());
 
     uint64_t segmentNo = data.getName()[-1].toSegment();
-    if (data.getFinalBlockId() != data.getName()[-1])
-      {
-        return;
-      }
+    if (data.getFinalBlockId() != data.getName()[-1]) {
+      return;
+    }
 
     NFD_LOG_DEBUG("got final block: #" << segmentNo);
 
@@ -125,18 +122,16 @@
     BOOST_REQUIRE_EQUAL(parser.elements_size(), m_publisher.getLimit());
 
     uint64_t expectedNo = m_publisher.getLimit() - 1;
-    for (Block::element_const_iterator i = parser.elements_begin();
-         i != parser.elements_end();
-         ++i)
-      {
-        uint64_t number = readNonNegativeInteger(*i);
+    std::for_each(parser.elements_begin(), parser.elements_end(),
+      [&expectedNo] (const Block& element) {
+        uint64_t number = readNonNegativeInteger(element);
         BOOST_REQUIRE_EQUAL(number, expectedNo);
         --expectedNo;
-      }
+      });
   }
 
 protected:
-  shared_ptr<ndn::util::DummyClientFace> m_face;
+  ndn::util::DummyClientFace m_face;
   const time::milliseconds m_expectedFreshnessPeriod;
   SegmentPublisherTester<N> m_publisher;
   ndn::EncodingBuffer m_buffer;
@@ -144,23 +139,22 @@
 };
 
 using boost::mpl::int_;
-typedef boost::mpl::vector<int_<10000>, int_<100>, int_<10>, int_<0> > DatasetSizes;
+typedef boost::mpl::vector<int_<10000>, int_<100>, int_<10>, int_<0>> DatasetSizes;
 
 BOOST_AUTO_TEST_SUITE(TestSegmentPublisher)
 
 BOOST_FIXTURE_TEST_CASE_TEMPLATE(Generate, T, DatasetSizes, SegmentPublisherFixture<T::value>)
 {
   this->m_publisher.publish();
-  this->m_face->processEvents();
+  this->m_face.processEvents();
 
-  size_t nSegments = this->m_publisher.getTotalPayloadLength() /
-                     this->m_publisher.getMaxSegmentSize();
-  if (this->m_publisher.getTotalPayloadLength() % this->m_publisher.getMaxSegmentSize() != 0 ||
-      nSegments == 0)
-    ++nSegments;
+  size_t nSegments =
+    this->m_publisher.getTotalPayloadLength() / this->m_publisher.getMaxSegmentSize() +
+    (this->m_publisher.getTotalPayloadLength() % this->m_publisher.getMaxSegmentSize() != 0 ||
+     this->m_publisher.getTotalPayloadLength() == 0);
 
-  BOOST_CHECK_EQUAL(this->m_face->sentDatas.size(), nSegments);
-  for (const Data& data : this->m_face->sentDatas) {
+  BOOST_CHECK_EQUAL(this->m_face.sentData.size(), nSegments);
+  for (const Data& data : this->m_face.sentData) {
     this->validate(data);
   }
 }
