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
Show all changes
148 commits
Select commit Hold shift + click to select a range
42d8d45
Initial check in
lwasylow Oct 6, 2018
2360ca4
First working stab. No messages defined.
lwasylow Oct 6, 2018
dd63970
Include matcher
lwasylow Oct 6, 2018
81240fb
Updated install and deinstall
lwasylow Oct 6, 2018
440670b
Update install
lwasylow Oct 10, 2018
a0ee195
Added tests for include
lwasylow Oct 11, 2018
314b998
Added test for to_contain
lwasylow Oct 11, 2018
6193ff3
Adding negated matcher
lwasylow Oct 11, 2018
f798e39
Added tests and negated code
lwasylow Oct 14, 2018
86276ec
Fixing test dependency on NLS settings.
jgebal Oct 19, 2018
7b037d4
Adding fix to avoid running sonar-scanner on external pull-requests.
jgebal Oct 19, 2018
b2f1b96
Updated project version after build [skip ci]
Oct 19, 2018
80ea7d7
Change CLI version to 3.1.0.
PhilippSalvisberg Oct 19, 2018
3d3a2e8
ignore temporary files created by actions described in CONTRIBUTING.md
PhilippSalvisberg Oct 19, 2018
7170cda
Updated project version after build [skip ci]
Oct 19, 2018
59b1ead
fix to unordered.
lwasylow Oct 20, 2018
4d2a890
Updated project version after build [skip ci]
Oct 20, 2018
29e1bf7
Moving uninstall tests to child job no 2 - (12.1) as it is now fastes…
jgebal Oct 20, 2018
45448ac
Disabling compilation with PLSQL compiler warnings.
jgebal Oct 21, 2018
add5ed8
Updated project version after build [skip ci]
Oct 21, 2018
f39b96a
Update not to include
lwasylow Oct 21, 2018
9557daa
Merge branch 'develop' of github.com:utPLSQL/utPLSQL into feature/mat…
lwasylow Oct 21, 2018
5aa19ea
Update some of the format
lwasylow Oct 21, 2018
03ad5ec
Update documentation
lwasylow Oct 27, 2018
18d89f6
Merge branch 'develop' of https://github.com/utPLSQL/utPLSQL into fea…
lwasylow Nov 1, 2018
74c3648
Merge branch 'develop' of https://github.com/utPLSQL/utPLSQL into fea…
lwasylow Nov 1, 2018
42563e9
Update documentation and added additional test.
lwasylow Nov 1, 2018
3e685e8
Merge branch 'feature/matcher_include' of https://github.com/utPLSQL/…
lwasylow Nov 1, 2018
2a133a1
Fix to issue #770 when the merge statement is run via current user wh…
lwasylow Oct 27, 2018
68d43d6
Added test for min user test
lwasylow Oct 28, 2018
afe9e2c
Update sqlcl download
lwasylow Oct 28, 2018
12edb2a
Squashed commit of the following:
lwasylow Nov 1, 2018
9dbb4e5
Update run test shell.
lwasylow Nov 1, 2018
8752509
Update shell
lwasylow Nov 1, 2018
4138d25
Added extra test for duplicate.
lwasylow Nov 1, 2018
8388276
First stab
lwasylow Nov 3, 2018
9741948
Added belt and braces for big cartesian
lwasylow Nov 4, 2018
be55366
Inserting only first max display rows
lwasylow Nov 5, 2018
ae3d34f
Remove clob transformation
lwasylow Nov 5, 2018
b4113fd
Check in progress of working version.
lwasylow Nov 6, 2018
816a1c1
Beautify sql generation
lwasylow Nov 6, 2018
e5de7d2
Tidy up
lwasylow Nov 6, 2018
9843e14
Code updates for pure sql
lwasylow Nov 8, 2018
ab593d9
Update code to consolidate compare sqls into one place where is gener…
lwasylow Nov 9, 2018
4d3dadc
Update for 11g where error about inline with was raised.
lwasylow Nov 9, 2018
d9ccc83
Fix to sql diff to resolve 11g optimizer rewrite error
lwasylow Nov 9, 2018
c009a86
Update code to bring all code into one place.
lwasylow Nov 10, 2018
ecaf48a
Add some bigger tests
lwasylow Nov 10, 2018
af8b49a
Update rownumber generated
lwasylow Nov 11, 2018
c633ff5
Update code with bug fixes
lwasylow Nov 11, 2018
ee7bdf2
Update order
lwasylow Nov 11, 2018
5b46ab0
Updated code for tests.
lwasylow Nov 12, 2018
c997616
Added cursor info code
lwasylow Nov 13, 2018
2b9d4f3
Capture cursor info and filter it out
lwasylow Nov 15, 2018
fc905ac
Saving progress
lwasylow Nov 16, 2018
107a30b
Updated progress by capturing a nested types in hierarchy structured …
lwasylow Nov 17, 2018
6726f1a
Saving progress
lwasylow Nov 18, 2018
e4043b5
Updates to include nested an collections
lwasylow Nov 19, 2018
6cb5fe7
Further deprecation of Xpath
lwasylow Nov 20, 2018
1356f39
Update to cursor comparision
lwasylow Nov 20, 2018
b094911
Update tests
lwasylow Nov 21, 2018
21dca2b
Resolve issue with nested table being join
lwasylow Nov 21, 2018
6e034bf
Merge branch 'develop' of https://github.com/utPLSQL/utPLSQL into fea…
lwasylow Nov 21, 2018
9dc266e
Update test to be more generic
lwasylow Nov 21, 2018
d96d602
remove schema quantifier
lwasylow Nov 21, 2018
2b90c4b
remove schema quantifier
lwasylow Nov 21, 2018
416df70
Merge branch 'feature/pure_sql' of https://github.com/utPLSQL/utPLSQL…
lwasylow Nov 24, 2018
3759e90
Phase 2. Removal of x path and clean-up deprecated code
lwasylow Nov 26, 2018
35d200c
Merge branch 'develop' of https://github.com/utPLSQL/utPLSQL into fea…
lwasylow Nov 26, 2018
29fe2e1
Update stylecheck
lwasylow Nov 26, 2018
1c0582b
Update test time exec
lwasylow Nov 26, 2018
7837eb4
Anydata refactoring.
lwasylow Nov 28, 2018
e082b75
Improvements to extraction of cursor details using anydata to allow g…
lwasylow Dec 1, 2018
815deac
Updates to documentation
lwasylow Dec 2, 2018
cf0c592
Sorting out some duplicate code.
lwasylow Dec 2, 2018
c156852
Cleanup of code
lwasylow Dec 2, 2018
d8525d6
Change behaviour to compare columns regardless of column position in …
lwasylow Dec 2, 2018
48ad81e
Small fixes and updates regarding peer review.
lwasylow Dec 7, 2018
3ff1e27
Updated paths to venn diagram images
jgebal Dec 9, 2018
69da762
Fixed formatting of examples.
jgebal Dec 9, 2018
8697cea
Added missing synonyms for new matchers `contain / include`
jgebal Dec 9, 2018
1645445
Formatting fixes.
jgebal Dec 9, 2018
62c12cd
Removed unused variables.
jgebal Dec 9, 2018
ca9f8eb
Formatting fixes.
jgebal Dec 9, 2018
004b537
Refactoring recursive calls for resolving complex types in cursor.
jgebal Dec 10, 2018
ada957d
Fixed exception handling on `anytype.getpersistent`
jgebal Dec 10, 2018
2ff110d
Change cursor behaviour to be ordered columns by default.
lwasylow Dec 11, 2018
bd54710
Adding short-name for unordered columns option UC.
lwasylow Dec 11, 2018
6f830dc
Minor formatting and warnings fixed
jgebal Dec 12, 2018
a67b853
Merge branch 'develop' into feature/pure_sql
lwasylow Dec 12, 2018
45643e0
Tidy up code
lwasylow Dec 13, 2018
1e71c99
Adding a new expectation type to specialize unordered_columns only to…
lwasylow Dec 13, 2018
470bb32
A bit of code cleanup
jgebal Jan 3, 2019
b64443d
Fixed cleanup issues.
jgebal Jan 4, 2019
c2d52ae
resolved sonar violations
jgebal Jan 5, 2019
0c994a4
Merge branch 'develop' into feature/pure_sql
jgebal Jan 5, 2019
fab120e
Merge branch 'develop' into feature/pure_sql
jgebal Jan 12, 2019
4663e3b
Merge branch 'develop' into feature/pure_sql
jgebal Jan 13, 2019
9ddc332
Merge branch 'develop' into feature/pure_sql
jgebal Jan 31, 2019
b4483a7
Merge remote-tracking branch 'origin/develop' into feature/pure_sql
jgebal Feb 4, 2019
62e5d80
Fixed doc link
jgebal Feb 4, 2019
d7a2711
Fixed issue with spaces in column lists.
jgebal Feb 5, 2019
97cd079
Improved documentation for `unordered` and `unordered_columns` options.
jgebal Feb 12, 2019
94e58a0
Refactoring - to be continued.
jgebal Feb 14, 2019
08ed9ab
Refactoring - to be continued.
jgebal Feb 15, 2019
90aca9f
Refactoring - to be continued.
jgebal Feb 15, 2019
24c14f9
Refactoring - to be continued.
jgebal Feb 16, 2019
f850428
Fixed issue with DBMS_LOB.COMPARE when empty XML produced.
jgebal Feb 16, 2019
917828c
Refactoring.
jgebal Feb 17, 2019
80563f8
Refactoring.
jgebal Feb 19, 2019
faf3d12
Rework dynamic sql generation to more readible format.
lwasylow Feb 22, 2019
6306af6
Rework dynamic sql generation to more readible format.
lwasylow Feb 22, 2019
daa8ec3
fixing issue with order of data.
lwasylow Feb 23, 2019
ab55d12
fixing issue with order of data.
lwasylow Feb 23, 2019
7676a9a
Merge branch 'feature/pure_sql' of https://github.com/utPLSQL/utPLSQL…
lwasylow Feb 23, 2019
dd7e868
Renamed `ut_include` to `ut_contain`.
jgebal Feb 24, 2019
9fccd1d
Wrapping up anydata into cursor
lwasylow Feb 23, 2019
6421ec8
Merge branch 'feature/pure_sql' of https://github.com/utPLSQL/utPLSQL…
lwasylow Feb 24, 2019
061895a
Wrapping up anydata into cursor
lwasylow Feb 24, 2019
7bb5533
Fixing issue with null object and counts
lwasylow Feb 26, 2019
147a506
Fixing issues with null and empty objects / collections
lwasylow Mar 1, 2019
5dd4d42
Shorter tests names and removal of unused types files.
lwasylow Mar 2, 2019
01e93e7
Wrapping in the quota column name in cursor as it uses a type value w…
lwasylow Mar 2, 2019
2c8cd32
Fixing issue with refcursor in anydata.
lwasylow Mar 4, 2019
bbb9020
Adding cursor closure
lwasylow Mar 4, 2019
09b43da
Adding in out
lwasylow Mar 4, 2019
9961dbc
Testing fix for issue with cursors
lwasylow Mar 5, 2019
2534c96
fixing cursor issue
lwasylow Mar 5, 2019
dea6d3c
Refactoring.
lwasylow Mar 5, 2019
bf4a25a
Merge branch 'feature/pure_sql' of https://github.com/utPLSQL/utPLSQL…
lwasylow Mar 6, 2019
e32d700
Refactoring
lwasylow Mar 6, 2019
2dab607
Merge branch 'develop' into feature/pure_sql
lwasylow Mar 6, 2019
5c1ef69
Update sonar sh
lwasylow Mar 6, 2019
b91ea69
Fixing SONAR errors
lwasylow Mar 6, 2019
e8e5772
Merge branch 'feature/pure_sql' of https://github.com/utPLSQL/utPLSQL…
lwasylow Mar 6, 2019
7a77a7f
small improvments
lwasylow Mar 8, 2019
cfada15
Remove tests as its not replicating issue
lwasylow Mar 8, 2019
b823922
Merge branch 'develop' into feature/pure_sql
jgebal Mar 8, 2019
c583319
Adding extra tests for collection with join_by and unordered
lwasylow Mar 12, 2019
46fb8ff
Merge branch 'feature/pure_sql' of https://github.com/utPLSQL/utPLSQL…
lwasylow Mar 12, 2019
3aa872b
Updated docs/userguide/advanced_data_comparison.md
lwasylow Mar 12, 2019
3e4e1a8
Fixing a conversion of date when extracting XML DATE,TS, TS_TZ,TS_LTS…
lwasylow Mar 14, 2019
898bec2
Fixed support for different DATE NLS settings.
jgebal Mar 15, 2019
6590735
Merge remote-tracking branch 'origin/develop' into feature/pure_sql
jgebal Mar 15, 2019
05adfa2
Moving expectations for compound into single type and removing expect…
lwasylow Mar 15, 2019
ca64da8
Merge branch 'feature/pure_sql' of https://github.com/utPLSQL/utPLSQL…
lwasylow Mar 15, 2019
10a6bf7
Update docs
lwasylow Mar 15, 2019
76c068e
Merge branch 'develop' into feature/pure_sql
lwasylow Mar 15, 2019
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
Added tests and negated code
  • Loading branch information
