[Easy-setup] Unit test case fixes for Mediator
authorJay Sharma <jay.sharma@samsung.com>
Fri, 18 Mar 2016 14:59:58 +0000 (20:29 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Mon, 21 Mar 2016 10:05:49 +0000 (10:05 +0000)
Change-Id: Ibcdfe23ee7887d72ac86acdad9b32c8674de8702
Signed-off-by: Jay Sharma <jay.sharma@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/6083
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 d6e24c7..9992059 100644 (file)
@@ -225,11 +225,15 @@ TEST_F(MediatorRichTest, testStartProvisioning)
     remoteEnrollee = EasySetup::getInstance()->createEnrolleeDevice(netInfo, onboardingConn);
     remoteEnrollee->registerEasySetupStatusHandler(&easySetupStatusCallback);
 
-    /*It will throw an exception,
-     * as it will not be able to discover the provisioning resource
-     * in the network
-    */
+#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]
@@ -250,9 +254,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());
 }
 
@@ -275,10 +279,21 @@ TEST_F(MediatorRichTest, testStopProvisioning)
     remoteEnrollee = EasySetup::getInstance()->createEnrolleeDevice(netInfo, onboardingConn);
     remoteEnrollee->registerEasySetupStatusHandler(&easySetupStatusCallback);
 
-    /* It will throw an exception,
-     * as we are calling stop provisioning api before start provisioning.
+#ifdef REMOTE_ARDUINO_ENROLEE
+        EXPECT_NO_THROW(remoteEnrollee->startProvisioning());
+        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]
@@ -301,8 +316,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());
 }