소스 검색

Add missing key for SectionPairRow class

Patrick-Christopher Mattulat 2 년 전
부모
커밋
bce6740a89
1개의 변경된 파일36개의 추가작업 그리고 0개의 파일을 삭제
  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);
+  }
 }