Kaynağa Gözat

Add message new line formatter for section pair classes

Patrick-Christopher Mattulat 1 yıl önce
ebeveyn
işleme
c04dc66b3b
19 değiştirilmiş dosya ile 171 ekleme ve 43 silme
  1. 16 14
      CMakeLists.txt
  2. 29 0
      include/ls-std/io/section-pair/SectionPairMessageFormatter.hpp
  3. 2 1
      include/ls-std/ls-std-io.hpp
  4. 24 0
      source/ls-std/io/section-pair/SectionPairMessageFormatter.cpp
  5. 3 2
      source/ls-std/io/section-pair/evaluator/SectionPairIdentifierArgumentEvaluator.cpp
  6. 3 2
      source/ls-std/io/section-pair/evaluator/SectionPairRowArgumentEvaluator.cpp
  7. 3 2
      source/ls-std/io/section-pair/evaluator/SectionPairRowListValueArgumentEvaluator.cpp
  8. 3 2
      source/ls-std/io/section-pair/evaluator/SectionPairRowSingleValueArgumentEvaluator.cpp
  9. 3 2
      source/ls-std/io/section-pair/evaluator/SectionPairSectionArgumentEvaluator.cpp
  10. 3 2
      source/ls-std/io/section-pair/evaluator/SectionPairValueArgumentEvaluator.cpp
  11. 4 2
      source/ls-std/io/section-pair/model/SectionPairDocument.cpp
  12. 1 2
      source/ls-std/io/section-pair/model/SectionPairRowListValue.cpp
  13. 3 2
      source/ls-std/io/section-pair/model/SectionPairSection.cpp
  14. 1 2
      source/ls-std/io/section-pair/validator/SectionPairFileExtensionValidator.cpp
  15. 65 0
      test/cases/io/section-pair/SectionPairMessageFormatterTest.cpp
  16. 2 2
      test/cases/io/section-pair/evaluator/SectionPairRowArgumentEvaluatorTest.cpp
  17. 2 2
      test/cases/io/section-pair/evaluator/SectionPairRowListValueArgumentEvaluatorTest.cpp
  18. 2 2
      test/cases/io/section-pair/evaluator/SectionPairRowSingleValueArgumentEvaluatorTest.cpp
  19. 2 2
      test/cases/io/section-pair/evaluator/SectionPairSectionArgumentEvaluatorTest.cpp

+ 16 - 14
CMakeLists.txt

