fix some errors in tests

Change-Id: I8f160bd9f555cac5999765e0fcb83fa78c9feffe
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 60097a6..0117df7 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -153,12 +153,11 @@
   auto nameAssignmentItems = configJson.get_child_optional(CONFIG_NAME_ASSIGNMENT);
   if (nameAssignmentItems) {
     for (const auto item : *nameAssignmentItems) {
-      try {
-        m_heuristic.push_back(NameAssignmentFuncFactory::createNameAssignmentFuncFactory(item.first));
-      }
-      catch (const std::exception& e) {
+      auto func = NameAssignmentFuncFactory::createNameAssignmentFuncFactory(item.first, item.second.data());
+      if (func == nullptr) {
         BOOST_THROW_EXCEPTION(std::runtime_error("Error on creating name assignment function"));
       }
+      m_heuristic.push_back(std::move(func));
     }
   }
 }
diff --git a/src/name-assignments/assignment-funcs.cpp b/src/name-assignments/assignment-funcs.cpp
index 501c510..50c8df1 100644
--- a/src/name-assignments/assignment-funcs.cpp
+++ b/src/name-assignments/assignment-funcs.cpp
@@ -27,13 +27,17 @@
 NameAssignmentFuncFactory::NameAssignmentFuncFactory(const std::string& factoryType, const std::string& format)
   : FACTORY_TYPE(factoryType)
 {
-  auto s = format;
-  size_t pos = 0;
-  while ((pos = s.find("/")) != std::string::npos) {
-    m_nameFormat.push_back(s.substr(0, pos));
-    s.erase(0, pos + 1);
+  size_t index = 0, startIndex = 0;
+  while ((index = format.find("/", startIndex)) != std::string::npos) {
+    auto component = format.substr(startIndex, index - startIndex);
+    if (!component.empty()) {
+      m_nameFormat.push_back(component);
+    }
+    startIndex = index + 1;
   }
-  m_nameFormat.push_back(s);
+  if (startIndex != format.size()) {
+    m_nameFormat.push_back(format.substr(startIndex));
+  }
 }
 
 unique_ptr<NameAssignmentFuncFactory>