diff --git a/src/management/nfd-controller.cpp b/src/management/nfd-controller.cpp
index 0a56777..5fc755d 100644
--- a/src/management/nfd-controller.cpp
+++ b/src/management/nfd-controller.cpp
@@ -45,10 +45,15 @@
 void
 Controller::startCommand(const shared_ptr<ControlCommand>& command,
                          const ControlParameters& parameters,
-                         const CommandSucceedCallback& onSuccess,
-                         const CommandFailCallback& onFailure,
+                         const CommandSucceedCallback& onSuccess1,
+                         const CommandFailCallback& onFailure1,
                          const CommandOptions& options)
 {
+  const CommandSucceedCallback& onSuccess = onSuccess1 ?
+    onSuccess1 : [] (const ControlParameters&) {};
+  const CommandFailCallback& onFailure = onFailure1 ?
+    onFailure1 : [] (uint32_t, const std::string&) {};
+
   Name requestName = command->getRequestName(options.getPrefix(), parameters);
   Interest interest(requestName);
   interest.setInterestLifetime(options.getTimeout());
@@ -73,16 +78,14 @@
   try {
     response.wireDecode(data.getContent().blockFromValue());
   }
-  catch (tlv::Error& e) {
-    if (static_cast<bool>(onFailure))
-      onFailure(ERROR_SERVER, e.what());
+  catch (const tlv::Error& e) {
+    onFailure(ERROR_SERVER, e.what());
     return;
   }
 
   uint32_t code = response.getCode();
   if (code >= ERROR_LBOUND) {
-    if (static_cast<bool>(onFailure))
-      onFailure(code, response.getText());
+    onFailure(code, response.getText());
     return;
   }
 
@@ -90,23 +93,20 @@
   try {
     parameters.wireDecode(response.getBody());
   }
-  catch (tlv::Error& e) {
-    if (static_cast<bool>(onFailure))
-      onFailure(ERROR_SERVER, e.what());
+  catch (const tlv::Error& e) {
+    onFailure(ERROR_SERVER, e.what());
     return;
   }
 
   try {
     command->validateResponse(parameters);
   }
-  catch (ControlCommand::ArgumentError& e) {
-    if (static_cast<bool>(onFailure))
-      onFailure(ERROR_SERVER, e.what());
+  catch (const ControlCommand::ArgumentError& e) {
+    onFailure(ERROR_SERVER, e.what());
     return;
   }
 
-  if (static_cast<bool>(onSuccess))
-    onSuccess(parameters);
+  onSuccess(parameters);
 }
 
 void
diff --git a/src/management/nfd-controller.hpp b/src/management/nfd-controller.hpp
index 3ae1cf2..9fa721b 100644
--- a/src/management/nfd-controller.hpp
+++ b/src/management/nfd-controller.hpp
@@ -164,10 +164,15 @@
 template<typename Dataset>
 inline void
 Controller::fetchDataset(shared_ptr<Dataset> dataset,
-                         const std::function<void(typename Dataset::ResultType)>& onSuccess,
-                         const CommandFailCallback& onFailure,
+                         const std::function<void(typename Dataset::ResultType)>& onSuccess1,
+                         const CommandFailCallback& onFailure1,
                          const CommandOptions& options)
 {
+  const std::function<void(typename Dataset::ResultType)>& onSuccess = onSuccess1 ?
+    onSuccess1 : [] (const typename Dataset::ResultType&) {};
+  const CommandFailCallback& onFailure = onFailure1 ?
+    onFailure1 : [] (uint32_t, const std::string&) {};
+
   Name prefix = dataset->getDatasetPrefix(options.getPrefix());
   this->fetchDataset(prefix,
                      bind(&Controller::processDatasetResponse<Dataset>, this, dataset, onSuccess, onFailure, _1),
@@ -190,6 +195,7 @@
     onFailure(ERROR_SERVER, ex.what());
     return;
   }
+
   onSuccess(result);
 }
 
diff --git a/tests/unit-tests/management/nfd-controller.t.cpp b/tests/unit-tests/management/nfd-controller.t.cpp
index c2e2b6c..1beb5db 100644
--- a/tests/unit-tests/management/nfd-controller.t.cpp
+++ b/tests/unit-tests/management/nfd-controller.t.cpp
@@ -56,16 +56,19 @@
   std::vector<ControlParameters> succeeds;
 };
 
+// This test suite focuses on ControlCommand functionality of Controller.
+// Individual commands are tested in nfd-control-command.t.cpp
+// StatusDataset functionality is tested in nfd-status-dataset.t.cpp
 BOOST_FIXTURE_TEST_SUITE(TestNfdController, CommandFixture)
 
-BOOST_AUTO_TEST_CASE(CommandSuccess)
+BOOST_AUTO_TEST_CASE(Success)
 {
   ControlParameters parameters;
   parameters.setUri("tcp4://192.0.2.1:6363");
 
   BOOST_CHECK_NO_THROW(controller.start<FaceCreateCommand>(
                          parameters, succeedCallback, failCallback));
-  advanceClocks(time::milliseconds(1));
+  this->advanceClocks(time::milliseconds(1));
 
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
   const Interest& requestInterest = face.sentInterests[0];
@@ -92,7 +95,7 @@
   responseData->setContent(responsePayload.wireEncode());
   face.receive(*responseData);
 
-  advanceClocks(time::milliseconds(1));
+  this->advanceClocks(time::milliseconds(1));
 
   BOOST_CHECK_EQUAL(failCodes.size(), 0);
   BOOST_REQUIRE_EQUAL(succeeds.size(), 1);
@@ -100,7 +103,55 @@
   BOOST_CHECK_EQUAL(succeeds.back().getFaceId(), responseBody.getFaceId());
 }
 
-BOOST_AUTO_TEST_CASE(CommandInvalidRequest)
+BOOST_AUTO_TEST_CASE(SuccessNoCallback)
+{
+  ControlParameters parameters;
+  parameters.setUri("tcp4://192.0.2.1:6363");
+
+  controller.start<FaceCreateCommand>(parameters, nullptr, failCallback);
+  this->advanceClocks(time::milliseconds(1));
+
+  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+  const Interest& requestInterest = face.sentInterests[0];
+
+  ControlParameters responseBody;
+  responseBody.setUri("tcp4://192.0.2.1:6363")
+              .setFaceId(22)
+              .setFacePersistency(ndn::nfd::FacePersistency::FACE_PERSISTENCY_PERSISTENT);
+  ControlResponse responsePayload(201, "created");
+  responsePayload.setBody(responseBody.wireEncode());
+
+  auto responseData = makeData(requestInterest.getName());
+  responseData->setContent(responsePayload.wireEncode());
+  face.receive(*responseData);
+
+  BOOST_CHECK_NO_THROW(this->advanceClocks(time::milliseconds(1)));
+
+  BOOST_CHECK_EQUAL(failCodes.size(), 0);
+}
+
+BOOST_AUTO_TEST_CASE(OptionsPrefix)
+{
+  ControlParameters parameters;
+  parameters.setName("/ndn/com/example");
+  parameters.setFaceId(400);
+
+  CommandOptions options;
+  options.setPrefix("/localhop/net/example/router1/nfd");
+
+  BOOST_CHECK_NO_THROW(controller.start<RibRegisterCommand>(
+                         parameters, succeedCallback, failCallback, options));
+  this->advanceClocks(time::milliseconds(1));
+
+  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
+  const Interest& requestInterest = face.sentInterests[0];
+
+  FaceCreateCommand command;
+  BOOST_CHECK(Name("/localhop/net/example/router1/nfd/rib/register").isPrefixOf(
+              requestInterest.getName()));
+}
+
+BOOST_AUTO_TEST_CASE(InvalidRequest)
 {
   ControlParameters parameters;
   parameters.setName("ndn:/should-not-have-this-field");
@@ -111,14 +162,14 @@
                     ControlCommand::ArgumentError);
 }
 
-BOOST_AUTO_TEST_CASE(CommandErrorCode)
+BOOST_AUTO_TEST_CASE(ErrorCode)
 {
   ControlParameters parameters;
   parameters.setUri("tcp4://192.0.2.1:6363");
 
   BOOST_CHECK_NO_THROW(controller.start<FaceCreateCommand>(
                          parameters, succeedCallback, failCallback));
-  advanceClocks(time::milliseconds(1));
+  this->advanceClocks(time::milliseconds(1));
 
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
   const Interest& requestInterest = face.sentInterests[0];
@@ -128,21 +179,21 @@
   auto responseData = makeData(requestInterest.getName());
   responseData->setContent(responsePayload.wireEncode());
   face.receive(*responseData);
-  advanceClocks(time::milliseconds(1));
+  this->advanceClocks(time::milliseconds(1));
 
   BOOST_CHECK_EQUAL(succeeds.size(), 0);
   BOOST_REQUIRE_EQUAL(failCodes.size(), 1);
   BOOST_CHECK_EQUAL(failCodes.back(), 401);
 }
 
-BOOST_AUTO_TEST_CASE(CommandInvalidResponse)
+BOOST_AUTO_TEST_CASE(InvalidResponse)
 {
   ControlParameters parameters;
   parameters.setUri("tcp4://192.0.2.1:6363");
 
   BOOST_CHECK_NO_THROW(controller.start<FaceCreateCommand>(
                          parameters, succeedCallback, failCallback));
-  advanceClocks(time::milliseconds(1));
+  this->advanceClocks(time::milliseconds(1));
 
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
   const Interest& requestInterest = face.sentInterests[0];
@@ -157,54 +208,33 @@
   auto responseData = makeData(requestInterest.getName());
   responseData->setContent(responsePayload.wireEncode());
   face.receive(*responseData);
-  advanceClocks(time::milliseconds(1));
+  this->advanceClocks(time::milliseconds(1));
 
   BOOST_CHECK_EQUAL(succeeds.size(), 0);
   BOOST_REQUIRE_EQUAL(failCodes.size(), 1);
 }
 
-BOOST_AUTO_TEST_CASE(CommandNack)
+BOOST_AUTO_TEST_CASE(Nack)
 {
   ControlParameters parameters;
   parameters.setUri("tcp4://192.0.2.1:6363");
 
   BOOST_CHECK_NO_THROW(controller.start<FaceCreateCommand>(
                          parameters, succeedCallback, failCallback));
-  advanceClocks(time::milliseconds(1));
+  this->advanceClocks(time::milliseconds(1));
 
   BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
   const Interest& requestInterest = face.sentInterests[0];
 
   auto responseNack = makeNack(requestInterest, lp::NackReason::NO_ROUTE);
   face.receive(responseNack);
-  advanceClocks(time::milliseconds(1));
+  this->advanceClocks(time::milliseconds(1));
 
   BOOST_REQUIRE_EQUAL(failCodes.size(), 1);
   BOOST_CHECK_EQUAL(failCodes.back(), Controller::ERROR_NACK);
 }
 
-BOOST_AUTO_TEST_CASE(OptionsPrefix)
-{
-  ControlParameters parameters;
-  parameters.setName("/ndn/com/example");
-  parameters.setFaceId(400);
-
-  CommandOptions options;
-  options.setPrefix("/localhop/net/example/router1/nfd");
-
-  BOOST_CHECK_NO_THROW(controller.start<RibRegisterCommand>(
-                         parameters, succeedCallback, failCallback, options));
-  advanceClocks(time::milliseconds(1));
-
-  BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
-  const Interest& requestInterest = face.sentInterests[0];
-
-  FaceCreateCommand command;
-  BOOST_CHECK(Name("/localhop/net/example/router1/nfd/rib/register").isPrefixOf(
-              requestInterest.getName()));
-}
-
-BOOST_AUTO_TEST_CASE(OptionsTimeout)
+BOOST_AUTO_TEST_CASE(Timeout)
 {
   ControlParameters parameters;
   parameters.setUri("tcp4://192.0.2.1:6363");
@@ -214,16 +244,29 @@
 
   BOOST_CHECK_NO_THROW(controller.start<FaceCreateCommand>(
                          parameters, succeedCallback, failCallback, options));
-  advanceClocks(time::milliseconds(1), 101); // Face's PIT granularity is 100ms
+  this->advanceClocks(time::milliseconds(1), 101); // Face's PIT granularity is 100ms
 
   BOOST_REQUIRE_EQUAL(failCodes.size(), 1);
   BOOST_CHECK_EQUAL(failCodes.back(), Controller::ERROR_TIMEOUT);
 }
 
-BOOST_AUTO_TEST_SUITE_END() // TestController
-BOOST_AUTO_TEST_SUITE_END() // Management
+BOOST_AUTO_TEST_CASE(FailureNoCallback)
+{
+  ControlParameters parameters;
+  parameters.setUri("tcp4://192.0.2.1:6363");
 
-// Controller::fetch<Dataset> has a separate test suite in nfd-status-dataset.t.cpp
+  CommandOptions options;
+  options.setTimeout(time::milliseconds(50));
+
+  controller.start<FaceCreateCommand>(parameters, succeedCallback, nullptr, options);
+  BOOST_CHECK_NO_THROW(this->advanceClocks(time::milliseconds(100), 10));
+  // timeout
+
+  BOOST_CHECK_EQUAL(succeeds.size(), 0);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestNfdController
+BOOST_AUTO_TEST_SUITE_END() // Management
 
 } // namespace tests
 } // namespace nfd