@@ -185,6 +185,12 @@ set(SOURCE_FILES_IO
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/model/SectionPairSection.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/reader/SectionPairFileReader.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/reader/SectionPairFileReaderParameter.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairDocument.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairParameter.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairRow.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairRowListValue.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairRowSingleValue.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairSection.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/validator/SectionPairDocumentValidator.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/validator/SectionPairFileExtensionValidator.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/validator/SectionPairIdentifierValidator.cpp
@@ -193,12 +199,7 @@ set(SOURCE_FILES_IO
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/validator/SectionPairRowValidator.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/validator/SectionPairSectionValidator.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/validator/SectionPairValueValidator.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairDocument.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairParameter.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairRow.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairRowListValue.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairRowSingleValue.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/serialization/SerializableSectionPairSection.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/section-pair/SectionPairMessageFormatter.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlAttribute.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlDeclaration.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/ls-std/io/xml/XmlDocument.cpp
@@ -287,14 +288,6 @@ if (${LS_STD_BUILD_WITH_TESTS})
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/evaluator/SectionPairRowSingleValueArgumentEvaluatorTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/evaluator/SectionPairSectionArgumentEvaluatorTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/evaluator/SectionPairValueArgumentEvaluatorTest.cpp
-            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairDocumentValidatorTest.cpp
-            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairFileExtensionValidatorTest.cpp
-            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairIdentifierValidatorTest.cpp
-            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairRowListValueValidatorTest.cpp
-            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairRowSingleValueValidatorTest.cpp
-            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairRowValidatorTest.cpp
-            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairSectionValidatorTest.cpp
-            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairValueValidatorTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/model/SectionPairDocumentTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/model/SectionPairRowListValueTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/model/SectionPairRowSingleValueTest.cpp
@@ -308,6 +301,15 @@ if (${LS_STD_BUILD_WITH_TESTS})
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/serialization/SerializableSectionPairRowSingleValueTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/serialization/SerializableSectionPairRowTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/serialization/SerializableSectionPairSectionTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairDocumentValidatorTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairFileExtensionValidatorTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairIdentifierValidatorTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairRowListValueValidatorTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairRowSingleValueValidatorTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairRowValidatorTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairSectionValidatorTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/validator/SectionPairValueValidatorTest.cpp
+            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/section-pair/SectionPairMessageFormatterTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlAttributeTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlDeclarationTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/io/xml/XmlDocumentTest.cpp

+ 29 - 0
include/ls-std/io/section-pair/SectionPairMessageFormatter.hpp

@@ -0,0 +1,29 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-22
+* Changed:         2023-02-22
+*
+* */
+
+#ifndef LS_STD_SECTION_PAIR_MESSAGE_FORMATTER_HPP
+#define LS_STD_SECTION_PAIR_MESSAGE_FORMATTER_HPP
+
+#include <ls-std/os/dynamic-goal.hpp>
+#include <string>
+
+namespace ls::std::io
+{
+  class LS_STD_DYNAMIC_GOAL SectionPairMessageFormatter
+  {
+    public:
+
+      SectionPairMessageFormatter();
+      ~SectionPairMessageFormatter();
+
+      [[nodiscard]] static ::std::string getFormattedMessage(const ::std::string &_message);
+  };
+}
+
+#endif

+ 2 - 1
include/ls-std/ls-std-io.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2022-05-14
- * Changed:         2023-02-21
+ * Changed:         2023-02-22
  *
  * */
 
@@ -16,6 +16,7 @@
 #include <ls-std/io/logging/LogLevelValue.hpp>
 #include <ls-std/io/logging/Logger.hpp>
 
+#include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
 #include <ls-std/io/section-pair/SectionPairRowEnumType.hpp>
 #include <ls-std/io/section-pair/SectionPairTypes.hpp>
 #include <ls-std/io/section-pair/evaluator/SectionPairIdentifierArgumentEvaluator.hpp>

+ 24 - 0
source/ls-std/io/section-pair/SectionPairMessageFormatter.cpp

@@ -0,0 +1,24 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-22
+* Changed:         2023-02-22
+*
+* */
+
+#include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
+#include <regex>
+
+ls::std::io::SectionPairMessageFormatter::SectionPairMessageFormatter() = default;
+
+ls::std::io::SectionPairMessageFormatter::~SectionPairMessageFormatter() = default;
+
+::std::string ls::std::io::SectionPairMessageFormatter::getFormattedMessage(const ::std::string &_message)
+{
+  ::std::string formattedMessage = _message;
+  formattedMessage = ::std::regex_replace(formattedMessage, ::std::regex(R"(\r{1}\n{1})"), "{WINDOWS_LINE_BREAK}");
+  formattedMessage = ::std::regex_replace(formattedMessage, ::std::regex(R"(\n{1})"), "{UNIX_LINE_BREAK}");
+
+  return formattedMessage;
+}

+ 3 - 2
source/ls-std/io/section-pair/evaluator/SectionPairIdentifierArgumentEvaluator.cpp

@@ -3,11 +3,12 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-09
-* Changed:         2023-02-19
+* Changed:         2023-02-22
 *
 * */
 
 #include <ls-std/core/exception/IllegalArgumentException.hpp>
+#include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
 #include <ls-std/io/section-pair/evaluator/SectionPairIdentifierArgumentEvaluator.hpp>
 #include <ls-std/io/section-pair/validator/SectionPairIdentifierValidator.hpp>
 #include <string>
@@ -22,6 +23,6 @@ void ls::std::io::SectionPairIdentifierArgumentEvaluator::evaluate()
   if (!ls::std::io::SectionPairIdentifierValidator{this->identifier}.isValid())
   {
     ::std::string message = "\"" + this->identifier + "\" is not a valid identifier!";
-    throw ls::std::core::IllegalArgumentException{message};
+    throw ls::std::core::IllegalArgumentException{ls::std::io::SectionPairMessageFormatter::getFormattedMessage(message)};
   }
 }

+ 3 - 2
source/ls-std/io/section-pair/evaluator/SectionPairRowArgumentEvaluator.cpp

@@ -3,11 +3,12 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-20
-* Changed:         2023-02-20
+* Changed:         2023-02-22
 *
 * */
 
 #include <ls-std/core/exception/IllegalArgumentException.hpp>
+#include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
 #include <ls-std/io/section-pair/evaluator/SectionPairRowArgumentEvaluator.hpp>
 #include <ls-std/io/section-pair/validator/SectionPairRowValidator.hpp>
 #include <string>
@@ -22,6 +23,6 @@ void ls::std::io::SectionPairRowArgumentEvaluator::evaluate()
   if (!ls::std::io::SectionPairRowValidator{this->sectionPairRow}.isValid())
   {
     ::std::string message = "\"" + this->sectionPairRow + "\" is not a valid section pair row!";
-    throw ls::std::core::IllegalArgumentException{message};
+    throw ls::std::core::IllegalArgumentException{ls::std::io::SectionPairMessageFormatter::getFormattedMessage(message)};
   }
 }

