Added a test case for ConstructResourceTest to simulate the scenario
of Resource creation with uri having of not having "/" as its prefix.
Change-Id: Iadfc60fa67e3f5d0d2653720f5557c4a0e5279dd
Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2418
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
interfaces.empty(), m_clientWrapper.expired(), false, false);
}
+ if (uri[0] != '/')
+ {
+ throw ResourceInitException(m_uri.empty(), resourceTypes.empty(),
+ interfaces.empty(), m_clientWrapper.expired(), false, false);
+ }
+
// construct the devAddr from the pieces we have
m_devAddr.adapter = static_cast<OCTransportAdapter>(connectivityType >> CT_ADAPTER_SHIFT);
m_devAddr.flags = static_cast<OCTransportFlags>(connectivityType & CT_MASK_FLAGS);
EXPECT_ANY_THROW(ConstructResourceObject("coap://192.168.1.2:5000", "/"));
}
+ TEST(ConstructResourceTest, ConstructResourceObjectInvalidUri2)
+ {
+ EXPECT_ANY_THROW(ConstructResourceObject("coap://192.168.1.2:5000", "resource"));
+ }
+
TEST(ResourceGetTest, DISABLED_ResourceGetForValidUri)
{
OCResource::Ptr resource = ConstructResourceObject("coap://192.168.1.2:5000", "/resource");