diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index cd9e17a..8193a60 100644
--- a/src/communication/sync-logic-handler.cpp
+++ b/src/communication/sync-logic-handler.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  The University of Memphis,
+ * Copyright (c) 2014-2024,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -24,8 +24,6 @@
 #include "logger.hpp"
 #include "utility/name-helper.hpp"
 
-#include <boost/lexical_cast.hpp>
-
 namespace nlsr {
 
 INIT_LOGGER(SyncLogicHandler);
@@ -33,24 +31,22 @@
 const std::string LSA_COMPONENT{"LSA"};
 
 SyncLogicHandler::SyncLogicHandler(ndn::Face& face, ndn::KeyChain& keyChain,
-                                   IsLsaNew isLsaNew, const ConfParameter& conf)
+                                   IsLsaNew isLsaNew, const SyncLogicOptions& opts)
   : m_isLsaNew(std::move(isLsaNew))
-  , m_confParam(conf)
-  , m_nameLsaUserPrefix(ndn::Name(m_confParam.getSyncUserPrefix()).append(boost::lexical_cast<std::string>(Lsa::Type::NAME)))
-  , m_syncLogic(face, keyChain, m_confParam.getSyncProtocol(), m_confParam.getSyncPrefix(),
-                m_nameLsaUserPrefix, m_confParam.getSyncInterestLifetime(),
+  , m_routerPrefix(opts.routerPrefix)
+  , m_hyperbolicState(opts.hyperbolicState)
+  , m_nameLsaUserPrefix(makeLsaUserPrefix(opts.userPrefix, Lsa::Type::NAME))
+  , m_adjLsaUserPrefix(makeLsaUserPrefix(opts.userPrefix, Lsa::Type::ADJACENCY))
+  , m_coorLsaUserPrefix(makeLsaUserPrefix(opts.userPrefix, Lsa::Type::COORDINATE))
+  , m_syncLogic(face, keyChain, opts.syncProtocol, opts.syncPrefix,
+                m_nameLsaUserPrefix, opts.syncInterestLifetime,
                 std::bind(&SyncLogicHandler::processUpdate, this, _1, _2, _3))
 {
-  m_adjLsaUserPrefix = ndn::Name(m_confParam.getSyncUserPrefix())
-                         .append(boost::lexical_cast<std::string>(Lsa::Type::ADJACENCY));
-  m_coorLsaUserPrefix = ndn::Name(m_confParam.getSyncUserPrefix())
-                         .append(boost::lexical_cast<std::string>(Lsa::Type::COORDINATE));
-
-  if (m_confParam.getHyperbolicState() != HYPERBOLIC_STATE_ON) {
+  if (m_hyperbolicState != HYPERBOLIC_STATE_ON) {
     m_syncLogic.addUserNode(m_adjLsaUserPrefix);
   }
 
-  if (m_confParam.getHyperbolicState() != HYPERBOLIC_STATE_OFF) {
+  if (m_hyperbolicState != HYPERBOLIC_STATE_OFF) {
     m_syncLogic.addUserNode(m_coorLsaUserPrefix);
   }
 }
@@ -83,37 +79,36 @@
 {
   NLSR_LOG_DEBUG("Origin Router of update: " << originRouter);
 
-  // A router should not try to fetch its own LSA
-  if (originRouter != m_confParam.getRouterPrefix()) {
+  if (originRouter == m_routerPrefix) {
+    // A router should not try to fetch its own LSA
+    return;
+  }
 
-    Lsa::Type lsaType;
-    std::istringstream(updateName.get(updateName.size()-1).toUri()) >> lsaType;
+  auto lsaType = boost::lexical_cast<Lsa::Type>(updateName.get(-1).toUri());
+  NLSR_LOG_DEBUG("Received sync update with higher " << lsaType <<
+                  " sequence number than entry in LSDB");
 
-    NLSR_LOG_DEBUG("Received sync update with higher " << lsaType <<
-                   " sequence number than entry in LSDB");
-
-    if (m_isLsaNew(originRouter, lsaType, seqNo, incomingFaceId)) {
-      if (lsaType == Lsa::Type::ADJACENCY && seqNo != 0 &&
-          m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_ON) {
-        NLSR_LOG_ERROR("Got an update for adjacency LSA when hyperbolic routing " <<
-                       "is enabled. Not going to fetch.");
-        return;
-      }
-
-      if (lsaType == Lsa::Type::COORDINATE && seqNo != 0 &&
-          m_confParam.getHyperbolicState() == HYPERBOLIC_STATE_OFF) {
-        NLSR_LOG_ERROR("Got an update for coordinate LSA when link-state " <<
-                       "is enabled. Not going to fetch.");
-        return;
-      }
-
-      onNewLsa(updateName, seqNo, originRouter, incomingFaceId);
+  if (m_isLsaNew(originRouter, lsaType, seqNo, incomingFaceId)) {
+    if (lsaType == Lsa::Type::ADJACENCY && seqNo != 0 &&
+        m_hyperbolicState == HYPERBOLIC_STATE_ON) {
+      NLSR_LOG_ERROR("Got an update for adjacency LSA when hyperbolic routing "
+                      "is enabled. Not going to fetch.");
+      return;
     }
+
+    if (lsaType == Lsa::Type::COORDINATE && seqNo != 0 &&
+        m_hyperbolicState == HYPERBOLIC_STATE_OFF) {
+      NLSR_LOG_ERROR("Got an update for coordinate LSA when link-state "
+                      "is enabled. Not going to fetch.");
+      return;
+    }
+
+    onNewLsa(updateName, seqNo, originRouter, incomingFaceId);
   }
 }
 
 void
-SyncLogicHandler::publishRoutingUpdate(const Lsa::Type& type, const uint64_t& seqNo)
+SyncLogicHandler::publishRoutingUpdate(Lsa::Type type, uint64_t seqNo)
 {
   switch (type) {
   case Lsa::Type::ADJACENCY:
diff --git a/src/communication/sync-logic-handler.hpp b/src/communication/sync-logic-handler.hpp
index 6eee213..3782663 100644
--- a/src/communication/sync-logic-handler.hpp
+++ b/src/communication/sync-logic-handler.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  The University of Memphis,
+ * Copyright (c) 2014-2024,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -28,14 +28,30 @@
 #include "sync-protocol-adapter.hpp"
 #include "test-access-control.hpp"
 
+#include <boost/lexical_cast.hpp>
+
 namespace nlsr {
 
-/*! \brief NLSR-to-ChronoSync interaction point
+struct SyncLogicOptions
+{
+  SyncProtocol syncProtocol;
+  ndn::Name syncPrefix;
+  ndn::Name userPrefix;
+  ndn::time::milliseconds syncInterestLifetime;
+  ndn::Name routerPrefix;
+  HyperbolicState hyperbolicState;
+};
+
+inline ndn::Name
+makeLsaUserPrefix(const ndn::Name& userPrefix, Lsa::Type lsaType)
+{
+  return ndn::Name(userPrefix).append(boost::lexical_cast<std::string>(lsaType));
+}
+
+/*! \brief NLSR-to-sync interaction point
  *
  * This class serves as the abstraction for the syncing portion of
- * NLSR and its components. NLSR has no particular reliance on
- * ChronoSync, except that the NLSR source would need to be modified
- * for use with other sync protocols.
+ * NLSR and its components.
  */
 class SyncLogicHandler
 {
@@ -46,11 +62,12 @@
     using std::runtime_error::runtime_error;
   };
 
-  using IsLsaNew =
-    std::function<bool(const ndn::Name&, const Lsa::Type& lsaType, const uint64_t&, uint64_t/*inFace*/)>;
+  using IsLsaNew = std::function<
+    bool (const ndn::Name& routerName, Lsa::Type lsaType, uint64_t seqNo, uint64_t inFace)
+  >;
 
   SyncLogicHandler(ndn::Face& face, ndn::KeyChain& keyChain,
-                   IsLsaNew isLsaNew, const ConfParameter& conf);
+                   IsLsaNew isLsaNew, const SyncLogicOptions& opts);
 
   /*! \brief Instruct ChronoSync to publish an update.
    *
@@ -62,7 +79,7 @@
    * \sa publishSyncUpdate
    */
   void
-  publishRoutingUpdate(const Lsa::Type& type, const uint64_t& seqNo);
+  publishRoutingUpdate(Lsa::Type type, uint64_t seqNo);
 
 PUBLIC_WITH_TESTS_ELSE_PRIVATE:
   /*! \brief Callback from Sync protocol
@@ -91,7 +108,8 @@
 
 private:
   IsLsaNew m_isLsaNew;
-  const ConfParameter& m_confParam;
+  ndn::Name m_routerPrefix;
+  HyperbolicState m_hyperbolicState;
 
 PUBLIC_WITH_TESTS_ELSE_PRIVATE:
   ndn::Name m_nameLsaUserPrefix;
diff --git a/src/conf-parameter.hpp b/src/conf-parameter.hpp
index 687aa1c..40eb7dd 100644
--- a/src/conf-parameter.hpp
+++ b/src/conf-parameter.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  The University of Memphis,
+ * Copyright (c) 2014-2024,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -340,12 +340,12 @@
   }
 
   void
-  setHyperbolicState(int32_t ihc)
+  setHyperbolicState(HyperbolicState ihc)
   {
     m_hyperbolicState = ihc;
   }
 
-  int32_t
+  HyperbolicState
   getHyperbolicState() const
   {
     return m_hyperbolicState;
@@ -517,7 +517,7 @@
 
   uint32_t m_infoInterestInterval;
 
-  int32_t m_hyperbolicState;
+  HyperbolicState m_hyperbolicState;
   double m_corR;
   std::vector<double> m_corTheta;
 
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index 608b575..844de22 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -36,10 +36,17 @@
   , m_scheduler(face.getIoContext())
   , m_confParam(confParam)
   , m_sync(m_face, keyChain,
-           [this] (const auto& routerName, const Lsa::Type& lsaType,
-                   uint64_t sequenceNumber, uint64_t incomingFaceId) {
-             return isLsaNew(routerName, lsaType, sequenceNumber);
-           }, m_confParam)
+      [this] (const auto& routerName, Lsa::Type lsaType, uint64_t seqNo, uint64_t) {
+        return isLsaNew(routerName, lsaType, seqNo);
+      },
+      SyncLogicOptions{
+        confParam.getSyncProtocol(),
+        confParam.getSyncPrefix(),
+        confParam.getSyncUserPrefix(),
+        confParam.getSyncInterestLifetime(),
+        confParam.getRouterPrefix(),
+        confParam.getHyperbolicState()
+      })
   , m_lsaRefreshTime(ndn::time::seconds(m_confParam.getLsaRefreshTime()))
   , m_adjLsaBuildInterval(m_confParam.getAdjLsaBuildInterval())
   , m_thisRouterPrefix(m_confParam.getRouterPrefix())
diff --git a/src/lsdb.hpp b/src/lsdb.hpp
index 1116e98..93e1ad9 100644
--- a/src/lsdb.hpp
+++ b/src/lsdb.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  The University of Memphis,
+ * Copyright (c) 2014-2024,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -220,7 +220,7 @@
     \param seqNo The sequence number to check.
   */
   bool
-  isLsaNew(const ndn::Name& originRouter, const Lsa::Type& lsaType, uint64_t seqNo) const
+  isLsaNew(const ndn::Name& originRouter, Lsa::Type lsaType, uint64_t seqNo) const
   {
     // Is the name in the LSDB and the supplied seq no is the highest so far
     auto lsaPtr = findLsa(originRouter, lsaType);
diff --git a/tests/communication/test-sync-logic-handler.cpp b/tests/communication/test-sync-logic-handler.cpp
index c259bfc..4f759e0 100644
--- a/tests/communication/test-sync-logic-handler.cpp
+++ b/tests/communication/test-sync-logic-handler.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  The University of Memphis,
+ * Copyright (c) 2014-2024,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -25,47 +25,57 @@
 #include "tests/io-key-chain-fixture.hpp"
 #include "tests/test-common.hpp"
 
-#include <boost/lexical_cast.hpp>
-
-namespace nlsr {
-namespace test {
+namespace nlsr::test {
 
 class SyncLogicFixture : public IoKeyChainFixture
 {
 public:
   SyncLogicFixture()
-    : testIsLsaNew([] (auto&&...) { return true; })
-    , updateNamePrefix(this->conf.getLsaPrefix().toUri() +
-                       this->conf.getSiteName().toUri() +
-                       "/%C1.Router/other-router/")
   {
-    m_keyChain.createIdentity(conf.getRouterPrefix());
+    m_keyChain.createIdentity(opts.routerPrefix);
+  }
+
+  SyncLogicHandler&
+  getSync()
+  {
+    if (m_sync == nullptr) {
+      m_sync.reset(new SyncLogicHandler(face, m_keyChain, testIsLsaNew, opts));
+    }
+    return *m_sync;
   }
 
   void
-  receiveUpdate(const std::string& prefix, uint64_t seqNo)
+  receiveUpdate(const ndn::Name& prefix, uint64_t seqNo)
   {
     this->advanceClocks(ndn::time::milliseconds(1), 10);
     face.sentInterests.clear();
 
     std::vector<psync::MissingDataInfo> updates;
-    updates.push_back({ndn::Name(prefix), 0, seqNo, 0});
-    sync.m_syncLogic.onPSyncUpdate(updates);
+    updates.push_back({prefix, 0, seqNo, 0});
+    getSync().m_syncLogic.onPSyncUpdate(updates);
 
     this->advanceClocks(ndn::time::milliseconds(1), 10);
   }
 
 public:
   ndn::DummyClientFace face{m_io, m_keyChain};
-  ConfParameter conf{face, m_keyChain};
-  DummyConfFileProcessor confProcessor{conf, SyncProtocol::PSYNC};
-  SyncLogicHandler::IsLsaNew testIsLsaNew;
-  SyncLogicHandler sync{face, m_keyChain, testIsLsaNew, conf};
+  SyncLogicHandler::IsLsaNew testIsLsaNew = [] (auto&&...) { return true; };
+  SyncLogicOptions opts{
+    SyncProtocol::PSYNC,
+    ndn::Name("/ndn/nlsr/sync").appendVersion(ConfParameter::SYNC_VERSION),
+    "/localhop/ndn/nlsr/LSA/site/%C1.Router/this-router",
+    ndn::time::milliseconds(SYNC_INTEREST_LIFETIME_DEFAULT),
+    "/ndn/site/%C1.Router/this-router",
+    HYPERBOLIC_STATE_OFF
+  };
 
-  const std::string updateNamePrefix;
+  ndn::Name otherRouter = "/localhop/ndn/nlsr/LSA/site/%C1.Router/other-router";
   const std::vector<Lsa::Type> lsaTypes{Lsa::Type::NAME,
                                         Lsa::Type::ADJACENCY,
                                         Lsa::Type::COORDINATE};
+
+private:
+  std::unique_ptr<SyncLogicHandler> m_sync;
 };
 
 BOOST_FIXTURE_TEST_SUITE(TestSyncLogicHandler, SyncLogicFixture)
@@ -80,11 +90,11 @@
   uint64_t syncSeqNo = 1;
 
   for (auto lsaType : {Lsa::Type::NAME, Lsa::Type::ADJACENCY}) {
-    std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType);
+    auto updateName = makeLsaUserPrefix(otherRouter, lsaType);
 
-    ndn::signal::ScopedConnection connection = this->sync.onNewLsa.connect(
+    ndn::signal::ScopedConnection connection = getSync().onNewLsa.connect(
       [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) {
-        BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName);
+        BOOST_CHECK_EQUAL(updateName, routerName);
         BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo);
         ++nCallbacks;
       });
@@ -101,17 +111,17 @@
  */
 BOOST_AUTO_TEST_CASE(UpdateForOtherHR)
 {
-  this->conf.setHyperbolicState(HYPERBOLIC_STATE_ON);
+  opts.hyperbolicState = HYPERBOLIC_STATE_ON;
 
   size_t nCallbacks = 0;
   uint64_t syncSeqNo = 1;
 
   for (auto lsaType : {Lsa::Type::NAME, Lsa::Type::COORDINATE}) {
-    std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType);
+    auto updateName = makeLsaUserPrefix(otherRouter, lsaType);
 
-    ndn::signal::ScopedConnection connection = this->sync.onNewLsa.connect(
+    ndn::signal::ScopedConnection connection = getSync().onNewLsa.connect(
       [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) {
-        BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName);
+        BOOST_CHECK_EQUAL(updateName, routerName);
         BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo);
         ++nCallbacks;
       });
@@ -128,17 +138,17 @@
  */
 BOOST_AUTO_TEST_CASE(UpdateForOtherHRDry)
 {
-  this->conf.setHyperbolicState(HYPERBOLIC_STATE_DRY_RUN);
+  opts.hyperbolicState = HYPERBOLIC_STATE_DRY_RUN;
 
   size_t nCallbacks = 0;
   uint64_t syncSeqNo = 1;
 
   for (auto lsaType : this->lsaTypes) {
-    std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(lsaType);
+    auto updateName = makeLsaUserPrefix(otherRouter, lsaType);
 
-    ndn::signal::ScopedConnection connection = this->sync.onNewLsa.connect(
+    ndn::signal::ScopedConnection connection = getSync().onNewLsa.connect(
       [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) {
-        BOOST_CHECK_EQUAL(ndn::Name{updateName}, routerName);
+        BOOST_CHECK_EQUAL(updateName, routerName);
         BOOST_CHECK_EQUAL(sequenceNumber, syncSeqNo);
         ++nCallbacks;
       });
@@ -158,19 +168,14 @@
   const uint64_t sequenceNumber = 1;
 
   for (auto lsaType : this->lsaTypes) {
-    // To ensure that we get correctly-separated components, create
-    // and modify a Name to hand off.
-    ndn::Name updateName{this->conf.getLsaPrefix()};
-    updateName.append(this->conf.getSiteName())
-              .append(this->conf.getRouterName())
-              .append(boost::lexical_cast<std::string>(lsaType));
+    auto updateName = makeLsaUserPrefix(opts.routerPrefix, lsaType);
 
-    ndn::signal::ScopedConnection connection = this->sync.onNewLsa.connect(
+    ndn::signal::ScopedConnection connection = getSync().onNewLsa.connect(
       [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) {
         BOOST_FAIL("Updates for self should not be emitted!");
       });
 
-    this->receiveUpdate(updateName.toUri(), sequenceNumber);
+    this->receiveUpdate(updateName, sequenceNumber);
   }
 
   // avoid "test case [...] did not check any assertions" message from Boost.Test
@@ -186,15 +191,14 @@
   const uint64_t sequenceNumber = 1;
 
   for (auto lsaType : this->lsaTypes) {
-    ndn::Name updateName{this->conf.getSiteName()};
-    updateName.append(this->conf.getRouterName()).append(boost::lexical_cast<std::string>(lsaType));
+    auto updateName = makeLsaUserPrefix("/site/%C1.Router/this-router", lsaType);
 
-    ndn::signal::ScopedConnection connection = this->sync.onNewLsa.connect(
+    ndn::signal::ScopedConnection connection = getSync().onNewLsa.connect(
       [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) {
         BOOST_FAIL("Malformed updates should not be emitted!");
       });
 
-    this->receiveUpdate(updateName.toUri(), sequenceNumber);
+    this->receiveUpdate(updateName, sequenceNumber);
   }
 
   // avoid "test case [...] did not check any assertions" message from Boost.Test
@@ -207,19 +211,18 @@
  */
 BOOST_AUTO_TEST_CASE(LsaNotNew)
 {
-  auto testLsaAlwaysFalse = [] (const ndn::Name& routerName, const Lsa::Type& lsaType,
-                                const uint64_t& sequenceNumber, uint64_t incomingFaceId) {
+  testIsLsaNew = [] (const ndn::Name& routerName, const Lsa::Type& lsaType,
+                     const uint64_t& sequenceNumber, uint64_t incomingFaceId) {
     return false;
   };
 
   const uint64_t sequenceNumber = 1;
-  SyncLogicHandler sync{this->face, this->m_keyChain, testLsaAlwaysFalse, this->conf};
-  ndn::signal::ScopedConnection connection = sync.onNewLsa.connect(
+  ndn::signal::ScopedConnection connection = getSync().onNewLsa.connect(
     [&] (const auto& routerName, uint64_t sequenceNumber, const auto& originRouter, uint64_t incomingFaceId) {
       BOOST_FAIL("An update for an LSA with non-new sequence number should not emit!");
     });
 
-  std::string updateName = this->updateNamePrefix + boost::lexical_cast<std::string>(Lsa::Type::NAME);
+  auto updateName = makeLsaUserPrefix(otherRouter, Lsa::Type::NAME);
   this->receiveUpdate(updateName, sequenceNumber);
 
   // avoid "test case [...] did not check any assertions" message from Boost.Test
@@ -232,19 +235,14 @@
  */
 BOOST_AUTO_TEST_CASE(UpdatePrefix)
 {
-  ndn::Name expectedPrefix = this->conf.getLsaPrefix();
-  expectedPrefix.append(this->conf.getSiteName());
-  expectedPrefix.append(this->conf.getRouterName());
-
-  BOOST_CHECK_EQUAL(this->sync.m_nameLsaUserPrefix,
-                    ndn::Name(expectedPrefix).append(boost::lexical_cast<std::string>(Lsa::Type::NAME)));
-  BOOST_CHECK_EQUAL(this->sync.m_adjLsaUserPrefix,
-                    ndn::Name(expectedPrefix).append(boost::lexical_cast<std::string>(Lsa::Type::ADJACENCY)));
-  BOOST_CHECK_EQUAL(this->sync.m_coorLsaUserPrefix,
-                    ndn::Name(expectedPrefix).append(boost::lexical_cast<std::string>(Lsa::Type::COORDINATE)));
+  BOOST_CHECK_EQUAL(getSync().m_nameLsaUserPrefix,
+                    ndn::Name(opts.userPrefix).append(boost::lexical_cast<std::string>(Lsa::Type::NAME)));
+  BOOST_CHECK_EQUAL(getSync().m_adjLsaUserPrefix,
+                    ndn::Name(opts.userPrefix).append(boost::lexical_cast<std::string>(Lsa::Type::ADJACENCY)));
+  BOOST_CHECK_EQUAL(getSync().m_coorLsaUserPrefix,
+                    ndn::Name(opts.userPrefix).append(boost::lexical_cast<std::string>(Lsa::Type::COORDINATE)));
 }
 
 BOOST_AUTO_TEST_SUITE_END()
 
-} // namespace test
-} // namespace nlsr
+} // namespace nlsr::test
diff --git a/tests/test-conf-file-processor.cpp b/tests/test-conf-file-processor.cpp
index bf7ddb3..a2b6c09 100644
--- a/tests/test-conf-file-processor.cpp
+++ b/tests/test-conf-file-processor.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  The University of Memphis,
+ * Copyright (c) 2014-2024,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -211,7 +211,7 @@
   BOOST_CHECK_EQUAL(castor.getFaceUri().toString(), "udp4://10.0.0.1:6363");
 
   // Hyperbolic
-  BOOST_CHECK_EQUAL(conf.getHyperbolicState(), 0);
+  BOOST_CHECK_EQUAL(conf.getHyperbolicState(), HYPERBOLIC_STATE_OFF);
 
   // FIB
   BOOST_CHECK_EQUAL(conf.getMaxFacesPerPrefix(), 3);
@@ -259,7 +259,7 @@
 {
   BOOST_REQUIRE(processConfigurationString(CONFIG_HYPERBOLIC));
 
-  BOOST_CHECK_EQUAL(conf.getHyperbolicState(), 1);
+  BOOST_CHECK_EQUAL(conf.getHyperbolicState(), HYPERBOLIC_STATE_ON);
   BOOST_CHECK_EQUAL(conf.getCorR(), 123.456);
   std::vector<double> angles{1.45};
   BOOST_CHECK(conf.getCorTheta() == angles);
@@ -269,7 +269,7 @@
 {
   BOOST_REQUIRE(processConfigurationString(CONFIG_HYPERBOLIC_ANGLES));
 
-  BOOST_CHECK_EQUAL(conf.getHyperbolicState(), 1);
+  BOOST_CHECK_EQUAL(conf.getHyperbolicState(), HYPERBOLIC_STATE_ON);
   BOOST_CHECK_EQUAL(conf.getCorR(), 123.456);
   std::vector<double> angles{1.45, 2.25};
   BOOST_CHECK(conf.getCorTheta() == angles);
@@ -364,7 +364,7 @@
 
   BOOST_REQUIRE(processConfigurationString(config));
 
-  BOOST_CHECK_EQUAL(conf.getHyperbolicState(), static_cast<int32_t>(HYPERBOLIC_STATE_DEFAULT));
+  BOOST_CHECK_EQUAL(conf.getHyperbolicState(), HYPERBOLIC_STATE_DEFAULT);
 }
 
 BOOST_AUTO_TEST_CASE(OutOfRangeValue)
diff --git a/tests/test-conf-parameter.cpp b/tests/test-conf-parameter.cpp
index 02fe05b..cb52323 100644
--- a/tests/test-conf-parameter.cpp
+++ b/tests/test-conf-parameter.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  The University of Memphis,
+ * Copyright (c) 2014-2024,  The University of Memphis,
  *                           Regents of the University of California
  *
  * This file is part of NLSR (Named-data Link State Routing).
@@ -62,7 +62,7 @@
 
   cp1.setMaxFacesPerPrefix(50);
 
-  cp1.setHyperbolicState(1);
+  cp1.setHyperbolicState(HYPERBOLIC_STATE_ON);
 
   cp1.setCorR(2.5);
 
@@ -98,7 +98,7 @@
 
   BOOST_CHECK_EQUAL(cp1.getMaxFacesPerPrefix(), 50);
 
-  BOOST_CHECK_EQUAL(cp1.getHyperbolicState(), 1);
+  BOOST_CHECK_EQUAL(cp1.getHyperbolicState(), HYPERBOLIC_STATE_ON);
 
   BOOST_CHECK(cp1.getCorTheta() == angles);
 
