[Easy-setup] Unit test case fixes for Mediator SDK
authorJay Sharma <jay.sharma@samsung.com>
Mon, 21 Mar 2016 12:19:09 +0000 (17:49 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Thu, 24 Mar 2016 11:08:12 +0000 (11:08 +0000)
Change-Id: I3a6d37b7aafb29aecf197f05b6bd801e7378996a
Signed-off-by: Jay Sharma <jay.sharma@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/6125
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/easy-setup/mediator/richsdk/unittests/MediatorRichTest.cpp

index 3b0e7aa..e2b67ef 100644 (file)
@@ -227,8 +227,15 @@ TEST_F(MediatorRichTest, testStartProvisioning)
     remoteEnrollee = EasySetup::getInstance()->createEnrolleeDevice(netInfo, onboardingConn);
     remoteEnrollee->registerEasySetupStatusHandler(&easySetupStatusCallback);
 
-    //calling the APIs
+#ifdef REMOTE_ARDUINO_ENROLEE
     EXPECT_NO_THROW(remoteEnrollee->startProvisioning());
+
+#else
+    /* It will throw the exception
+     * as it will not able to discover the provisioning resource in the network
+     */
+    EXPECT_ANY_THROW(remoteEnrollee->startProvisioning());
+#endif
 }
 
 //startProvisioning [Negative]
@@ -249,9 +256,9 @@ TEST_F(MediatorRichTest, testStartProvisioningNegative)
 
     remoteEnrollee = EasySetup::getInstance()->createEnrolleeDevice(netInfo, onboardingConn);
 
-    /*We are not registering the EasySetupStatusHandler that is why startProvisioning
-       will throw the Exception &  we are checking the same
-    */
+    /* We are not registering the EasySetupStatusHandler, so startProvisioning
+     * will throw the Exception &  we are checking the same
+     */
     EXPECT_ANY_THROW(remoteEnrollee->startProvisioning());
 }
 
@@ -274,9 +281,21 @@ TEST_F(MediatorRichTest, testStopProvisioning)
     remoteEnrollee = EasySetup::getInstance()->createEnrolleeDevice(netInfo, onboardingConn);
     remoteEnrollee->registerEasySetupStatusHandler(&easySetupStatusCallback);
 
-    remoteEnrollee->startProvisioning();
+#ifdef REMOTE_ARDUINO_ENROLEE
+        EXPECT_NO_THROW(remoteEnrollee->startProvisioning());
+        EXPECT_NO_THROW(remoteEnrollee->stopProvisioning());
 
-    EXPECT_NO_THROW(remoteEnrollee->stopProvisioning());
+#else
+    /* It will throw the exception as
+     * it will not able to discover the provisioning resource in the network
+     */
+     EXPECT_ANY_THROW(remoteEnrollee->startProvisioning());
+
+    /* It will throw an exception
+     * as internally resource will be empty [startProvisioning is not succeed]
+     */
+    EXPECT_ANY_THROW(remoteEnrollee->stopProvisioning());
+#endif
 }
 
 //stopProvisioning [Negative]
@@ -299,8 +318,8 @@ TEST_F(MediatorRichTest, testStopProvisioningNegative)
     remoteEnrollee->registerEasySetupStatusHandler(&easySetupStatusCallback);
 
     /* we didn't call the start provisioning API and directly calling stopProvisioning API.
-         In this case API will throw the exception & we are checking the same.
-    */
+     * In this case API will throw the exception & we are checking the same.
+     */
     EXPECT_ANY_THROW(remoteEnrollee->stopProvisioning());
 }