Browse Source

Add missing key for SectionPairRow class

Patrick-Christopher Mattulat 2 years ago
parent
commit
bce6740a89
1 changed files with 36 additions and 0 deletions
  1. 36 0
      test/cases/io/section-pair/model/SectionPairRowTest.cpp

+ 36 - 0
test/cases/io/section-pair/model/SectionPairRowTest.cpp

@@ -102,4 +102,40 @@ namespace
 
     ASSERT_STREQ("colors", row.getKey().c_str());
   }
+
+  TEST_F(SectionPairRowTest, setKey_empty_key)
+  {
+    SectionPairRow row("tmp-key", SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE);
+
+    EXPECT_THROW(
+        {
+          try
+          {
+            row.setKey("");
+          }
+          catch (const IllegalArgumentException &_exception)
+          {
+            throw;
+          }
+        },
+        IllegalArgumentException);
+  }
+
+  TEST_F(SectionPairRowTest, setKey_invalid_key)
+  {
+    SectionPairRow row("tmp-key", SectionPairRowEnumType::SECTION_PAIR_ROW_SINGLE_VALUE);
+
+    EXPECT_THROW(
+        {
+          try
+          {
+            row.setKey("=33");
+          }
+          catch (const IllegalArgumentException &_exception)
+          {
+            throw;
+          }
+        },
+        IllegalArgumentException);
+  }
 }