Fix wrong unittests in RequestHandlerTest
authorcoderhyme <jhyo.kim@samsung.com>
Tue, 7 Jul 2015 02:21:47 +0000 (11:21 +0900)
committerUze Choi <uzchoi@samsung.com>
Tue, 7 Jul 2015 09:08:31 +0000 (09:08 +0000)
The tests regarding AcceptanceMethod

Change-Id: Iaa18464b9059887c4ab229e8a5f2ca44bdad221f
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1549
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/resource-manipulation/modules/serverBuilder/unittests/RequestHandlerTest.cpp

index f937049..689948e 100644 (file)
@@ -145,18 +145,28 @@ TEST_F(SetRequestHandlerAcceptanceTest, NothingHappenedWithEmptyAttrs)
     ASSERT_EQ(ORIGIN_VALUE, server->getAttribute<int>(EXISTING));
 }
 
-
-TEST_F(SetRequestHandlerAcceptanceTest, NothingReplacedIfTypeMismatch)
+TEST_F(SetRequestHandlerAcceptanceTest, EverythingAppliedIfMethodIsAccept)
 {
     requestAttrs[EXISTING] = "";
 
     auto replaced = setRequestHandler->applyAcceptanceMethod(
              PrimitiveSetResponse::AcceptanceMethod::ACCEPT, *server, requestAttrs);
 
+     ASSERT_EQ(ORIGIN_VALUE, replaced[0].second);
+}
+
+
+TEST_F(SetRequestHandlerAcceptanceTest, NoReplaceIfMethodIsDefaultAndTypeMismatch)
+{
+    requestAttrs[EXISTING] = "";
+
+    auto replaced = setRequestHandler->applyAcceptanceMethod(
+             PrimitiveSetResponse::AcceptanceMethod::DEFAULT, *server, requestAttrs);
+
      ASSERT_TRUE(replaced.empty());
 }
 
-TEST_F(SetRequestHandlerAcceptanceTest, NothingReplacedIfRequestAttrsHasUnknownKey)
+TEST_F(SetRequestHandlerAcceptanceTest, NoReplacefMethodIsDefaultAndRequestAttrsHasUnknownKey)
 {
     constexpr char unknownKey[]{ "???" };
 
@@ -165,7 +175,7 @@ TEST_F(SetRequestHandlerAcceptanceTest, NothingReplacedIfRequestAttrsHasUnknownK
 
 
     auto replaced = setRequestHandler->applyAcceptanceMethod(
-             PrimitiveSetResponse::AcceptanceMethod::ACCEPT, *server, requestAttrs);
+             PrimitiveSetResponse::AcceptanceMethod::DEFAULT, *server, requestAttrs);
 
      ASSERT_TRUE(replaced.empty());
 }