diff --git a/tests/unit-tests/test-key-locator.cpp b/tests/unit-tests/test-key-locator.cpp
index 066aefc..3e48233 100644
--- a/tests/unit-tests/test-key-locator.cpp
+++ b/tests/unit-tests/test-key-locator.cpp
@@ -20,17 +20,114 @@
  */
 
 #include "key-locator.hpp"
+#include "util/concepts.hpp"
+#include "encoding/block-helpers.hpp"
 
 #include "boost-test.hpp"
 
 namespace ndn {
 
+BOOST_CONCEPT_ASSERT((boost::EqualityComparable<KeyLocator>));
+BOOST_CONCEPT_ASSERT((WireEncodable<KeyLocator>));
+BOOST_CONCEPT_ASSERT((WireDecodable<KeyLocator>));
+
 BOOST_AUTO_TEST_SUITE(TestKeyLocator)
 
+BOOST_AUTO_TEST_CASE(TypeNone)
+{
+  KeyLocator a;
+  BOOST_CHECK_EQUAL(a.getType(), KeyLocator::KeyLocator_None);
+  BOOST_CHECK_THROW(a.getName(), KeyLocator::Error);
+  BOOST_CHECK_THROW(a.getKeyDigest(), KeyLocator::Error);
+
+  Block wire;
+  BOOST_REQUIRE_NO_THROW(wire = a.wireEncode());
+
+  // These octets are obtained by the snippet below.
+  // This check is intended to detect unexpected encoding change in the future.
+  // for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
+  //   printf("0x%02x, ", *it);
+  // }
+  static const uint8_t expected[] = {
+    0x1c, 0x00
+  };
+  BOOST_CHECK_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
+                                wire.begin(), wire.end());
+
+  BOOST_REQUIRE_NO_THROW(KeyLocator(wire));
+  KeyLocator b(wire);
+  BOOST_CHECK(a == b);
+  BOOST_CHECK_EQUAL(b.getType(), KeyLocator::KeyLocator_None);
+  BOOST_CHECK_THROW(b.getName(), KeyLocator::Error);
+  BOOST_CHECK_THROW(b.getKeyDigest(), KeyLocator::Error);
+}
+
+BOOST_AUTO_TEST_CASE(TypeName)
+{
+  KeyLocator a;
+  a.setName("/N");
+  BOOST_CHECK_EQUAL(a.getType(), KeyLocator::KeyLocator_Name);
+  BOOST_CHECK_EQUAL(a.getName(), Name("/N"));
+  BOOST_CHECK_THROW(a.getKeyDigest(), KeyLocator::Error);
+
+  Block wire;
+  BOOST_REQUIRE_NO_THROW(wire = a.wireEncode());
+
+  // These octets are obtained by the snippet below.
+  // This check is intended to detect unexpected encoding change in the future.
+  // for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
+  //   printf("0x%02x, ", *it);
+  // }
+  static const uint8_t expected[] = {
+    0x1c, 0x05, 0x07, 0x03, 0x08, 0x01, 0x4e
+  };
+  BOOST_CHECK_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
+                                wire.begin(), wire.end());
+
+  BOOST_REQUIRE_NO_THROW(KeyLocator(wire));
+  KeyLocator b(wire);
+  BOOST_CHECK(a == b);
+  BOOST_CHECK_EQUAL(b.getType(), KeyLocator::KeyLocator_Name);
+  BOOST_CHECK_EQUAL(b.getName(), Name("/N"));
+  BOOST_CHECK_THROW(b.getKeyDigest(), KeyLocator::Error);
+}
+
+BOOST_AUTO_TEST_CASE(TypeKeyDigest)
+{
+  char digestOctets[] = "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD";
+  ConstBufferPtr digestBuffer = make_shared<Buffer>(digestOctets, 8);
+  Block expectedDigestBlock = dataBlock(tlv::KeyDigest, digestOctets, 8);
+
+  KeyLocator a;
+  a.setKeyDigest(digestBuffer);
+  BOOST_CHECK_EQUAL(a.getType(), KeyLocator::KeyLocator_KeyDigest);
+  BOOST_CHECK(a.getKeyDigest() == expectedDigestBlock);
+  BOOST_CHECK_THROW(a.getName(), KeyLocator::Error);
+
+  Block wire;
+  BOOST_REQUIRE_NO_THROW(wire = a.wireEncode());
+
+  // These octets are obtained by the snippet below.
+  // This check is intended to detect unexpected encoding change in the future.
+  // for (Buffer::const_iterator it = wire.begin(); it != wire.end(); ++it) {
+  //   printf("0x%02x, ", *it);
+  // }
+  static const uint8_t expected[] = {
+    0x1c, 0x0a, 0x1d, 0x08, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd
+  };
+  BOOST_CHECK_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
+                                wire.begin(), wire.end());
+
+  BOOST_REQUIRE_NO_THROW(KeyLocator(wire));
+  KeyLocator b(wire);
+  BOOST_CHECK(a == b);
+  BOOST_CHECK_EQUAL(b.getType(), KeyLocator::KeyLocator_KeyDigest);
+  BOOST_CHECK(b.getKeyDigest() == expectedDigestBlock);
+  BOOST_CHECK_THROW(b.getName(), KeyLocator::Error);
+}
+
 BOOST_AUTO_TEST_CASE(Equality)
 {
-  BOOST_CONCEPT_ASSERT((boost::EqualityComparable<KeyLocator>));
-
   KeyLocator a;
   KeyLocator b;
   BOOST_CHECK_EQUAL(a == b, true);
@@ -47,6 +144,36 @@
   b.setName("ndn:/A");
   BOOST_CHECK_EQUAL(a == b, true);
   BOOST_CHECK_EQUAL(a != b, false);
+
+  char digestOctets[] = "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD";
+  ConstBufferPtr digestBuffer = make_shared<Buffer>(digestOctets, 8);
+
+  a.setKeyDigest(digestBuffer);
+  BOOST_CHECK_EQUAL(a == b, false);
+  BOOST_CHECK_EQUAL(a != b, true);
+
+  b.setKeyDigest(digestBuffer);
+  BOOST_CHECK_EQUAL(a == b, true);
+  BOOST_CHECK_EQUAL(a != b, false);
+}
+
+BOOST_AUTO_TEST_CASE(UnknownType)
+{
+  static const uint8_t wireOctets[] = {
+    0x1c, 0x03, 0x7f, 0x01, 0xcc
+  };
+  Block wire(wireOctets, sizeof(wireOctets));
+  BOOST_REQUIRE_NO_THROW(KeyLocator(wire));
+  KeyLocator a(wire);
+  BOOST_CHECK_EQUAL(a.getType(), KeyLocator::KeyLocator_Unknown);
+
+  KeyLocator b(wire);
+  BOOST_CHECK_EQUAL(a == b, true);
+  BOOST_CHECK_EQUAL(a != b, false);
+
+  b.setName("/N");
+  BOOST_CHECK_EQUAL(a == b, false);
+  BOOST_CHECK_EQUAL(a != b, true);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
