tizen 2.4 release
[framework/web/wrt-commons.git] / tests / dao / TestCases_WidgetInterfaceDAO.cpp
index fae5e11..8e9a156 100644 (file)
@@ -28,6 +28,7 @@
 #include <dpl/test/test_runner.h>
 #include <dpl/foreach.h>
 #include <dpl/exception.h>
+#include <dpl/optional_typedefs.h>
 #include <dpl/wrt-dao-rw/widget_dao.h>
 #include <dpl/wrt-dao-ro/wrt_db_types.h>
 #include <dpl/string.h>
@@ -87,7 +88,7 @@ RUNNER_TEST(widget_interface_dao_test_01_initialization_Exception)
  */
 RUNNER_TEST(widget_interface_dao_test_02_readValue)
 {
-    DPL::Optional<std::string> value;
+    DPL::OptionalStdString value;
 
     Try
     {
@@ -95,7 +96,7 @@ RUNNER_TEST(widget_interface_dao_test_02_readValue)
 
         value = dao.getValue("key1_for_2000");
 
-        RUNNER_ASSERT(value == "value_for_key1_2000");
+        RUNNER_ASSERT(value == std::string("value_for_key1_2000"));
     }
     Catch(WidgetInterfaceDAO::Exception::DatabaseError)
     {
@@ -110,7 +111,7 @@ RUNNER_TEST(widget_interface_dao_test_02_readValue)
  */
 RUNNER_TEST(widget_interface_dao_test_02_readValue_badKey)
 {
-    DPL::Optional<std::string> value;
+    DPL::OptionalStdString value;
 
     Try
     {
@@ -118,7 +119,7 @@ RUNNER_TEST(widget_interface_dao_test_02_readValue_badKey)
 
         value = dao.getValue("key1_for_200011111");
 
-        RUNNER_ASSERT(value.IsNull());
+        RUNNER_ASSERT(!value);
     }
     Catch(WidgetInterfaceDAO::Exception::DatabaseError)
     {
@@ -133,7 +134,7 @@ RUNNER_TEST(widget_interface_dao_test_02_readValue_badKey)
  */
 RUNNER_TEST(widget_interface_dao_test_03_setItem)
 {
-    DPL::Optional<std::string> value;
+    DPL::OptionalStdString value;
 
     Try
     {
@@ -143,7 +144,7 @@ RUNNER_TEST(widget_interface_dao_test_03_setItem)
 
         value = dao.getValue("key3_for_2000");
 
-        RUNNER_ASSERT(value == "value_for_key3_2000");
+        RUNNER_ASSERT(value == std::string("value_for_key3_2000"));
     }
     Catch(WidgetInterfaceDAO::Exception::DatabaseError)
     {
@@ -158,7 +159,7 @@ RUNNER_TEST(widget_interface_dao_test_03_setItem)
  */
 RUNNER_TEST(widget_interface_dao_test_03_setItem_Exception)
 {
-    DPL::Optional<std::string> value;
+    DPL::OptionalStdString value;
 
     Try
     {
@@ -186,7 +187,7 @@ RUNNER_TEST(widget_interface_dao_test_03_setItem_Exception)
  */
 RUNNER_TEST(widget_interface_dao_test_04_setItem)
 {
-    DPL::Optional<std::string> value;
+    DPL::OptionalStdString value;
 
     Try
     {
@@ -196,7 +197,7 @@ RUNNER_TEST(widget_interface_dao_test_04_setItem)
 
         value = dao.getValue("key4_for_2000");
 
-        RUNNER_ASSERT(value == "value_for_key4_2000");
+        RUNNER_ASSERT(value == std::string("value_for_key4_2000"));
     }
     Catch(WidgetInterfaceDAO::Exception::DatabaseError)
     {
@@ -295,7 +296,7 @@ RUNNER_TEST(widget_interface_dao_test_06_removeItem)
 {
     std::string key;
     size_t sizeBefore, sizeAfter;
-    DPL::Optional<std::string> value;
+    DPL::OptionalStdString value;
 
     Try
     {
@@ -315,7 +316,7 @@ RUNNER_TEST(widget_interface_dao_test_06_removeItem)
         value = dao.getValue("key4_for_2000");
 
         RUNNER_ASSERT(sizeAfter == sizeBefore - 1);
-        RUNNER_ASSERT(value.IsNull());
+        RUNNER_ASSERT(!value);
     }
     Catch(WidgetInterfaceDAO::Exception::DatabaseError)
     {
@@ -332,7 +333,7 @@ RUNNER_TEST(widget_interface_dao_test_06_removeItem)
 RUNNER_TEST(widget_interface_dao_test_06_removeItem_Exception)
 {
     WidgetInterfaceDAO* dao = NULL;
-    DPL::Optional<std::string> value;
+    DPL::OptionalStdString value;
     size_t sizeBefore, sizeAfter;
 
     Try
@@ -357,7 +358,7 @@ RUNNER_TEST(widget_interface_dao_test_06_removeItem_Exception)
         value = dao->getValue("key3_for_2000");
 
         RUNNER_ASSERT(sizeAfter == sizeBefore);
-        RUNNER_ASSERT(value == "value_for_key3_2000");
+        RUNNER_ASSERT(value == std::string("value_for_key3_2000"));
     }
     Catch(WidgetInterfaceDAO::Exception::DatabaseError)
     {
@@ -376,7 +377,7 @@ RUNNER_TEST(widget_interface_dao_test_06_removeItem_Exception)
 RUNNER_TEST(widget_interface_dao_test_07_clear)
 {
     size_t sizeBefore, sizeAfter;
-    DPL::Optional<std::string> value;
+    DPL::OptionalStdString value;
 
     Try
     {
@@ -390,7 +391,7 @@ RUNNER_TEST(widget_interface_dao_test_07_clear)
 
         RUNNER_ASSERT(sizeAfter == 1);
         RUNNER_ASSERT(sizeAfter < sizeBefore);
-        RUNNER_ASSERT(value == "value_for_key3_2000");
+        RUNNER_ASSERT(value == std::string("value_for_key3_2000"));
     }
     Catch(WidgetInterfaceDAO::Exception::DatabaseError)
     {