[UTC][application][Non-ACR] Use assert_eq_with_exit() 27/312527/1
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 11 Jun 2024 06:47:34 +0000 (15:47 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 11 Jun 2024 06:47:34 +0000 (15:47 +0900)
This patch is for TCA coverage issues.

Change-Id: I1e1c12299b8342f1e127253ccc500634de225d42
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/utc/application/utc_app.c
src/utc/application/utc_app_control.c

index a348f5b9d20081e22f48502f6c170b420484e357..48612f6e531b357cd54125901080652badd29414 100755 (executable)
@@ -768,12 +768,7 @@ int utc_application_app_get_display_state_p(void)
        ret = system_info_get_platform_bool(
                        "http://tizen.org/feature/display.state",
                        &feature);
-       if (ret != SYSTEM_INFO_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG,
-                               "Failed to get platform feature");
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, SYSTEM_INFO_ERROR_NONE);
 
        ret = app_get_display_state(&state);
        if (ret != APP_ERROR_NONE) {
@@ -834,12 +829,7 @@ int utc_application_app_get_display_state_n(void)
        int ret;
 
        ret = app_get_display_state(NULL);
-       if (ret != APP_ERROR_INVALID_PARAMETER) {
-               dlog_print(DLOG_ERROR, LOG_TAG,
-                               "The result is not invalid parameter");
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_ERROR_INVALID_PARAMETER);
 
        normal_exit(0);
 
index 6703ee21051e2580246cb910302fb889b3bada70..252b639ea18fcdd85df2d7af787f39316e87f2c1 100755 (executable)
@@ -3312,35 +3312,19 @@ int utc_application_app_control_send_launch_request_async_p1(void)
        int ret;
 
        ret = app_control_create(&handle);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_operation(handle,
                        APP_CONTROL_OPERATION_DEFAULT);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_app_id(handle, "org.tizen.helloworld");
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set application ID");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_send_launch_request_async(handle, __app_control_result_cb,
                        NULL, NULL);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to send launch request async");
-               normal_exit(1);
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
-end:
        app_control_destroy(handle);
 
        return ret;
@@ -3378,36 +3362,20 @@ int utc_application_app_control_send_launch_request_async_p2(void)
        int ret;
 
        ret = app_control_create(&handle);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_operation(handle,
                        APP_CONTROL_OPERATION_DEFAULT);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_app_id(handle, "org.example.reply");
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set application ID");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_send_launch_request_async(handle,
                        __app_control_result_cb_with_reply,
                        __app_control_reply_cb, NULL);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to send launch request async");
-               normal_exit(1);
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
-end:
        app_control_destroy(handle);
 
        return ret;
@@ -3427,42 +3395,22 @@ int utc_application_app_control_send_launch_request_async_p3(void)
        int ret;
 
        ret = app_control_create(&handle);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_operation(handle,
                        APP_CONTROL_OPERATION_DEFAULT);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_mime(handle, "type/custom");
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set MIME-Type");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_app_id(handle, "org.tizen.helloworld");
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set application ID");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_send_launch_request_async(handle, __app_control_result_cb,
                        NULL, NULL);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to send launch request async");
-               normal_exit(1);
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
-end:
        app_control_destroy(handle);
 
        return ret;
@@ -3484,35 +3432,19 @@ int utc_application_app_control_send_launch_request_async_p4(void)
        int ret;
 
        ret = app_control_create(&handle);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_operation(handle,
                        APP_CONTROL_OPERATION_DEFAULT);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_app_id(handle, "org.example.appcontrolprivilegetest");
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set application ID");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_send_launch_request_async(handle, __app_control_result_cb,
                        NULL, NULL);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to send launch request async");
-               normal_exit(1);
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
-end:
        app_control_destroy(handle);
 
        return ret;
@@ -3531,29 +3463,15 @@ int utc_application_app_control_send_launch_request_async_n1(void)
        int ret;
 
        ret = app_control_create(&handle);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_send_launch_request_async(NULL, NULL, NULL, NULL);
-       if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "error: %d", ret);
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_INVALID_PARAMETER);
 
        ret = app_control_send_launch_request_async(handle, NULL, NULL, NULL);
-       if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "error: %d", ret);
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_INVALID_PARAMETER);
 
        normal_exit(0);
-
-end:
        app_control_destroy(handle);
 
        return 0;
@@ -3574,29 +3492,17 @@ int utc_application_app_control_send_launch_request_async_n2(void)
        int ret;
 
        ret = app_control_create(&handle);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_operation(handle,
                        APP_CONTROL_OPERATION_DEFAULT);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_send_launch_request_async(handle, __app_control_result_cb,
                        NULL, NULL);