diff --git a/tests/unit-tests/management/nfd-status-dataset.t.cpp b/tests/unit-tests/management/nfd-status-dataset.t.cpp
index bc4b495..4288d4a 100644
--- a/tests/unit-tests/management/nfd-status-dataset.t.cpp
+++ b/tests/unit-tests/management/nfd-status-dataset.t.cpp
@@ -202,6 +202,36 @@
 
 BOOST_AUTO_TEST_SUITE_END() // Failures
 
+BOOST_AUTO_TEST_SUITE(NoCallback)
+
+BOOST_AUTO_TEST_CASE(Success)
+{
+  controller.fetch<FaceDataset>(
+    nullptr,
+    failCallback);
+  this->advanceClocks(time::milliseconds(500));
+
+  FaceStatus payload;
+  payload.setFaceId(2577);
+  this->sendDataset("/localhost/nfd/faces/list", payload);
+  BOOST_CHECK_NO_THROW(this->advanceClocks(time::milliseconds(500)));
+
+  BOOST_CHECK_EQUAL(failCodes.size(), 0);
+}
+
+BOOST_AUTO_TEST_CASE(Failure)
+{
+  CommandOptions options;
+  options.setTimeout(time::milliseconds(3000));
+  controller.fetch<FaceDataset>(
+    [] (const std::vector<FaceStatus>& result) { BOOST_FAIL("fetchDataset should not succeed"); },
+    nullptr,
+    options);
+  BOOST_CHECK_NO_THROW(this->advanceClocks(time::milliseconds(500), 7));
+}
+
+BOOST_AUTO_TEST_SUITE_END() // NoCallback
+
 BOOST_AUTO_TEST_SUITE(Datasets)
 
 BOOST_AUTO_TEST_CASE(StatusGeneral)
