Browse Source

Increase test coverage of SerializableJsonStateConnection class

Patrick-Christopher Mattulat 3 years ago
parent
commit
c512eeee47

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

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-09-14
- * Changed:         2021-05-02
+ * Changed:         2021-09-19
  *
  * */
 
@@ -26,6 +26,20 @@ namespace
       {}
   };
 
+  TEST_F(SerializableJsonStateConnectionTest, constructor_no_parameter_set)
+  {
+    EXPECT_THROW({
+                   try
+                   {
+                     ls_std::SerializableJsonStateConnection serializable{nullptr};
+                   }
+                   catch (const ls_std::IllegalArgumentException &_exception)
+                   {
+                     throw;
+                   }
+                 }, ls_std::IllegalArgumentException);
+  }
+
   // implementation
 
   TEST_F(SerializableJsonStateConnectionTest, marshal)
@@ -75,4 +89,21 @@ namespace
 
     ASSERT_STREQ(R"({"condition":false,"connectionId":"BC","stateId":"C"})", jsonString.toString().c_str());
   }
+
+  TEST_F(SerializableJsonStateConnectionTest, setValue_no_parameter_set)
+  {
+    ls_std::StateConnection stateConnection{"AB", "B"};
+    ls_std::SerializableJsonStateConnection serializable{std::make_shared<ls_std::StateConnection>(stateConnection)};
+
+    EXPECT_THROW({
+                   try
+                   {
+                     serializable.setValue(nullptr);
+                   }
+                   catch (const ls_std::IllegalArgumentException &_exception)
+                   {
+                     throw;
+                   }
+                 }, ls_std::IllegalArgumentException);
+  }
 }