diff --git a/tests/test-nlsr.cpp b/tests/test-nlsr.cpp
index 5ad6efd..a469d5f 100644
--- a/tests/test-nlsr.cpp
+++ b/tests/test-nlsr.cpp
@@ -32,16 +32,40 @@
 
 using ndn::shared_ptr;
 
-BOOST_FIXTURE_TEST_SUITE(TestNlsr, BaseFixture)
+class NlsrFixture : public UnitTestTimeFixture
+{
+public:
+  NlsrFixture()
+    : face(make_shared<ndn::util::DummyClientFace>())
+    , nlsr(g_ioService, g_scheduler, ndn::ref(*face))
+    , lsdb(nlsr.getLsdb())
+    , neighbors(nlsr.getAdjacencyList())
+  {
+  }
+
+  void
+  receiveHelloData(const ndn::Name& sender, const ndn::Name& receiver)
+  {
+    ndn::Name dataName(sender);
+    dataName.append("NLSR").append("INFO").append(receiver.wireEncode()).appendVersion();
+
+    shared_ptr<ndn::Data> data = make_shared<ndn::Data>(dataName);
+
+    nlsr.m_helloProtocol.onContentValidated(data);
+  }
+
+public:
+  shared_ptr<ndn::util::DummyClientFace> face;
+  Nlsr nlsr;
+  Lsdb& lsdb;
+  AdjacencyList& neighbors;
+};
+
+BOOST_FIXTURE_TEST_SUITE(TestNlsr, NlsrFixture)
 
 BOOST_AUTO_TEST_CASE(HyperbolicOn_ZeroCostNeighbors)
 {
-  shared_ptr<ndn::util::DummyClientFace> face = make_shared<ndn::util::DummyClientFace>();
-  Nlsr nlsr(g_ioService, g_scheduler, ndn::ref(*face));
-
   // Simulate loading configuration file
-  AdjacencyList& neighbors = nlsr.getAdjacencyList();
-
   Adjacent neighborA("/ndn/neighborA", "uri://faceA", 25, Adjacent::STATUS_INACTIVE, 0, 0);
   neighbors.insert(neighborA);
 
@@ -63,12 +87,7 @@
 
 BOOST_AUTO_TEST_CASE(HyperbolicOff_LinkStateCost)
 {
-  shared_ptr<ndn::util::DummyClientFace> face = make_shared<ndn::util::DummyClientFace>();
-  Nlsr nlsr(g_ioService, g_scheduler, ndn::ref(*face));
-
   // Simulate loading configuration file
-  AdjacencyList& neighbors = nlsr.getAdjacencyList();
-
   Adjacent neighborA("/ndn/neighborA", "uri://faceA", 25, Adjacent::STATUS_INACTIVE, 0, 0);
   neighbors.insert(neighborA);
 
@@ -88,9 +107,6 @@
 
 BOOST_AUTO_TEST_CASE(SetEventIntervals)
 {
-  shared_ptr<ndn::util::DummyClientFace> face = make_shared<ndn::util::DummyClientFace>();
-  Nlsr nlsr(g_ioService, g_scheduler, ndn::ref(*face));
-
   // Simulate loading configuration file
   ConfParameter& conf = nlsr.getConfParameter();
   conf.setAdjLsaBuildInterval(3);
@@ -123,7 +139,6 @@
 
   // Add active neighbors
   AdjacencyList& neighbors = nlsr.getAdjacencyList();
-
   uint64_t destroyFaceId = 128;
 
   // Create a neighbor whose Face will be destroyed
@@ -323,11 +338,8 @@
   BOOST_CHECK_EQUAL(parameters.getName(), nameToAdvertise);
 }
 
-BOOST_FIXTURE_TEST_CASE(GetCertificate, UnitTestTimeFixture)
+BOOST_AUTO_TEST_CASE(GetCertificate)
 {
-  shared_ptr<ndn::util::DummyClientFace> face = make_shared<ndn::util::DummyClientFace>(g_ioService);
-  Nlsr nlsr(g_ioService, g_scheduler, ndn::ref(*face));
-
   // Create certificate
   ndn::Name identity("/TestNLSR/identity");
   identity.appendVersion();
@@ -355,11 +367,8 @@
   BOOST_CHECK(nlsr.getCertificate(certKey) != nullptr);
 }
 
-BOOST_FIXTURE_TEST_CASE(SetRouterCommandPrefix, UnitTestTimeFixture)
+BOOST_AUTO_TEST_CASE(SetRouterCommandPrefix)
 {
-  shared_ptr<ndn::util::DummyClientFace> face = make_shared<ndn::util::DummyClientFace>(g_ioService);
-  Nlsr nlsr(g_ioService, g_scheduler, ndn::ref(*face));
-
   // Simulate loading configuration file
   ConfParameter& conf = nlsr.getConfParameter();
   conf.setNetwork("/ndn");
@@ -372,6 +381,70 @@
                     ndn::Name("/ndn/site/%C1.router/this-router/lsdb"));
 }
 
+BOOST_AUTO_TEST_CASE(BuildAdjLsaAfterHelloResponse)
+{
+  // Configure NLSR
+  ConfParameter& conf = nlsr.getConfParameter();
+  conf.setNetwork("/ndn");
+  conf.setSiteName("/site");
+
+  ndn::Name routerName("/%C1.Router/this-router");
+  conf.setRouterName(routerName);
+
+  conf.setAdjLsaBuildInterval(1);
+
+  // Add neighbors
+  // Router A
+  ndn::Name neighborAName("/ndn/site/%C1.router/routerA");
+  Adjacent neighborA(neighborAName, "uri://faceA", 0, Adjacent::STATUS_INACTIVE, 0, 0);
+  neighbors.insert(neighborA);
+
+  // Router B
+  ndn::Name neighborBName("/ndn/site/%C1.router/routerB");
+  Adjacent neighborB(neighborBName, "uri://faceA", 0, Adjacent::STATUS_INACTIVE, 0, 0);
+  neighbors.insert(neighborB);
+
+  nlsr.initialize();
+  this->advanceClocks(ndn::time::milliseconds(1));
+
+  // Receive HELLO response from Router A
+  receiveHelloData(neighborAName, conf.getRouterPrefix());
+  this->advanceClocks(ndn::time::seconds(1));
+
+  ndn::Name lsaKey = ndn::Name(conf.getRouterPrefix()).append(AdjLsa::TYPE_STRING);
+
+  // Adjacency LSA should be built even though other router is INACTIVE
+  AdjLsa* lsa = lsdb.findAdjLsa(lsaKey);
+  BOOST_REQUIRE(lsa != nullptr);
+  BOOST_CHECK_EQUAL(lsa->getAdl().getSize(), 1);
+
+  // Receive HELLO response from Router B
+  receiveHelloData(neighborBName, conf.getRouterPrefix());
+
+  // Both routers become INACTIVE and HELLO Interests have timed out
+  for (Adjacent& adjacency : neighbors.getAdjList()) {
+    adjacency.setStatus(Adjacent::STATUS_INACTIVE);
+    adjacency.setInterestTimedOutNo(HELLO_RETRIES_DEFAULT);
+  }
+
+  this->advanceClocks(ndn::time::seconds(1));
+
+  // Adjacency LSA should have been removed since this router's adjacencies are INACTIVE
+  // and have timed out
+  lsa = lsdb.findAdjLsa(lsaKey);
+  BOOST_CHECK(lsa == nullptr);
+
+  // Receive HELLO response from Router A and B
+  receiveHelloData(neighborAName, conf.getRouterPrefix());
+  receiveHelloData(neighborBName, conf.getRouterPrefix());
+  this->advanceClocks(ndn::time::seconds(1));
+
+  // Adjacency LSA should be built
+  lsa = lsdb.findAdjLsa(lsaKey);
+  BOOST_REQUIRE(lsa != nullptr);
+  BOOST_CHECK_EQUAL(lsa->getAdl().getSize(), 2);
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } //namespace test
