Add unittest for ConstructResourceTest
authorRavi Nanjundappa <nravi.n@samsung.com>
Wed, 5 Aug 2015 10:26:02 +0000 (15:56 +0530)
committerErich Keane <erich.keane@intel.com>
Wed, 5 Aug 2015 16:47:53 +0000 (16:47 +0000)
Added a test case for ConstructResourceTest to simulate the
scenario of Resource creation with host not having port number.

Change-Id: Ia9ffa317956b8c73dca16a0701c9fd28c8cbaed1
Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2115
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/unittests/OCResourceTest.cpp

index bdc870fdfce219369732a4a4e45d3c76d1958def..2a3c1422fb1cf219afc246a1d6f9a450de2eaba1 100644 (file)
@@ -71,6 +71,11 @@ namespace OCResourceTest
         EXPECT_ANY_THROW(ConstructResourceObject(std::string(""), std::string("")));
     }
 
+    TEST(ConstructResourceTest, ConstructResourceObjectWithoutPortNumber)
+    {
+        EXPECT_ANY_THROW(ConstructResourceObject("coap://192.168.1.2", "/resource"));
+    }
+
     TEST(ResourceGetTest, DISABLED_ResourceGetForValidUri)
     {
         OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");