lwasylow committed Oct 14, 2018
commit f798e3919fed7dee7aadef54a5084b0d1493c8a6
30 changes: 29 additions & 1 deletion source/expectations/data_values/ut_compound_data_helper.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -607,14 +607,42 @@ create or replace package body ut_compound_data_helper is
return l_sql;
end;

function get_not_inclusion_matcher_sql(a_owner in varchar2) return varchar2 is
l_sql varchar2(32767);
begin
/* Self set does not contain any values from other set */
l_sql := 'with source_data as
( select t.data_id,t.item_hash,row_number() over (partition by t.pk_hash,t.item_hash,t.data_id order by 1,2) duplicate_no,
pk_hash
from ' || a_owner || '.ut_compound_data_tmp t
where data_id = :self_guid or data_id = :other_guid
)
select distinct :diff_id,tmp.item_hash,tmp.pk_hash,tmp.duplicate_no
from
(
select act.item_hash,act. duplicate_no,act.pk_hash
from source_data act where act.data_id = :self_guid
and exists ( select 1
from source_data exp
where exp.data_id = :other_guid
and exp.item_hash = act.item_hash
)
union all
select null,null,null
from dual where :other_guid = :self_guid
)
tmp';
return l_sql;
end;

function get_refcursor_matcher_sql(a_owner in varchar2,a_inclusion_matcher boolean := false, a_negated_match boolean := false) return varchar2 is
l_sql varchar2(32767);
begin
l_sql := 'insert into ' || a_owner || '.ut_compound_data_diff_tmp ( diff_id,item_hash,pk_hash,duplicate_no)'||chr(10);
if a_inclusion_matcher and not(a_negated_match) then
l_sql := l_sql || get_inclusion_matcher_sql(a_owner);
elsif a_inclusion_matcher and a_negated_match then
null;
l_sql := l_sql || get_not_inclusion_matcher_sql(a_owner);
elsif not(a_inclusion_matcher) then
l_sql := l_sql || get_unordered(a_owner);
end if;
Expand Down
8 changes: 4 additions & 4 deletions source/expectations/data_values/ut_compound_data_value.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ create or replace type body ut_compound_data_value as
end;

