@@ -43,7 +43,9 @@ create or replace type body ut_data_value_anydata as
4343 l_result integer;
4444 procedure exclude_xpaths(a_xml in out nocopy xmltype, a_xpath varchar2) is
4545 begin
46- select case when a_xpath is not null then deletexml( a_xml, a_xpath ) else a_xml end into a_xml from dual;
46+ if a_xpath is not null then
47+ select deletexml( a_xml, a_xpath ) into a_xml from dual;
48+ end if;
4749 end;
4850 begin
4951 if a_other is of (ut_data_value_anydata) then
@@ -53,6 +55,12 @@ create or replace type body ut_data_value_anydata as
5355 ut_expectation_processor.set_xml_nls_params();
5456 l_self_data := xmltype.createxml(self.data_value);
5557 l_other_data := xmltype.createxml(l_other.data_value);
58+ --We use `order member function compare` to do data comparison.
59+ --Therefore, in the `ut_equals` matcher, comparison is done by simply checking
60+ -- `l_result := equal_with_nulls((self.expected = a_actual), a_actual)`
61+ --We cannot guarantee that we will always use `expected = actual ` and not `actual = expected`.
62+ --We should expect the same behaviour regardless of that is the order.
63+ -- This is why we need to coalesce `exclude_xpath` though at most one of them will always be populated
5664 exclude_xpaths(l_self_data, coalesce(self.exclude_xpath, l_other.exclude_xpath));
5765 exclude_xpaths(l_other_data, coalesce(self.exclude_xpath, l_other.exclude_xpath));
5866 ut_expectation_processor.reset_nls_params();
0 commit comments