Explorar o código

Add missing key for SectionPairRow class

Patrick-Christopher Mattulat %!s(int64=2) %!d(string=hai) anos
pai
achega
bce6740a89
Modificáronse 1 ficheiros con 36 adicións e 0 borrados
  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);
+  }
 }