diff --git a/tests/dummy-validator.hpp b/tests/dummy-validator.hpp
index 40e4bcb..255c2ce 100644
--- a/tests/dummy-validator.hpp
+++ b/tests/dummy-validator.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -22,21 +22,23 @@
 #ifndef NDN_TESTS_DUMMY_VALIDATOR_HPP
 #define NDN_TESTS_DUMMY_VALIDATOR_HPP
 
-#include "security/validator.hpp"
+#include "security/v2/validator.hpp"
+#include "security/v2/validation-policy.hpp"
+#include "security/v2/certificate-fetcher-offline.hpp"
 
 namespace ndn {
 namespace tests {
 
-/** \brief a Validator for unit testing
+/** \brief A validation policy for unit testing
  */
-class DummyValidator : public Validator
+class DummyValidationPolicy : public security::v2::ValidationPolicy
 {
 public:
   /** \brief constructor
    *  \param shouldAccept whether to accept or reject all validation requests
    */
   explicit
-  DummyValidator(bool shouldAccept = true)
+  DummyValidationPolicy(bool shouldAccept = true)
   {
     this->setResult(shouldAccept);
   }
@@ -61,29 +63,27 @@
   }
 
 protected:
-  virtual void
-  checkPolicy(const Interest& interest, int nSteps,
-              const OnInterestValidated& accept, const OnInterestValidationFailed& reject,
-              std::vector<shared_ptr<ValidationRequest>>&) override
+  void
+  checkPolicy(const Data& data, const shared_ptr<security::v2::ValidationState>& state,
+              const ValidationContinuation& continueValidation) override
   {
-    if (m_decide(interest.getName())) {
-      accept(interest.shared_from_this());
+    if (m_decide(data.getName())) {
+      continueValidation(nullptr, state);
     }
     else {
-      reject(interest.shared_from_this(), "");
+      state->fail(security::v2::ValidationError::NO_ERROR);
     }
   }
 
-  virtual void
-  checkPolicy(const Data& data, int nSteps,
-              const OnDataValidated& accept, const OnDataValidationFailed& reject,
-              std::vector<shared_ptr<ValidationRequest>>&) override
+  void
+  checkPolicy(const Interest& interest, const shared_ptr<security::v2::ValidationState>& state,
+              const ValidationContinuation& continueValidation) override
   {
-    if (m_decide(data.getName())) {
-      accept(data.shared_from_this());
+    if (m_decide(interest.getName())) {
+      continueValidation(nullptr, state);
     }
     else {
-      reject(data.shared_from_this(), "");
+      state->fail(security::v2::ValidationError::NO_ERROR);
     }
   }
 
@@ -91,15 +91,21 @@
   function<bool(const Name&)> m_decide;
 };
 
-/** \brief a DummyValidator initialized to reject all requests
- */
-class DummyRejectValidator : public DummyValidator
+
+class DummyValidator : public security::v2::Validator
 {
 public:
-  DummyRejectValidator()
-    : DummyValidator(false)
+  DummyValidator(bool shouldAccept = true)
+    : security::v2::Validator(make_unique<DummyValidationPolicy>(shouldAccept),
+                              make_unique<security::v2::CertificateFetcherOffline>())
   {
   }
+
+  DummyValidationPolicy&
+  getPolicy()
+  {
+    return static_cast<DummyValidationPolicy&>(security::v2::Validator::getPolicy());
+  }
 };
 
 } // namespace tests
diff --git a/tests/unit-tests/mgmt/nfd/controller-fixture.hpp b/tests/unit-tests/mgmt/nfd/controller-fixture.hpp
index 8f31f14..6054ed2 100644
--- a/tests/unit-tests/mgmt/nfd/controller-fixture.hpp
+++ b/tests/unit-tests/mgmt/nfd/controller-fixture.hpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -23,11 +23,12 @@
 #define NDN_TESTS_MGMT_NFD_CONTROLLER_FIXTURE_HPP
 
 #include "mgmt/nfd/controller.hpp"
-#include "../../../dummy-validator.hpp"
+#include "util/dummy-client-face.hpp"
+#include "security/v2/certificate-fetcher-offline.hpp"
 
 #include "boost-test.hpp"
-#include "util/dummy-client-face.hpp"
-#include "../../identity-management-time-fixture.hpp"
+#include "dummy-validator.hpp"
+#include "unit-tests/identity-management-time-fixture.hpp"
 
 namespace ndn {
 namespace nfd {
@@ -40,6 +41,7 @@
 protected:
   ControllerFixture()
     : face(io, m_keyChain)
+    , m_validator(true)
     , controller(face, m_keyChain, m_validator)
     , commandFailCallback(bind(&ControllerFixture::recordCommandFail, this, _1))
     , datasetFailCallback(bind(&ControllerFixture::recordDatasetFail, this, _1, _2))
@@ -56,7 +58,7 @@
   void
   setValidationResult(bool shouldAccept)
   {
-    m_validator.setResult(shouldAccept);
+    m_validator.getPolicy().setResult(shouldAccept);
   }
 
 private:
@@ -74,13 +76,11 @@
 
 protected:
   ndn::util::DummyClientFace face;
+  DummyValidator m_validator;
   Controller controller;
   Controller::CommandFailCallback commandFailCallback;
   Controller::DatasetFailCallback datasetFailCallback;
   std::vector<uint32_t> failCodes;
-
-private:
-  DummyValidator m_validator;
 };
 
 } // namespace tests
diff --git a/tests/unit-tests/security/command-interest-validator.t.cpp b/tests/unit-tests/security/command-interest-validator.t.cpp
deleted file mode 100644
index e8c4eeb..0000000
--- a/tests/unit-tests/security/command-interest-validator.t.cpp
+++ /dev/null
@@ -1,412 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#include "security/command-interest-validator.hpp"
-#include "security/command-interest-signer.hpp"
-#include "security/signing-helpers.hpp"
-
-#include "boost-test.hpp"
-#include "dummy-validator.hpp"
-#include "../identity-management-time-fixture.hpp"
-#include "../make-interest-data.hpp"
-
-#include <boost/lexical_cast.hpp>
-
-namespace ndn {
-namespace security {
-namespace tests {
-
-using namespace ndn::tests;
-
-class CommandInterestValidatorFixture : public IdentityManagementTimeFixture
-{
-protected:
-  CommandInterestValidatorFixture()
-    : signer(m_keyChain)
-  {
-    this->initialize(CommandInterestValidator::Options{});
-  }
-
-  void
-  initialize(const CommandInterestValidator::Options& options)
-  {
-    auto inner = make_unique<DummyValidator>();
-    this->inner = inner.get();
-    this->validator = make_unique<CommandInterestValidator>(std::move(inner), options);
-  }
-
-  Name
-  makeIdentity(uint64_t identity)
-  {
-    Name name("/localhost/CommandInterestValidatorIdentity");
-    name.appendSequenceNumber(identity);
-    this->addIdentity(name);
-    return name;
-  }
-
-  shared_ptr<Interest>
-  makeCommandInterest(uint64_t identity = 0)
-  {
-    auto interest = signer.makeCommandInterest("/CommandInterestPrefix", signingByIdentity(makeIdentity(identity)));
-    return make_shared<Interest>(std::move(interest));
-  }
-
-  /** \brief check that validator accepts interest
-   *  \param interest to be validated
-   */
-  void
-  assertAccept(const Interest& interest)
-  {
-    int nAccepts = 0;
-    validator->validate(interest,
-      [&nAccepts] (const shared_ptr<const Interest>&) { ++nAccepts; },
-      [] (const shared_ptr<const Interest>&, const std::string& msg) {
-        BOOST_ERROR("validation request should succeed but fails with: " << msg);
-      });
-    BOOST_CHECK_EQUAL(nAccepts, 1);
-  }
-
-  /** \brief check that validator rejects interest
-   *  \param interest to be validated
-   *  \param error if not NONE, further check the error code matches \p error
-   *               if NONE, error code is not checked
-   */
-  void
-  assertReject(const Interest& interest, CommandInterestValidator::ErrorCode error)
-  {
-    int nRejects = 0;
-    validator->validate(interest,
-      [] (const shared_ptr<const Interest>&) {
-        BOOST_ERROR("validation request should fail but succeeds");
-      },
-      [&nRejects, error] (const shared_ptr<const Interest>&, const std::string& msg) {
-        ++nRejects;
-        if (error != CommandInterestValidator::ErrorCode::NONE) {
-          BOOST_CHECK_EQUAL(msg, boost::lexical_cast<std::string>(error));
-        }
-      });
-    BOOST_CHECK_EQUAL(nRejects, 1);
-  }
-
-protected:
-  CommandInterestSigner signer;
-  DummyValidator* inner;
-  unique_ptr<CommandInterestValidator> validator;
-};
-
-BOOST_AUTO_TEST_SUITE(Security)
-BOOST_FIXTURE_TEST_SUITE(TestCommandInterestValidator, CommandInterestValidatorFixture)
-
-BOOST_AUTO_TEST_SUITE(Accepts)
-
-BOOST_AUTO_TEST_CASE(Basic)
-{
-  auto i1 = makeCommandInterest();
-  assertAccept(*i1);
-
-  advanceClocks(time::milliseconds(5));
-  auto i2 = makeCommandInterest();
-  assertAccept(*i2);
-
-  advanceClocks(time::seconds(2));
-  auto i3 = makeCommandInterest();
-  assertAccept(*i3);
-}
-
-BOOST_AUTO_TEST_CASE(DataPassthru)
-{
-  auto d1 = makeData("/data");
-  int nAccepts = 0;
-  validator->validate(*d1,
-    [&nAccepts] (const shared_ptr<const Data>&) { ++nAccepts; },
-    [] (const shared_ptr<const Data>&, const std::string& msg) {
-      BOOST_ERROR("validation request should succeed but fails with: " << msg);
-    });
-  BOOST_CHECK_EQUAL(nAccepts, 1);
-}
-
-BOOST_AUTO_TEST_SUITE_END() // Accepts
-
-BOOST_AUTO_TEST_SUITE(Rejects)
-
-BOOST_AUTO_TEST_CASE(NameTooShort)
-{
-  auto i1 = makeInterest("/name/too/short");
-  assertReject(*i1, CommandInterestValidator::ErrorCode::NAME_TOO_SHORT);
-}
-
-BOOST_AUTO_TEST_CASE(BadTimestamp)
-{
-  auto i1 = makeCommandInterest();
-  setNameComponent(*i1, command_interest::POS_TIMESTAMP, "not-timestamp");
-  assertReject(*i1, CommandInterestValidator::ErrorCode::BAD_TIMESTAMP);
-}
-
-BOOST_AUTO_TEST_CASE(BadSigInfo)
-{
-  auto i1 = makeCommandInterest();
-  setNameComponent(*i1, signed_interest::POS_SIG_INFO, "not-SignatureInfo");
-  assertReject(*i1, CommandInterestValidator::ErrorCode::BAD_SIG_INFO);
-}
-
-BOOST_AUTO_TEST_CASE(MissingKeyLocator)
-{
-  auto i1 = makeCommandInterest();
-  SignatureInfo sigInfo;
-  setNameComponent(*i1, signed_interest::POS_SIG_INFO,
-                   sigInfo.wireEncode().begin(), sigInfo.wireEncode().end());
-  assertReject(*i1, CommandInterestValidator::ErrorCode::MISSING_KEY_LOCATOR);
-}
-
-BOOST_AUTO_TEST_CASE(BadKeyLocatorType)
-{
-  auto i1 = makeCommandInterest();
-  KeyLocator kl;
-  kl.setKeyDigest(makeBinaryBlock(tlv::KeyDigest, "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD", 8));
-  SignatureInfo sigInfo;
-  sigInfo.setKeyLocator(kl);
-  setNameComponent(*i1, signed_interest::POS_SIG_INFO,
-                   sigInfo.wireEncode().begin(), sigInfo.wireEncode().end());
-  assertReject(*i1, CommandInterestValidator::ErrorCode::BAD_KEY_LOCATOR_TYPE);
-}
-
-BOOST_AUTO_TEST_CASE(BadCertName)
-{
-  auto i1 = makeCommandInterest();
-  KeyLocator kl;
-  kl.setName("/bad/cert/name");
-  SignatureInfo sigInfo;
-  sigInfo.setKeyLocator(kl);
-  setNameComponent(*i1, signed_interest::POS_SIG_INFO,
-                   sigInfo.wireEncode().begin(), sigInfo.wireEncode().end());
-  assertReject(*i1, CommandInterestValidator::ErrorCode::BAD_CERT_NAME);
-}
-
-BOOST_AUTO_TEST_CASE(InnerReject)
-{
-  inner->setResult(false);
-  auto i1 = makeCommandInterest();
-  assertReject(*i1, CommandInterestValidator::ErrorCode::NONE);
-}
-
-BOOST_AUTO_TEST_CASE(TimestampOutOfGracePositive)
-{
-  CommandInterestValidator::Options options;
-  options.gracePeriod = time::seconds(15);
-  initialize(options);
-
-  auto i1 = makeCommandInterest(); // signed at 0s
-  advanceClocks(time::seconds(16)); // verifying at +16s
-  assertReject(*i1, CommandInterestValidator::ErrorCode::TIMESTAMP_OUT_OF_GRACE);
-
-  auto i2 = makeCommandInterest(); // signed at +16s
-  assertAccept(*i2); // verifying at +16s
-}
-
-BOOST_AUTO_TEST_CASE(TimestampOutOfGraceNegative)
-{
-  CommandInterestValidator::Options options;
-  options.gracePeriod = time::seconds(15);
-  initialize(options);
-
-  auto i1 = makeCommandInterest(); // signed at 0s
-  advanceClocks(time::seconds(1));
-  auto i2 = makeCommandInterest(); // signed at +1s
-  advanceClocks(time::seconds(1));
-  auto i3 = makeCommandInterest(); // signed at +2s
-
-  systemClock->advance(time::seconds(-18)); // verifying at -16s
-  assertReject(*i1, CommandInterestValidator::ErrorCode::TIMESTAMP_OUT_OF_GRACE);
-
-  // CommandInterestValidator should not remember i1's timestamp
-  assertReject(*i2, CommandInterestValidator::ErrorCode::TIMESTAMP_OUT_OF_GRACE);
-
-  // CommandInterestValidator should not remember i2's timestamp, and should treat i3 as initial
-  advanceClocks(time::seconds(18)); // verifying at +2s
-  assertAccept(*i3);
-}
-
-BOOST_AUTO_TEST_CASE(TimestampReorderEqual)
-{
-  auto i1 = makeCommandInterest(); // signed at 0s
-  assertAccept(*i1);
-
-  auto i2 = makeCommandInterest(); // signed at 0s
-  setNameComponent(*i2, command_interest::POS_TIMESTAMP,
-                   i1->getName()[command_interest::POS_TIMESTAMP]);
-  assertReject(*i2, CommandInterestValidator::ErrorCode::TIMESTAMP_REORDER);
-
-  advanceClocks(time::seconds(2));
-  auto i3 = makeCommandInterest(); // signed at +2s
-  assertAccept(*i3);
-}
-
-BOOST_AUTO_TEST_CASE(TimestampReorderNegative)
-{
-  auto i2 = makeCommandInterest(); // signed at 0ms
-  advanceClocks(time::milliseconds(200));
-  auto i3 = makeCommandInterest(); // signed at +200ms
-  advanceClocks(time::milliseconds(900));
-  auto i1 = makeCommandInterest(); // signed at +1100ms
-  advanceClocks(time::milliseconds(300));
-  auto i4 = makeCommandInterest(); // signed at +1400ms
-
-  systemClock->advance(time::milliseconds(-300)); // verifying at +1100ms
-  assertAccept(*i1);
-
-  systemClock->advance(time::milliseconds(-1100)); // verifying at 0ms
-  assertReject(*i2, CommandInterestValidator::ErrorCode::TIMESTAMP_REORDER);
-
-  // CommandInterestValidator should not remember i2's timestamp
-  advanceClocks(time::milliseconds(200)); // verifying at +200ms
-  assertReject(*i3, CommandInterestValidator::ErrorCode::TIMESTAMP_REORDER);
-
-  advanceClocks(time::milliseconds(1200)); // verifying at 1400ms
-  assertAccept(*i4);
-}
-
-BOOST_AUTO_TEST_SUITE_END() // Rejects
-
-BOOST_AUTO_TEST_SUITE(Options)
-
-typedef boost::mpl::vector<
-  boost::mpl::int_<0>,
-  boost::mpl::int_<-1>
-> GraceNonPositiveValues;
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(GraceNonPositive, VALUE, GraceNonPositiveValues)
-{
-  CommandInterestValidator::Options options;
-  options.gracePeriod = time::seconds(VALUE::value);
-  initialize(options);
-
-  auto i1 = makeCommandInterest(1); // signed at 0ms
-  auto i2 = makeCommandInterest(2); // signed at 0ms
-  for (auto interest : {i1, i2}) {
-    setNameComponent(*interest, command_interest::POS_TIMESTAMP,
-                     name::Component::fromNumber(time::toUnixTimestamp(time::system_clock::now()).count()));
-  } // ensure timestamps are exactly 0ms
-
-  assertAccept(*i1); // verifying at 0ms
-
-  advanceClocks(time::milliseconds(1));
-  assertReject(*i2, CommandInterestValidator::ErrorCode::TIMESTAMP_OUT_OF_GRACE); // verifying at 1ms
-}
-
-BOOST_AUTO_TEST_CASE(TimestampsLimited)
-{
-  CommandInterestValidator::Options options;
-  options.gracePeriod = time::seconds(15);
-  options.maxTimestamps = 3;
-  initialize(options);
-
-  auto i1 = makeCommandInterest(1);
-  auto i2 = makeCommandInterest(2);
-  auto i3 = makeCommandInterest(3);
-  auto i00 = makeCommandInterest(0); // signed at 0s
-  advanceClocks(time::seconds(1));
-  auto i01 = makeCommandInterest(0); // signed at 1s
-  advanceClocks(time::seconds(1));
-  auto i02 = makeCommandInterest(0); // signed at 2s
-
-  assertAccept(*i00);
-  assertAccept(*i02);
-  assertAccept(*i1);
-  assertAccept(*i2);
-  assertAccept(*i3); // forgets identity 0
-  assertAccept(*i01); // accepted despite timestamp is reordered, because record has been evicted
-}
-
-BOOST_AUTO_TEST_CASE(TimestampsUnlimited)
-{
-  CommandInterestValidator::Options options;
-  options.gracePeriod = time::seconds(15);
-  options.maxTimestamps = -1;
-  initialize(options);
-
-  auto i1 = makeCommandInterest(0); // signed at 0s
-  advanceClocks(time::seconds(1));
-  for (int identity = 0; identity < 20; ++identity) {
-    auto i2 = makeCommandInterest(identity); // signed at +1s
-    assertAccept(*i2);
-  }
-  assertReject(*i1, CommandInterestValidator::ErrorCode::TIMESTAMP_REORDER);
-}
-
-BOOST_AUTO_TEST_CASE(TimestampsDisabled)
-{
-  CommandInterestValidator::Options options;
-  options.gracePeriod = time::seconds(15);
-  options.maxTimestamps = 0;
-  initialize(options);
-
-  auto i1 = makeCommandInterest(); // signed at 0s
-  advanceClocks(time::seconds(1));
-  auto i2 = makeCommandInterest(); // signed at +1s
-  assertAccept(*i2);
-
-  assertAccept(*i1); // accepted despite timestamp is reordered, because record isn't kept
-}
-
-BOOST_AUTO_TEST_CASE(TtlLimited)
-{
-  CommandInterestValidator::Options options;
-  options.gracePeriod = time::seconds(120);
-  options.timestampTtl = time::seconds(300);
-  initialize(options);
-
-  auto i1 = makeCommandInterest(); // signed at 0s
-  advanceClocks(time::seconds(240));
-  auto i2 = makeCommandInterest(); // signed at +240s
-  advanceClocks(time::seconds(120));
-  auto i3 = makeCommandInterest(); // signed at +360s
-
-  systemClock->advance(time::seconds(-360)); // rewind system clock to 0s
-  assertAccept(*i1);
-  assertAccept(*i3);
-
-  advanceClocks(time::seconds(30), time::seconds(301)); // advance steady clock by 301s, and system clock to +301s
-  assertAccept(*i2); // accepted despite timestamp is reordered, because record has been expired
-}
-
-BOOST_AUTO_TEST_CASE(TtlZero)
-{
-  CommandInterestValidator::Options options;
-  options.gracePeriod = time::seconds(15);
-  options.timestampTtl = time::seconds::zero();
-  initialize(options);
-
-  auto i1 = makeCommandInterest(); // signed at 0s
-  advanceClocks(time::seconds(1));
-  auto i2 = makeCommandInterest(); // signed at +1s
-  assertAccept(*i2);
-
-  assertAccept(*i1); // accepted despite timestamp is reordered, because record has been expired
-}
-
-BOOST_AUTO_TEST_SUITE_END() // Options
-
-BOOST_AUTO_TEST_SUITE_END() // TestCommandInterestValidator
-BOOST_AUTO_TEST_SUITE_END() // Security
-
-} // namespace tests
-} // namespace security
-} // namespace ndn
diff --git a/tests/unit-tests/security/validator-null.t.cpp b/tests/unit-tests/security/validator-null.t.cpp
new file mode 100644
index 0000000..b4f4102
--- /dev/null
+++ b/tests/unit-tests/security/validator-null.t.cpp
@@ -0,0 +1,66 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2013-2017 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "security/validator-null.hpp"
+
+#include "boost-test.hpp"
+#include "identity-management-fixture.hpp"
+#include "../make-interest-data.hpp"
+
+namespace ndn {
+namespace security {
+namespace tests {
+
+using namespace ndn::tests;
+
+BOOST_AUTO_TEST_SUITE(Security)
+BOOST_FIXTURE_TEST_SUITE(TestValidatorNull, IdentityManagementFixture)
+
+BOOST_AUTO_TEST_CASE(ValidateData)
+{
+  auto identity = addIdentity("/TestValidator/Null");
+  Data data("/Some/Other/Data/Name");
+  m_keyChain.sign(data, signingByIdentity(identity));
+
+  ValidatorNull validator;
+  validator.validate(data,
+                     bind([] { BOOST_CHECK_MESSAGE(true, "Validation should succeed"); }),
+                     bind([] { BOOST_CHECK_MESSAGE(false, "Validation should not have failed"); }));
+}
+
+BOOST_AUTO_TEST_CASE(ValidateInterest)
+{
+  auto identity = addIdentity("/TestValidator/Null");
+  Interest interest("/Some/Other/Interest/Name");
+  m_keyChain.sign(interest, signingByIdentity(identity));
+
+  ValidatorNull validator;
+  validator.validate(interest,
+                     bind([] { BOOST_CHECK_MESSAGE(true, "Validation should succeed"); }),
+                     bind([] { BOOST_CHECK_MESSAGE(false, "Validation should not have failed"); }));
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestValidatorNull
+BOOST_AUTO_TEST_SUITE_END() // Security
+
+} // namespace tests
+} // namespace security
+} // namespace ndn
diff --git a/tests/unit-tests/security/validator.t.cpp b/tests/unit-tests/security/validator.t.cpp
index 3f26b44..6f22c5a 100644
--- a/tests/unit-tests/security/validator.t.cpp
+++ b/tests/unit-tests/security/validator.t.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -19,7 +19,7 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#include "security/validator-null.hpp"
+#include "security/validator.hpp"
 
 #include "boost-test.hpp"
 #include "identity-management-fixture.hpp"
@@ -34,40 +34,6 @@
 BOOST_AUTO_TEST_SUITE(Security)
 BOOST_FIXTURE_TEST_SUITE(TestValidator, IdentityManagementV1Fixture)
 
-void
-onValidated(const shared_ptr<const Data>& data)
-{
-  BOOST_CHECK(true);
-}
-
-void
-onValidationFailed(const shared_ptr<const Data>& data, const std::string& failureInfo)
-{
-  BOOST_CHECK(false);
-}
-
-BOOST_AUTO_TEST_CASE(Null)
-{
-  Name identity("/TestValidator/Null");
-  identity.appendVersion();
-  addIdentity(identity, RsaKeyParams());
-
-  Name dataName = identity;
-  dataName.append("1");
-  shared_ptr<Data> data = make_shared<Data>(dataName);
-
-  BOOST_CHECK_NO_THROW(m_keyChain.sign(*data,
-                                       security::SigningInfo(security::SigningInfo::SIGNER_TYPE_ID,
-                                                             identity)));
-
-  ValidatorNull validator;
-
-  // data must be a shared pointer
-  validator.validate(*data,
-                     bind(&onValidated, _1),
-                     bind(&onValidationFailed, _1, _2));
-}
-
 const uint8_t ecdsaSigInfo[] = {
 0x16, 0x1b, // SignatureInfo
   0x1b, 0x01, // SignatureType
diff --git a/tests/unit-tests/util/segment-fetcher.t.cpp b/tests/unit-tests/util/segment-fetcher.t.cpp
index 02ef85b..09eb212 100644
--- a/tests/unit-tests/util/segment-fetcher.t.cpp
+++ b/tests/unit-tests/util/segment-fetcher.t.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
@@ -20,7 +20,6 @@
  */
 
 #include "util/segment-fetcher.hpp"
-#include "security/validator-null.hpp"
 #include "lp/nack-header.hpp"
 #include "data.hpp"
 #include "encoding/block.hpp"
@@ -103,9 +102,9 @@
 
 BOOST_FIXTURE_TEST_CASE(Timeout, Fixture)
 {
-  ValidatorNull nullValidator;
+  DummyValidator acceptValidator;
   SegmentFetcher::fetch(face, Interest("/hello/world", time::milliseconds(100)),
-                        nullValidator,
+                        acceptValidator,
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
 
@@ -132,9 +131,9 @@
 
 BOOST_FIXTURE_TEST_CASE(Basic, Fixture)
 {
-  ValidatorNull nullValidator;
+  DummyValidator acceptValidator;
   SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
-                        nullValidator,
+                        acceptValidator,
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
 
@@ -164,9 +163,9 @@
 
 BOOST_FIXTURE_TEST_CASE(NoSegmentInData, Fixture)
 {
-  ValidatorNull nullValidator;
+  DummyValidator acceptValidator;
   SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
-                        nullValidator,
+                        acceptValidator,
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
 
@@ -188,7 +187,7 @@
 
 BOOST_FIXTURE_TEST_CASE(SegmentValidationFailure, Fixture)
 {
-  DummyRejectValidator rejectValidator;
+  DummyValidator rejectValidator(false);
   SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
                         rejectValidator,
                         bind(&Fixture::onComplete, this, _1),
@@ -205,9 +204,9 @@
 
 BOOST_FIXTURE_TEST_CASE(Triple, Fixture)
 {
-  ValidatorNull nullValidator;
+  DummyValidator acceptValidator;
   SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
-                        nullValidator,
+                        acceptValidator,
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
 
@@ -254,9 +253,9 @@
 
 BOOST_FIXTURE_TEST_CASE(TripleWithInitialSegmentFetching, Fixture)
 {
-  ValidatorNull nullValidator;
+  DummyValidator acceptValidator;
   SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
-                        nullValidator,
+                        acceptValidator,
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
 
@@ -313,9 +312,9 @@
 
 BOOST_FIXTURE_TEST_CASE(MultipleSegmentFetching, Fixture)
 {
-  ValidatorNull nullValidator;
+  DummyValidator acceptValidator;
   SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
-                        nullValidator,
+                        acceptValidator,
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
 
@@ -337,7 +336,7 @@
 BOOST_FIXTURE_TEST_CASE(DuplicateNack, Fixture)
 {
   SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
-                        make_shared<ValidatorNull>(),
+                        make_shared<DummyValidator>(true),
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
   advanceClocks(time::milliseconds(10));
@@ -357,7 +356,7 @@
 BOOST_FIXTURE_TEST_CASE(CongestionNack, Fixture)
 {
   SegmentFetcher::fetch(face, Interest("/hello/world", time::seconds(1000)),
-                        make_shared<ValidatorNull>(),
+                        make_shared<DummyValidator>(true),
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
   advanceClocks(time::milliseconds(10));
@@ -381,7 +380,7 @@
   ndn::Name interestName("ndn:/A");
   SegmentFetcher::fetch(face,
                         Interest(interestName),
-                        make_shared<ValidatorNull>(),
+                        make_shared<DummyValidator>(true),
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
 
@@ -416,7 +415,7 @@
 BOOST_FIXTURE_TEST_CASE(ZeroComponentName, Fixture)
 {
   SegmentFetcher::fetch(face, Interest("ndn:/"),
-                        make_shared<ValidatorNull>(),
+                        make_shared<DummyValidator>(true),
                         bind(&Fixture::onComplete, this, _1),
                         bind(&Fixture::onError, this, _1));
   advanceClocks(time::milliseconds(10));