+ 3 - 2
source/ls-std/io/section-pair/evaluator/SectionPairRowListValueArgumentEvaluator.cpp

@@ -3,11 +3,12 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-20
-* Changed:         2023-02-20
+* Changed:         2023-02-22
 *
 * */
 
 #include <ls-std/core/exception/IllegalArgumentException.hpp>
+#include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
 #include <ls-std/io/section-pair/evaluator/SectionPairRowListValueArgumentEvaluator.hpp>
 #include <ls-std/io/section-pair/validator/SectionPairRowListValueValidator.hpp>
 
@@ -21,6 +22,6 @@ void ls::std::io::SectionPairRowListValueArgumentEvaluator::evaluate()
   if (!ls::std::io::SectionPairRowListValueValidator{this->listValueRow}.isValid())
   {
     ::std::string message = "\"" + this->listValueRow + "\" is not a valid section pair list value row!";
-    throw ls::std::core::IllegalArgumentException{message};
+    throw ls::std::core::IllegalArgumentException{ls::std::io::SectionPairMessageFormatter::getFormattedMessage(message)};
   }
 }

+ 3 - 2
source/ls-std/io/section-pair/evaluator/SectionPairRowSingleValueArgumentEvaluator.cpp

@@ -3,11 +3,12 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-19
-* Changed:         2023-02-19
+* Changed:         2023-02-22
 *
 * */
 
 #include <ls-std/core/exception/IllegalArgumentException.hpp>
+#include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
 #include <ls-std/io/section-pair/evaluator/SectionPairRowSingleValueArgumentEvaluator.hpp>
 #include <ls-std/io/section-pair/validator/SectionPairRowSingleValueValidator.hpp>
 
@@ -21,6 +22,6 @@ void ls::std::io::SectionPairRowSingleValueArgumentEvaluator::evaluate()
   if (!ls::std::io::SectionPairRowSingleValueValidator{this->singleValueRow}.isValid())
   {
     ::std::string message = "\"" + this->singleValueRow + "\" is not a valid section pair single value row!";
-    throw ls::std::core::IllegalArgumentException{message};
+    throw ls::std::core::IllegalArgumentException{ls::std::io::SectionPairMessageFormatter::getFormattedMessage(message)};
   }
 }