-       if (ret != APP_CONTROL_ERROR_APP_NOT_FOUND) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "error: %d", ret);
-               normal_exit(1);
-       }
-       normal_exit(0);
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_APP_NOT_FOUND);
 
-end:
+       normal_exit(0);
        app_control_destroy(handle);
 
        return 0;
@@ -3625,36 +3531,20 @@ int utc_application_app_control_send_launch_request_async_n3(void)
        int ret;
 
        ret = app_control_create(&handle);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_operation(handle,
                        APP_CONTROL_OPERATION_DEFAULT);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_app_id(handle, "org.tizen.hellohelloworld");
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set application ID");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_send_launch_request_async(handle,
                        __app_control_result_cb_n3,
                        NULL, NULL);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "error: %d", ret);
-               normal_exit(1);
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
-end:
        app_control_destroy(handle);
 
        return 0;
@@ -3684,36 +3574,20 @@ int utc_application_app_control_send_launch_request_async_n4(void)
        int ret;
 
        ret = app_control_create(&handle);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_operation(handle,
                        APP_CONTROL_OPERATION_DEFAULT);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_set_app_id(handle, "org.example.appcontrolprivilegetest2");
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set application ID");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_send_launch_request_async(handle,
                        __app_control_result_cb_n4,
                        NULL, NULL);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "error: %d", ret);
-               normal_exit(1);
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
-end:
        app_control_destroy(handle);
 
        return 0;
@@ -3739,13 +3613,7 @@ int utc_application_app_control_create_with_parameters_p(void)
                        NULL, NULL, NULL, NULL,
                        "org.tizen.test", APP_CONTROL_LAUNCH_MODE_SINGLE, 2,
                        "key1", "value1", "key2", "value2");
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG,
-                               "Failed to create appcontrol handle. error: %d",
-                               ret);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_get_app_id(handle, &app_id);
        if (ret != APP_CONTROL_ERROR_NONE) {
@@ -3790,11 +3658,7 @@ int utc_application_app_control_create_with_parameters_n(void)
                        NULL, NULL, NULL, NULL,
                        NULL, APP_CONTROL_LAUNCH_MODE_SINGLE, 1,
                        "key", "value");
-       if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "error: %d", ret);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_INVALID_PARAMETER);
 
        normal_exit(0);
 
@@ -3823,21 +3687,14 @@ int utc_application_app_control_send_launch_request_sync_p(void)
                        NULL, NULL, NULL,
                        "org.example.reply", APP_CONTROL_LAUNCH_MODE_SINGLE,
                        0);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_send_launch_request_sync(handle, &reply, &result);
-       if (ret != APP_CONTROL_ERROR_NONE || result != APP_CONTROL_RESULT_SUCCEEDED) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to send launch request async");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
+       assert_eq_with_exit(result, APP_CONTROL_RESULT_SUCCEEDED);
 
        normal_exit(0);
-end:
+
        if (reply)
                app_control_destroy(reply);
        if (handle)
@@ -3859,11 +3716,7 @@ int utc_application_app_control_send_launch_request_sync_n1(void)
        int ret;
 
        ret = app_control_send_launch_request_sync(NULL, NULL, NULL);
-       if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Error: %d", ret);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_INVALID_PARAMETER);
 
        normal_exit(0);
 
@@ -3893,21 +3746,13 @@ int utc_application_app_control_send_launch_request_sync_n2(void)
                        NULL, NULL, NULL,
                        "org.tizen.helloworld", APP_CONTROL_LAUNCH_MODE_SINGLE,
                        0);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
-               normal_exit(1);
-               goto end;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        ret = app_control_send_launch_request_sync(handle, &reply, &result);
-       if (ret == APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Error: %d", ret);
-               normal_exit(1);
-               goto end;
-       }
+       assert_neq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        normal_exit(0);
-end:
+
        if (reply)
                app_control_destroy(reply);
        if (handle)
@@ -3938,11 +3783,7 @@ int utc_application_app_control_add_action_handler_p(void)
 
        ret = app_control_add_action_handler("action", __action_cb, NULL,
                        &handle);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Failed to add action handler");
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        app_control_remove_action_handler(handle);
        normal_exit(0);
@@ -3964,11 +3805,7 @@ int utc_application_app_control_add_action_handler_n1(void)
 
        ret = app_control_add_action_handler(NULL, __action_cb, NULL,
                        &handle);
-       if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Error: %d", ret);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_INVALID_PARAMETER);
 
        normal_exit(0);
 
