arpadboda commented on a change in pull request #585: MINIFICPP-910 - Extend StringUtils with string join capability URL: https://github.com/apache/nifi-minifi-cpp/pull/585#discussion_r291472638
########## File path: libminifi/test/unit/StringUtilsTests.cpp ########## @@ -17,32 +17,36 @@ */ #include <string> +#include <list> +#include <set> #include <vector> #include <cstdlib> #include "../TestBase.h" #include "core/Core.h" #include "utils/StringUtils.h" -using org::apache::nifi::minifi::utils::StringUtils; +using org::apache::nifi::minifi::utils::StringUtils::split; +using org::apache::nifi::minifi::utils::StringUtils::replaceEnvironmentVariables; +using org::apache::nifi::minifi::utils::StringUtils::join; TEST_CASE("TestStringUtils::split", "[test split no delimiter]") { std::vector<std::string> expected = { "hello" }; - REQUIRE(expected == StringUtils::split("hello", ",")); + REQUIRE(expected == split("hello", ",")); } TEST_CASE("TestStringUtils::split2", "[test split single delimiter]") { std::vector<std::string> expected = { "hello", "world" }; - REQUIRE(expected == StringUtils::split("hello world", " ")); + REQUIRE(expected == split("hello world", " ")); } TEST_CASE("TestStringUtils::split3", "[test split multiple delimiter]") { std::vector<std::string> expected = { "hello", "world", "I'm", "a", "unit", "test" }; - REQUIRE(expected == StringUtils::split("hello world I'm a unit test", " ")); + REQUIRE(expected == split("hello world I'm a unit test", " ")); } TEST_CASE("TestStringUtils::split4", "[test split classname]") { std::vector<std::string> expected = { "org", "apache", "nifi", "minifi", "utils", "StringUtils" }; - REQUIRE(expected == StringUtils::split(org::apache::nifi::minifi::core::getClassName<org::apache::nifi::minifi::utils::StringUtils>(), "::")); + REQUIRE(expected == split("org::apache::nifi::minifi::utils::StringUtils", "::")); Review comment: That's true, but it basically it wasn't a nice idea to add a bunch of util function to a class instead of a namespace. I agree that this is a useful test, I will find another class and use split on the name of that. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services