+ 3 - 2
source/ls-std/io/section-pair/evaluator/SectionPairSectionArgumentEvaluator.cpp

@@ -3,11 +3,12 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-20
-* Changed:         2023-02-20
+* Changed:         2023-02-22
 *
 * */
 
 #include <ls-std/core/exception/IllegalArgumentException.hpp>
+#include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
 #include <ls-std/io/section-pair/evaluator/SectionPairSectionArgumentEvaluator.hpp>
 #include <ls-std/io/section-pair/validator/SectionPairSectionValidator.hpp>
 
@@ -21,6 +22,6 @@ void ls::std::io::SectionPairSectionArgumentEvaluator::evaluate()
   if (!ls::std::io::SectionPairSectionValidator{this->section}.isValid())
   {
     ::std::string message = "\"" + this->section + "\" is not a valid section!";
-    throw ls::std::core::IllegalArgumentException{message};
+    throw ls::std::core::IllegalArgumentException{ls::std::io::SectionPairMessageFormatter::getFormattedMessage(message)};
   }
 }

+ 3 - 2
source/ls-std/io/section-pair/evaluator/SectionPairValueArgumentEvaluator.cpp

@@ -3,11 +3,12 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-10
-* Changed:         2023-02-19
+* Changed:         2023-02-22
 *
 * */
 
 #include <ls-std/core/exception/IllegalArgumentException.hpp>
+#include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
 #include <ls-std/io/section-pair/evaluator/SectionPairValueArgumentEvaluator.hpp>
 #include <ls-std/io/section-pair/validator/SectionPairValueValidator.hpp>
 
@@ -21,6 +22,6 @@ void ls::std::io::SectionPairValueArgumentEvaluator::evaluate()
   if (!ls::std::io::SectionPairValueValidator(this->value).isValid())
   {
     ::std::string message = "\"" + this->value + "\" is not a valid value!";
-    throw ls::std::core::IllegalArgumentException{message};
+    throw ls::std::core::IllegalArgumentException{ls::std::io::SectionPairMessageFormatter::getFormattedMessage(message)};
   }
 }

+ 4 - 2
source/ls-std/io/section-pair/model/SectionPairDocument.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-15
-* Changed:         2023-02-21
+* Changed:         2023-02-22
 *
 * */
 
@@ -11,6 +11,7 @@
 #include <ls-std/core/evaluator/IndexOutOfBoundsEvaluator.hpp>
 #include <ls-std/core/evaluator/NullPointerArgumentEvaluator.hpp>
 #include <ls-std/core/exception/IllegalArgumentException.hpp>
+#include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
 #include <ls-std/io/section-pair/model/SectionPairDocument.hpp>
 #include <ls-std/io/section-pair/serialization/SerializableSectionPairDocument.hpp>
 