@@ -3988,11 +3825,7 @@ int utc_application_app_control_add_action_handler_n2(void)
        int ret;
 
        ret = app_control_add_action_handler("action", NULL, NULL, &handle);
-       if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Error: %d", ret);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_INVALID_PARAMETER);
 
        normal_exit(0);
 
@@ -4011,11 +3844,7 @@ int utc_application_app_control_add_action_handler_n3(void)
        int ret;
 
        ret = app_control_add_action_handler("action", __action_cb, NULL, NULL);
-       if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Error: %d", ret);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_INVALID_PARAMETER);
 
        normal_exit(0);
 
@@ -4037,11 +3866,7 @@ int utc_application_app_control_add_action_handler_n4(void)
 
        ret = app_control_add_action_handler("NotFound", __action_cb, NULL,
                        &handle);
-       if (ret != APP_CONTROL_ERROR_KEY_NOT_FOUND) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Error: %d", ret);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_KEY_NOT_FOUND);
 
        normal_exit(0);
 
@@ -4065,12 +3890,7 @@ int utc_application_app_control_remove_action_handler_p(void)
        app_control_add_action_handler("action", __action_cb, NULL, &handle);
 
        ret = app_control_remove_action_handler(handle);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG,
-                               "Failed to remove action handler");
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        normal_exit(0);
 
@@ -4089,11 +3909,7 @@ int utc_application_app_control_remove_action_handler_n(void)
        int ret;
 
        ret = app_control_remove_action_handler(NULL);
-       if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Error: %d", ret);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_INVALID_PARAMETER);
 
        normal_exit(0);
 
@@ -4129,13 +3945,7 @@ int utc_application_app_control_create_from_uri_handle_p(void)
        app_control_uri_builder_build(builder, &uri);
 
        ret = app_control_create_from_uri_handle(&app_control, uri);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Error: %d", ret);
-               app_control_uri_builder_destroy(builder);
-               app_control_uri_destroy(uri);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        app_control_uri_builder_destroy(builder);
        app_control_uri_destroy(uri);
@@ -4172,13 +3982,7 @@ int utc_application_app_control_create_from_uri_handle_n1(void)
        app_control_uri_builder_build(builder, &uri);
 
        ret = app_control_create_from_uri_handle(NULL, uri);
-       if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Error: %d", ret);
-               app_control_uri_builder_destroy(builder);
-               app_control_uri_destroy(uri);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_INVALID_PARAMETER);
 
        app_control_uri_builder_destroy(builder);
        app_control_uri_destroy(uri);
@@ -4198,15 +4002,10 @@ int utc_application_app_control_create_from_uri_handle_n1(void)
 int utc_application_app_control_create_from_uri_handle_n2(void)
 {
        int ret;
-
        app_control_h app_control;
 
        ret = app_control_create_from_uri_handle(&app_control, NULL);
-       if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Error: %d", ret);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_INVALID_PARAMETER);
 
        normal_exit(0);
 
@@ -4244,14 +4043,7 @@ int utc_application_app_control_set_uri_by_handle_p(void)
        app_control_create(&app_control);
 
        ret = app_control_set_uri_by_handle(app_control, uri);
-       if (ret != APP_CONTROL_ERROR_NONE) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Error: %d", ret);
-               app_control_uri_builder_destroy(builder);
-               app_control_uri_destroy(uri);
-               app_control_destroy(app_control);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_NONE);
 
        app_control_uri_builder_destroy(builder);
        app_control_uri_destroy(uri);
@@ -4289,13 +4081,7 @@ int utc_application_app_control_set_uri_by_handle_n1(void)
        app_control_uri_builder_build(builder, &uri);
 
        ret = app_control_set_uri_by_handle(NULL, uri);
-       if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
-               dlog_print(DLOG_ERROR, LOG_TAG, "Error: %d", ret);
-               app_control_uri_builder_destroy(builder);
-               app_control_uri_destroy(uri);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_INVALID_PARAMETER);
 
        app_control_uri_builder_destroy(builder);
        app_control_uri_destroy(uri);
@@ -4322,12 +4108,7 @@ int utc_application_app_control_set_uri_by_handle_n2(void)
        app_control_create(&app_control);
 
        ret = app_control_set_uri_by_handle(app_control, NULL);
-       if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
-               app_control_destroy(app_control);
-               dlog_print(DLOG_ERROR, LOG_TAG, "Error: %d", ret);
-               normal_exit(1);
-               return -1;
-       }
+       assert_eq_with_exit(ret, APP_CONTROL_ERROR_INVALID_PARAMETER);
 
        app_control_destroy(app_control);
        normal_exit(0);