member function compare_implementation(a_other ut_data_value, a_exclude_xpath varchar2, a_include_xpath varchar2, a_join_by_xpath varchar2,
a_unordered boolean , a_inclusion_compare boolean := false ) return integer is
a_unordered boolean , a_inclusion_compare boolean := false, a_is_negated boolean := false ) return integer is
l_other ut_compound_data_value;
l_ut_owner varchar2(250) := ut_utils.ut_owner;
l_column_filter varchar2(32767);
Expand Down Expand Up @@ -255,14 +255,14 @@ create or replace type body ut_compound_data_value as
* SELF is expected.
* Due to growing complexity I have moved a dynamic SQL into helper package.
*/
l_sql := ut_compound_data_helper.get_refcursor_matcher_sql(l_ut_owner,a_inclusion_compare);
l_sql := ut_compound_data_helper.get_refcursor_matcher_sql(l_ut_owner,a_inclusion_compare,a_is_negated);

execute immediate l_sql
using self.data_id, l_other.data_id,
l_diff_id,
self.data_id, l_other.data_id,
l_other.data_id,self.data_id;

/*!*
* Result OK when is not inclusion matcher and both are the same
* Resullt OK when is inclusion matcher and left contains right set
Expand Down
2 changes: 1 addition & 1 deletion source/expectations/data_values/ut_compound_data_value.tps
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ create or replace type ut_compound_data_value force under ut_data_value(
member function get_data_diff(a_other ut_data_value, a_exclude_xpath varchar2, a_include_xpath varchar2, a_join_by_xpath varchar2, a_unordered boolean) return clob,
member function compare_implementation(a_other ut_data_value, a_exclude_xpath varchar2, a_include_xpath varchar2) return integer,
member function compare_implementation(a_other ut_data_value, a_exclude_xpath varchar2, a_include_xpath varchar2, a_join_by_xpath varchar2,
a_unordered boolean , a_inclusion_compare boolean := false) return integer
a_unordered boolean , a_inclusion_compare boolean := false, a_is_negated boolean := false) return integer
) not final not instantiable
/
5 changes: 2 additions & 3 deletions source/expectations/data_values/ut_data_value_refcursor.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ create or replace type body ut_data_value_refcursor as
end;

overriding member function compare_implementation (a_other ut_data_value, a_exclude_xpath varchar2, a_include_xpath varchar2, a_join_by_xpath varchar2,
a_unordered boolean, a_inclusion_compare boolean := false) return integer is
a_unordered boolean, a_inclusion_compare boolean := false, a_is_negated boolean := false) return integer is
l_result integer := 0;
l_other ut_data_value_refcursor;
function is_pk_missing (a_pk_missing_tab ut_compound_data_helper.tt_missing_pk) return integer is
Expand Down Expand Up @@ -251,7 +251,7 @@ create or replace type body ut_data_value_refcursor as

if a_unordered then
l_result := l_result + (self as ut_compound_data_value).compare_implementation(a_other, a_exclude_xpath, a_include_xpath,
a_join_by_xpath, a_unordered, a_inclusion_compare);
a_join_by_xpath, a_unordered, a_inclusion_compare, a_is_negated);
else
l_result := l_result + (self as ut_compound_data_value).compare_implementation(a_other, a_exclude_xpath, a_include_xpath);
end if;
Expand All @@ -265,6 +265,5 @@ create or replace type body ut_data_value_refcursor as
return self.elements_count = 0;
end;


end;
/
3 changes: 1 addition & 2 deletions source/expectations/data_values/ut_data_value_refcursor.tps
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ create or replace type ut_data_value_refcursor under ut_compound_data_value(
overriding member function to_string return varchar2,
overriding member function diff( a_other ut_data_value, a_exclude_xpath varchar2, a_include_xpath varchar2, a_join_by_xpath varchar2, a_unordered boolean := false ) return varchar2,
overriding member function compare_implementation(a_other ut_data_value, a_exclude_xpath varchar2, a_include_xpath varchar2, a_join_by_xpath varchar2,
a_unordered boolean, a_inclusion_compare boolean := false) return integer,
a_unordered boolean, a_inclusion_compare boolean := false, a_is_negated boolean := false) return integer,
overriding member function is_empty return boolean

)
/
18 changes: 12 additions & 6 deletions source/expectations/matchers/ut_include.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ create or replace type body ut_include as
return l_result;
end;

member function get_negated return boolean is
begin
return ut_utils.int_to_boolean(nvl(is_negated,0));
end;

overriding member function run_matcher(self in out nocopy ut_include, a_actual ut_data_value) return boolean is
l_result boolean;
begin
if self.expected.data_type = a_actual.data_type then
if nvl(self.is_negated,0) = 0 then
l_result := 0 = treat(self.expected as ut_data_value_refcursor).compare_implementation(a_actual, self.get_exclude_xpath(), self.get_include_xpath(), self.get_join_by_xpath(),
true,get_inclusion_compare());
else
l_result := 0 = treat(self.expected as ut_data_value_refcursor).compare_implementation(a_actual, self.get_exclude_xpath(), self.get_include_xpath(), self.get_join_by_xpath(),
true,get_inclusion_compare());
end if;
true,self.get_inclusion_compare(), self.get_negated());
else
l_result := (self as ut_matcher).run_matcher(a_actual);
end if;
Expand All @@ -73,5 +73,11 @@ create or replace type body ut_include as
return l_result;
end;

overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2 is
l_result varchar2(32767);
begin
return (self as ut_matcher).failure_message_when_negated(a_actual) || ':'|| expected.to_string_report();
end;

end;
/
4 changes: 3 additions & 1 deletion source/expectations/matchers/ut_include.tps
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ create or replace type ut_include under ut_equal(
constructor function ut_include(self in out nocopy ut_include, a_expected sys_refcursor) return self as result,
member function get_inclusion_compare return boolean,
member function negated return ut_include,
member function get_negated return boolean,
overriding member function run_matcher(self in out nocopy ut_include, a_actual ut_data_value) return boolean,
overriding member function failure_message(a_actual ut_data_value) return varchar2
overriding member function failure_message(a_actual ut_data_value) return varchar2,
overriding member function failure_message_when_negated(a_actual ut_data_value) return varchar2
)
/
15 changes: 13 additions & 2 deletions source/expectations/ut_expectation.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ create or replace type body ut_expectation as
ut_expectation_processor.add_expectation_result( ut_expectation_result( ut_utils.to_test_result( l_expectation_result ), self.description, l_message ) );
end;

member procedure not_include(self in ut_expectation, a_matcher ut_matcher) is
l_expectation_result boolean;
l_matcher ut_matcher := a_matcher;
l_message varchar2(32767);
begin
l_expectation_result := l_matcher.run_matcher( self.actual_data );
l_expectation_result := coalesce(l_expectation_result,false);
l_message := coalesce( l_matcher.error_message( self.actual_data ), l_matcher.failure_message_when_negated( self.actual_data ) );
ut_expectation_processor.add_expectation_result( ut_expectation_result( ut_utils.to_test_result( l_expectation_result ), self.description, l_message ) );
end;

member procedure to_be_null(self in ut_expectation) is
begin
self.to_( ut_be_null() );
Expand Down Expand Up @@ -690,12 +701,12 @@ create or replace type body ut_expectation as

member procedure not_to_include(self in ut_expectation, a_expected sys_refcursor) is
begin
self.not_to( ut_include(a_expected).negated );
self.not_include( ut_include(a_expected).negated );
end;

member procedure not_to_contain(self in ut_expectation, a_expected sys_refcursor) is
begin
self.not_to( ut_include(a_expected).negated );
self.not_include( ut_include(a_expected).negated );
end;

end;
Expand Down
1 change: 1 addition & 0 deletions source/expectations/ut_expectation.tps
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ create or replace type ut_expectation authid current_user as object(
--base matcher executors
member procedure to_(self in ut_expectation, a_matcher ut_matcher),
member procedure not_to(self in ut_expectation, a_matcher ut_matcher),
member procedure not_include(self in ut_expectation, a_matcher ut_matcher),

--shortcuts
member procedure to_be_null(self in ut_expectation),
Expand Down
58 changes: 40 additions & 18 deletions source/expectations/ut_expectation_compound.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -123,22 +123,30 @@ create or replace type body ut_expectation_compound as

member procedure include(self in ut_expectation_compound, a_items varchar2) is
begin
if ut_utils.int_to_boolean(negated) then
self.not_to( treat(matcher as ut_equal).include(a_items) );
else
self.to_( treat(matcher as ut_equal).include(a_items) );
end if;
end;
if ut_utils.int_to_boolean(negated) then
if (matcher is of (ut_include)) then
self.not_include( treat(matcher as ut_equal).include(a_items) );
else
self.not_to( treat(matcher as ut_equal).include(a_items) );
end if;
else
self.to_( treat(matcher as ut_equal).include(a_items) );
end if;
end;

member procedure include(self in ut_expectation_compound, a_items ut_varchar2_list) is
begin
if ut_utils.int_to_boolean(negated) then
if (matcher is of (ut_include)) then
self.not_include( treat(matcher as ut_equal).include(a_items) );
else
self.not_to( treat(matcher as ut_equal).include(a_items) );
end if;
else
self.to_( treat(matcher as ut_equal).include(a_items) );
end if;
end;

if ut_utils.int_to_boolean(negated) then
self.not_to( treat(matcher as ut_equal).include(a_items) );
else
self.to_( treat(matcher as ut_equal).include(a_items) );
end if;
end;


member function exclude(a_items varchar2) return ut_expectation_compound is
Expand All @@ -160,17 +168,24 @@ create or replace type body ut_expectation_compound as
member procedure exclude(self in ut_expectation_compound, a_items varchar2) is
begin
if ut_utils.int_to_boolean(negated) then
self.not_to( treat(matcher as ut_equal).exclude(a_items) );
if (matcher is of (ut_include)) then
self.not_include( treat(matcher as ut_equal).exclude(a_items) );
else
self.not_to( treat(matcher as ut_equal).exclude(a_items) );
end if;
else
self.to_( treat(matcher as ut_equal).exclude(a_items) );
end if;
end;

member procedure exclude(self in ut_expectation_compound, a_items ut_varchar2_list) is
begin

if ut_utils.int_to_boolean(negated) then
self.not_to( treat(matcher as ut_equal).exclude(a_items) );
if (matcher is of (ut_include)) then
self.not_include( treat(matcher as ut_equal).exclude(a_items) );
else
self.not_to( treat(matcher as ut_equal).exclude(a_items) );
end if;
else
self.to_( treat(matcher as ut_equal).exclude(a_items) );
end if;
Expand Down Expand Up @@ -213,17 +228,24 @@ create or replace type body ut_expectation_compound as
member procedure join_by(self in ut_expectation_compound, a_columns varchar2) is
begin
if ut_utils.int_to_boolean(negated) then
self.not_to( treat(matcher as ut_equal).join_by(a_columns) );
if (matcher is of (ut_include)) then
self.not_include( treat(matcher as ut_equal).join_by(a_columns) );
else
self.not_to( treat(matcher as ut_equal).join_by(a_columns) );
end if;
else
self.to_( treat(matcher as ut_equal).join_by(a_columns) );
end if;
end;

member procedure join_by(self in ut_expectation_compound, a_columns ut_varchar2_list) is
begin

if ut_utils.int_to_boolean(negated) then
self.not_to( treat(matcher as ut_equal).join_by(a_columns) );
if (matcher is of (ut_include)) then
self.not_include( treat(matcher as ut_equal).join_by(a_columns) );
else
self.not_to( treat(matcher as ut_equal).join_by(a_columns) );
end if;
else
self.to_( treat(matcher as ut_equal).join_by(a_columns) );
end if;
Expand Down
89 changes: 89 additions & 0 deletions test/core/expectations/test_expectations_cursor.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -2174,5 +2174,94 @@ Diff:%
--Assert
ut.expect(expectations.failed_expectations_data()).to_be_empty();
end;

procedure cursor_not_to_contain is
l_actual SYS_REFCURSOR;
l_expected SYS_REFCURSOR;
begin
--Arrange
open l_expected for select 'TEST' username, -600 user_id from dual;

open l_actual for select username, user_id from all_users
union all
select 'TEST' username, -601 user_id from dual;

--Act
ut3.ut.expect(l_actual).not_to_contain(l_expected);
--Assert
ut.expect(expectations.failed_expectations_data()).to_be_empty();
end;

procedure cursor_not_to_include is
l_actual SYS_REFCURSOR;
l_expected SYS_REFCURSOR;
begin
--Arrange
open l_expected for select 'TEST' username, -600 user_id from dual;

open l_actual for select username, user_id from all_users
union all
select 'TEST' username, -601 user_id from dual;

--Act
ut3.ut.expect(l_actual).not_to_include(l_expected);
--Assert
ut.expect(expectations.failed_expectations_data()).to_be_empty();
end;

procedure cursor_not_to_contain_joinby is
l_actual SYS_REFCURSOR;
l_expected SYS_REFCURSOR;
begin
--Arrange
open l_actual for select username,user_id from all_users;
open l_expected for select username||'ACT' username ,user_id from all_users where rownum < 5;

--Act
ut3.ut.expect(l_actual).not_to_contain(l_expected).join_by('USER_ID');
--Assert
ut.expect(expectations.failed_expectations_data()).to_be_empty();
end;

procedure cursor_not_to_include_joinby is
l_actual SYS_REFCURSOR;
l_expected SYS_REFCURSOR;
begin
--Arrange
open l_actual for select username,user_id from all_users;
open l_expected for select username||'ACT' username ,user_id from all_users where rownum < 5;

--Act
ut3.ut.expect(l_actual).not_to_include(l_expected).join_by('USER_ID');
--Assert
ut.expect(expectations.failed_expectations_data()).to_be_empty();
end;

procedure not_cont_join_incl_cols_as_lst is
l_actual sys_refcursor;
l_expected sys_refcursor;
begin
--Arrange
open l_actual for select rownum as rn, 'b' as "A_Column", 'c' as A_COLUMN, 'x' SOME_COL, 'd' "Some_Col" from dual a connect by level < 10;
open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
--Act
ut3.ut.expect(l_actual).to_include(l_expected).include(ut3.ut_varchar2_list('RN','//A_Column','SOME_COL')).join_by('RN');
--Assert
ut.expect(expectations.failed_expectations_data()).to_be_empty();
end;

procedure not_cont_join_excl_cols_as_lst is
l_actual sys_refcursor;
l_expected sys_refcursor;
begin
--Arrange
open l_actual for select rownum as rn, 'a' as "A_Column", 'c' as A_COLUMN, 'y' SOME_COL, 'd' "Some_Col" from dual a connect by level < 10;
open l_expected for select rownum as rn, 'a' as "A_Column", 'd' as A_COLUMN, 'x' SOME_COL, 'c' "Some_Col" from dual a connect by level < 4;
--Act
ut3.ut.expect(l_actual).to_include(l_expected).exclude(ut3.ut_varchar2_list('//Some_Col','A_COLUMN')).join_by('RN');
--Assert
ut.expect(expectations.failed_expectations_data()).to_be_empty();
end;

end;
/
Loading