Browse Source

Increase test coverage of SerializableJsonStateMachine class

Patrick-Christopher Mattulat 2 years ago
parent
commit
eef61bdbb4

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

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-09-17
- * Changed:         2021-05-28
+ * Changed:         2021-09-19
  *
  * */
 
@@ -28,6 +28,20 @@ namespace
       {}
   };
 
+  TEST_F(SerializableJsonStateMachineTest, constructor_no_parameter_set)
+  {
+    EXPECT_THROW({
+                   try
+                   {
+                     ls_std::SerializableJsonStateMachine serializable{nullptr};
+                   }
+                   catch (const ls_std::IllegalArgumentException &_exception)
+                   {
+                     throw;
+                   }
+                 }, ls_std::IllegalArgumentException);
+  }
+
   // implementation
 
   TEST_F(SerializableJsonStateMachineTest, marshal)
@@ -120,4 +134,21 @@ namespace
     serializable.setValue(x);
     ASSERT_TRUE(serializable.getValue() == x);
   }
+
+  TEST_F(SerializableJsonStateMachineTest, setValue_no_parameter_set)
+  {
+    std::shared_ptr<ls_std::StateMachine> stateMachine = std::make_shared<ls_std::StateMachine>("bla");
+    ls_std::SerializableJsonStateMachine serializable{stateMachine};
+
+    EXPECT_THROW({
+                   try
+                   {
+                     serializable.setValue(nullptr);
+                   }
+                   catch (const ls_std::IllegalArgumentException &_exception)
+                   {
+                     throw;
+                   }
+                 }, ls_std::IllegalArgumentException);
+  }
 }