Browse Source

Increase test coverage of SerializableJsonState class

Patrick-Christopher Mattulat 3 years ago
parent
commit
fcee178976
1 changed files with 32 additions and 1 deletions
  1. 32 1
      test/cases/serialization/json/logic/SerializableJsonStateTest.cpp

+ 32 - 1
test/cases/serialization/json/logic/SerializableJsonStateTest.cpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-09-15
- * Changed:         2021-05-02
+ * Changed:         2021-09-19
  *
  * */
 
@@ -26,6 +26,20 @@ namespace
       {}
   };
 
+  TEST_F(SerializableJsonStateTest, constructor_no_parameter_set)
+  {
+    EXPECT_THROW({
+                   try
+                   {
+                     ls_std::SerializableJsonState serializable{nullptr};
+                   }
+                   catch (const ls_std::IllegalArgumentException &_exception)
+                   {
+                     throw;
+                   }
+                 }, ls_std::IllegalArgumentException);
+  }
+
   TEST_F(SerializableJsonStateTest, marshal)
   {
     std::shared_ptr<ls_std::State> x = std::make_shared<ls_std::State>("A");
@@ -89,4 +103,21 @@ namespace
 
     ASSERT_STREQ(R"({"id":"B"})", jsonString.c_str());
   }
+
+  TEST_F(SerializableJsonStateTest, setValue_parameter_not_set)
+  {
+    std::shared_ptr<ls_std::State> state = std::make_shared<ls_std::State>("A");
+    ls_std::SerializableJsonState serializable{state};
+
+    EXPECT_THROW({
+                   try
+                   {
+                     serializable.setValue(nullptr);
+                   }
+                   catch (const ls_std::IllegalArgumentException &_exception)
+                   {
+                     throw;
+                   }
+                 }, ls_std::IllegalArgumentException);
+  }
 }