@@ -88,7 +89,8 @@ void ls::std::io::SectionPairDocument::_checkSectionExistence(const ls::std::io:
 {
   if (this->_hasSection(_sectionId))
   {
-    throw ls::std::core::IllegalArgumentException{this->getClassName() + "section ID \"" + _sectionId + "\" already exists in document!"};
+    ::std::string message = this->getClassName() + "section ID \"" + _sectionId + "\" already exists in document!";
+    throw ls::std::core::IllegalArgumentException{ls::std::io::SectionPairMessageFormatter::getFormattedMessage(message)};
   }
 }
 

+ 1 - 2
source/ls-std/io/section-pair/model/SectionPairRowListValue.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-10
-* Changed:         2023-02-19
+* Changed:         2023-02-22
 *
 * */
 
@@ -13,7 +13,6 @@
 #include <ls-std/io/section-pair/evaluator/SectionPairValueArgumentEvaluator.hpp>
 #include <ls-std/io/section-pair/model/SectionPairRowListValue.hpp>
 #include <ls-std/io/section-pair/serialization/SerializableSectionPairRowListValue.hpp>
-#include <string>
 
 ls::std::io::SectionPairRowListValue::SectionPairRowListValue() : ls::std::core::Class("SectionPairRowListValue"), ls::std::io::SectionPairRowValue(ls::std::io::SectionPairRowEnumType::SECTION_PAIR_ROW_LIST_VALUE)
 {}

+ 3 - 2
source/ls-std/io/section-pair/model/SectionPairSection.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-13
-* Changed:         2023-02-19
+* Changed:         2023-02-22
 *
 * */
 
@@ -12,6 +12,7 @@
 #include <ls-std/core/evaluator/IndexOutOfBoundsEvaluator.hpp>
 #include <ls-std/core/evaluator/NullPointerArgumentEvaluator.hpp>
 #include <ls-std/core/exception/IllegalArgumentException.hpp>
+#include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
 #include <ls-std/io/section-pair/evaluator/SectionPairIdentifierArgumentEvaluator.hpp>
 #include <ls-std/io/section-pair/model/SectionPairSection.hpp>
 #include <ls-std/io/section-pair/serialization/SerializableSectionPairSection.hpp>
@@ -126,7 +127,7 @@ void ls::std::io::SectionPairSection::_rowExistenceCheck(const ls::std::io::sect
   if (this->_hasRow(_key))
   {
     ::std::string message = this->getClassName() + ": row key \"" + _key + "\" already exists in section \"" + this->sectionId + "\"!";
-    throw ls::std::core::IllegalArgumentException{message};
+    throw ls::std::core::IllegalArgumentException{ls::std::io::SectionPairMessageFormatter::getFormattedMessage(message)};
   }
 }
 void ls::std::io::SectionPairSection::_setSectionId(const ls::std::io::section_pair_identifier &_sectionId)

+ 1 - 2
source/ls-std/io/section-pair/validator/SectionPairFileExtensionValidator.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-21
-* Changed:         2023-02-21
+* Changed:         2023-02-22
 *
 * */
 
@@ -21,6 +21,5 @@ bool ls::std::io::SectionPairFileExtensionValidator::isValid()
   bool endsWithTextFileExtension = this->fileName.rfind(textFileExtension) == (this->fileName.size() - textFileExtension.size());
   bool endsWithSectionPairFileExtension = this->fileName.rfind(sectionPairFileExtension) == (this->fileName.size() - sectionPairFileExtension.size());
 
-
   return endsWithTextFileExtension || endsWithSectionPairFileExtension;
 }

+ 65 - 0
test/cases/io/section-pair/SectionPairMessageFormatterTest.cpp

@@ -0,0 +1,65 @@
+/*
+* Author:          Patrick-Christopher Mattulat
+* Company:         Lynar Studios
+* E-Mail:          webmaster@lynarstudios.com
+* Created:         2023-02-22
+* Changed:         2023-02-22
+*
+* */
+
+#include <array>
+#include <gtest/gtest.h>
+#include <ls-std/ls-std-io.hpp>
+#include <string>
+
+using namespace ls::std::io;
+using namespace ::std;
+
+namespace
+{
+  class SectionPairMessageFormatterTest : public ::testing::TestWithParam<array<string, 2>>
+  {
+    protected:
+
+      SectionPairMessageFormatterTest() = default;
+      ~SectionPairMessageFormatterTest() override = default;
+
+      void SetUp() override
+      {}
+
+      void TearDown() override
+      {}
+
+    public:
+
+      static string getFormattedExampleMessage(const string &_replacementString)
+      {
+        string formattedMessage = _replacementString + "[general]" + _replacementString + _replacementString;
+        formattedMessage += "name=Tina" + _replacementString;
+        formattedMessage += "age=17" + _replacementString;
+        formattedMessage += "birthday=25.01.2006" + _replacementString;
+
+        return formattedMessage;
+      }
+
+      static string getOriginalExampleMessage(const string &_newLine)
+      {
+        string formattedMessage = _newLine + "[general]" + _newLine + _newLine;
+        formattedMessage += "name=Tina" + _newLine;
+        formattedMessage += "age=17" + _newLine;
+        formattedMessage += "birthday=25.01.2006" + _newLine;
+
+        return formattedMessage;
+      }
+  };
+
+  TEST_P(SectionPairMessageFormatterTest, getFormattedMessage)
+  {
+    string expected = GetParam().at(0);
+    string actual = SectionPairMessageFormatter::getFormattedMessage(GetParam().at(1));
+
+    ASSERT_STREQ(expected.c_str(), actual.c_str());
+  }
+
+  INSTANTIATE_TEST_SUITE_P(ValidArgumentTest, SectionPairMessageFormatterTest, ::testing::Values(array<string, 2>{SectionPairMessageFormatterTest::getFormattedExampleMessage("{UNIX_LINE_BREAK}"), SectionPairMessageFormatterTest::getOriginalExampleMessage("\n")}, array<string, 2>{SectionPairMessageFormatterTest::getFormattedExampleMessage("{WINDOWS_LINE_BREAK}"), SectionPairMessageFormatterTest::getOriginalExampleMessage("\r\n")}));
+}

