Skip to content

Commit 4963ebd

Browse files
author
Pablo Roldán Ruíz
committed
Added support for collections
1 parent 6a4dc99 commit 4963ebd

4 files changed

Lines changed: 28 additions & 2 deletions

File tree

source/expectations/data_values/ut_data_value_refcursor.tpb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ create or replace type body ut_data_value_refcursor as
6161
if self.data_value is not null then
6262
ut_assert_processor.set_xml_nls_params();
6363
dbms_xmlgen.restartQuery(self.data_value);
64-
dbms_xmlgen.setMaxRows(self.data_value, 100);
64+
dbms_xmlgen.setMaxRows(self.data_value, 1);
6565
l_result := dbms_xmlgen.getxml(self.data_value);
6666

6767
if l_result is null then

source/expectations/matchers/ut_be_empty.tpb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,25 @@ create or replace type body ut_be_empty as
4040
l_result := false;
4141
end if;
4242
end;
43+
elsif a_actual is of (ut_data_value_anydata) then
44+
declare
45+
l_actual ut_data_value_anydata := treat(a_actual as ut_data_value_anydata);
46+
l_type_name VARCHAR2(61);
47+
l_type anytype;
48+
begin
49+
if a_actual.is_null() then
50+
l_result := false;
51+
elsif l_actual.data_value.gettype(l_type) in (dbms_types.typecode_varray,dbms_types.typecode_table,dbms_types.typecode_namedcollection) THEN
52+
ut_assert_processor.set_xml_nls_params();
53+
l_type_name := l_actual.data_value.gettypename();
54+
l_Type_name := substr(l_type_name,instr(l_type_name,'.')+1);
55+
l_result := xmltype(l_actual.data_value).getclobval() = '</'||l_type_name||'>';
56+
ut_assert_processor.reset_nls_params();
57+
ELSE
58+
ut_utils.debug_log('Failure - ut_be_empty.run_matcher can only be used with collections and cursors');
59+
self.error_message := 'The matcher can only be used with collections and cursors';
60+
end if;
61+
end;
4362
else
4463
l_result := (self as ut_matcher).run_matcher(a_actual);
4564
end if;

source/expectations/ut_expectation_anydata.tpb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ create or replace type body ut_expectation_anydata as
2020
ut_utils.debug_log('ut_expectation_anydata.to_equal(self in ut_expectation_anydata, a_expected anydata, a_nulls_are_equal boolean := null)');
2121
self.to_( ut_equal(a_expected, a_nulls_are_equal) );
2222
end;
23+
24+
member procedure to_be_empty(self in ut_expectation_anydata) is
25+
begin
26+
ut_utils.debug_log('ut_expectation_anydata.to_be_empty(self in ut_expectation_anydata)');
27+
self.to_( ut_be_empty() );
28+
end;
2329

2430
end;
2531
/

source/expectations/ut_expectation_anydata.tps

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ create or replace type ut_expectation_anydata under ut_expectation(
1515
See the License for the specific language governing permissions and
1616
limitations under the License.
1717
*/
18-
overriding member procedure to_equal(self in ut_expectation_anydata, a_expected anydata, a_nulls_are_equal boolean := null)
18+
overriding member procedure to_equal(self in ut_expectation_anydata, a_expected anydata, a_nulls_are_equal boolean := null),
19+
member procedure to_be_empty(self in ut_expectation_anydata)
1920
)
2021
/

0 commit comments

Comments
 (0)