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
Added support for collections
  • Loading branch information
Pablo Roldán Ruíz committed Feb 9, 2017
commit 4963ebd4f27f98d7421df5fccfc87f8035c44f3f
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ create or replace type body ut_data_value_refcursor as
if self.data_value is not null then
ut_assert_processor.set_xml_nls_params();
dbms_xmlgen.restartQuery(self.data_value);
dbms_xmlgen.setMaxRows(self.data_value, 100);
dbms_xmlgen.setMaxRows(self.data_value, 1);
l_result := dbms_xmlgen.getxml(self.data_value);

if l_result is null then
Expand Down
19 changes: 19 additions & 0 deletions source/expectations/matchers/ut_be_empty.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,25 @@ create or replace type body ut_be_empty as
l_result := false;
end if;
end;
elsif a_actual is of (ut_data_value_anydata) then
declare
l_actual ut_data_value_anydata := treat(a_actual as ut_data_value_anydata);
l_type_name VARCHAR2(61);
l_type anytype;
begin
if a_actual.is_null() then
l_result := false;
elsif l_actual.data_value.gettype(l_type) in (dbms_types.typecode_varray,dbms_types.typecode_table,dbms_types.typecode_namedcollection) THEN
ut_assert_processor.set_xml_nls_params();
l_type_name := l_actual.data_value.gettypename();
l_Type_name := substr(l_type_name,instr(l_type_name,'.')+1);
l_result := xmltype(l_actual.data_value).getclobval() = '</'||l_type_name||'>';
ut_assert_processor.reset_nls_params();
ELSE
ut_utils.debug_log('Failure - ut_be_empty.run_matcher can only be used with collections and cursors');
self.error_message := 'The matcher can only be used with collections and cursors';
end if;
end;
else
l_result := (self as ut_matcher).run_matcher(a_actual);
end if;
Expand Down
6 changes: 6 additions & 0 deletions source/expectations/ut_expectation_anydata.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ create or replace type body ut_expectation_anydata as
ut_utils.debug_log('ut_expectation_anydata.to_equal(self in ut_expectation_anydata, a_expected anydata, a_nulls_are_equal boolean := null)');
self.to_( ut_equal(a_expected, a_nulls_are_equal) );
end;

member procedure to_be_empty(self in ut_expectation_anydata) is
begin
ut_utils.debug_log('ut_expectation_anydata.to_be_empty(self in ut_expectation_anydata)');
self.to_( ut_be_empty() );
end;

end;
/
3 changes: 2 additions & 1 deletion source/expectations/ut_expectation_anydata.tps
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ create or replace type ut_expectation_anydata under ut_expectation(
See the License for the specific language governing permissions and
limitations under the License.
*/
overriding member procedure to_equal(self in ut_expectation_anydata, a_expected anydata, a_nulls_are_equal boolean := null)
overriding member procedure to_equal(self in ut_expectation_anydata, a_expected anydata, a_nulls_are_equal boolean := null),
member procedure to_be_empty(self in ut_expectation_anydata)
)
/