+ 2 - 2
test/cases/io/section-pair/evaluator/SectionPairRowArgumentEvaluatorTest.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-20
-* Changed:         2023-02-20
+* Changed:         2023-02-22
 *
 * */
 
@@ -59,7 +59,7 @@ namespace
             ::std::string actual = _exception.what();
             ::std::string expected = "IllegalArgumentException thrown - \"" + GetParam() + "\" is not a valid section pair row!";
 
-            ASSERT_STREQ(expected.c_str(), actual.c_str());
+            ASSERT_STREQ(SectionPairMessageFormatter::getFormattedMessage(expected).c_str(), actual.c_str());
             throw;
           }
         },

+ 2 - 2
test/cases/io/section-pair/evaluator/SectionPairRowListValueArgumentEvaluatorTest.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-20
-* Changed:         2023-02-20
+* Changed:         2023-02-22
 *
 * */
 
@@ -59,7 +59,7 @@ namespace
             ::std::string actual = _exception.what();
             ::std::string expected = "IllegalArgumentException thrown - \"" + GetParam() + "\" is not a valid section pair list value row!";
 
-            ASSERT_STREQ(expected.c_str(), actual.c_str());
+            ASSERT_STREQ(SectionPairMessageFormatter::getFormattedMessage(expected).c_str(), actual.c_str());
             throw;
           }
         },

+ 2 - 2
test/cases/io/section-pair/evaluator/SectionPairRowSingleValueArgumentEvaluatorTest.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-19
-* Changed:         2023-02-20
+* Changed:         2023-02-22
 *
 * */
 
@@ -59,7 +59,7 @@ namespace
             ::std::string actual = _exception.what();
             ::std::string expected = "IllegalArgumentException thrown - \"" + GetParam() + "\" is not a valid section pair single value row!";
 
-            ASSERT_STREQ(expected.c_str(), actual.c_str());
+            ASSERT_STREQ(SectionPairMessageFormatter::getFormattedMessage(expected).c_str(), actual.c_str());
             throw;
           }
         },

+ 2 - 2
test/cases/io/section-pair/evaluator/SectionPairSectionArgumentEvaluatorTest.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-20
-* Changed:         2023-02-20
+* Changed:         2023-02-22
 *
 * */
 
@@ -59,7 +59,7 @@ namespace
             ::std::string actual = _exception.what();
             ::std::string expected = "IllegalArgumentException thrown - \"" + GetParam() + "\" is not a valid section!";
 
-            ASSERT_STREQ(expected.c_str(), actual.c_str());
+            ASSERT_STREQ(SectionPairMessageFormatter::getFormattedMessage(expected).c_str(), actual.c_str());
             throw;
           }
         },