Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Applying fixes as per PR review.
Removal of unused procedure from expactation_processor
Switch to use constant in error message creation
Update tests to match full message.
  • Loading branch information
lwasylow committed Apr 5, 2019
commit 8c64d78153e01920942c9e565b499e85f9b46b43
5 changes: 0 additions & 5 deletions source/core/ut_expectation_processor.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ create or replace package body ut_expectation_processor as
add_expectation_result(ut_expectation_result(ut_utils.gc_failure, null, a_message));
end;

procedure report_failure_no_caller(a_message in varchar2) is
begin
add_expectation_result(ut_expectation_result(ut_utils.gc_failure, null, a_message,false));
end;

function get_session_parameters return tt_nls_params is
l_session_params tt_nls_params;
begin
Expand Down
2 changes: 0 additions & 2 deletions source/core/ut_expectation_processor.pks
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ create or replace package ut_expectation_processor authid current_user as

procedure report_failure(a_message in varchar2);

procedure report_failure_no_caller(a_message in varchar2);

procedure set_xml_nls_params;

procedure reset_nls_params;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ create or replace package body ut_compound_data_helper is
function create_err_cursor_msg(a_error_stack varchar2) return varchar2 is
begin
return 'SQL exception thrown when fetching data from cursor: '||
ut_utils.remove_error_from_stack(sqlerrm,-19202)||chr(10)||
ut_utils.remove_error_from_stack(sqlerrm,ut_utils.gc_xml_processing)||chr(10)||
ut_expectation_processor.who_called_expectation(a_error_stack)||
'Check the query and data for errors.';
end;
Expand Down
42 changes: 27 additions & 15 deletions test/ut3_user/expectations/test_expectations_cursor.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -2522,42 +2522,54 @@ Diff:%
end;

procedure xml_error_actual is
c_price CONSTANT NUMBER(20,4):= 1357;
c_price CONSTANT NUMBER(20,4):= 1357;
c_user CONSTANT varchar2(30):= 'TEST_USER';
v_actual sys_refcursor;
v_expected sys_refcursor;
l_actual sys_refcursor;
l_expected sys_refcursor;
l_exp_message varchar2(32000);
begin
open v_actual for
l_exp_message :='ORA-20218: SQL exception thrown when fetching data from cursor:
ORA-01722: invalid number
at "UT3$USER#.TEST_EXPECTATIONS_CURSOR.XML_ERROR_ACTUAL", line 2542 ut3.ut.expect(l_actual).to_equal(l_expected);
Check the query and data for errors.';

open l_actual for
select cast(null as number(10)) as usd_price_amt, c_user as update_id
from dual where dummy = 1;
open v_expected for
open l_expected for
select c_price as usd_price_amt, c_user as update_id from dual;

ut3.ut.expect(v_actual).to_equal(v_expected);
ut3.ut.expect(l_actual).to_equal(l_expected);
--Line that error relates to in expected messag

ut.fail('Expected exception on cursor fetch');
exception
when others then
ut.expect(sqlerrm).to_be_like('%ORA-20218: SQL exception thrown when fetching data from cursor:%
%ORA-01722: invalid number%%Check the query and data for errors%');
ut.expect(sqlerrm).to_equal(l_exp_message);
end;

procedure xml_error_expected is
v_actual sys_refcursor;
v_expected sys_refcursor;
l_actual sys_refcursor;
l_expected sys_refcursor;
l_exp_message varchar2(32000);
begin
open v_expected for

l_exp_message :='ORA-20218: SQL exception thrown when fetching data from cursor:
ORA-01476: divisor is equal to zero
at "UT3$USER#.TEST_EXPECTATIONS_CURSOR.XML_ERROR_EXPECTED", line 2567 ut3.ut.expect(l_actual).to_equal(l_expected);
Check the query and data for errors.';

open l_expected for
select 1/0 as test from dual;
open v_actual for
open l_actual for
select 1 as test from dual;

ut3.ut.expect(v_actual).to_equal(v_expected);
ut3.ut.expect(l_actual).to_equal(l_expected);

ut.fail('Expected exception on cursor fetch');
exception
when others then
ut.expect(sqlerrm).to_be_like('%ORA-20218: SQL exception thrown when fetching data from cursor:%
%ORA-01476: divisor is equal to zero%Check the query and data for errors%');
ut.expect(sqlerrm).to_equal(l_exp_message);
end;

end;
Expand Down