tests: minor code cleanups

Change-Id: I9759ba4b7eb467d4d1df4b379efad91bc4f5cc3a
diff --git a/tests/tools/mock-nfd-mgmt-fixture.hpp b/tests/tools/mock-nfd-mgmt-fixture.hpp
index 3aa106b..0d5f4ba 100644
--- a/tests/tools/mock-nfd-mgmt-fixture.hpp
+++ b/tests/tools/mock-nfd-mgmt-fixture.hpp
@@ -210,14 +210,15 @@
 
 } // namespace nfd::tests
 
-/** \brief require the command in \p interest has expected prefix
- *  \note This must be used in processInterest lambda, and the Interest must be named 'interest'.
- *  \return ControlParameters, or nullopt if \p interest does match \p expectedPrefix
+/**
+ * \brief Require the command in \p interest to have the expected prefix
+ * \note This must be used in the `processInterest` lambda, and the Interest must be named `interest`.
+ * \return ControlParameters. The test case will fail if \p interest does not match \p expectedPrefix.
  */
 #define MOCK_NFD_MGMT_REQUIRE_COMMAND_IS(expectedPrefix) \
-  [interest] { \
+  [&interest] { \
     auto params = parseCommand(interest, (expectedPrefix)); \
-    BOOST_REQUIRE_MESSAGE(params, "Interest " << interest.getName() << \
+    BOOST_REQUIRE_MESSAGE(params.has_value(), "Interest " << interest.getName() << \
                           " does not match command prefix " << (expectedPrefix)); \
     return *params; \
   } ()