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

Skip to content

Commit dc14dc7

Browse files
committed
Fixing issue 1113 where the act were inserted into exp
1 parent 075fe52 commit dc14dc7

3 files changed

Lines changed: 34 additions & 11 deletions

File tree

source/expectations/data_values/ut_data_value_json.tpb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ create or replace type body ut_data_value_json as
147147
l_result :=
148148
case
149149
when ut_compound_data_helper.insert_json_diffs(
150-
l_diff_id, self.json_tree.json_tree_info, l_other.json_tree.json_tree_info
150+
l_diff_id, l_other.json_tree.json_tree_info, self.json_tree.json_tree_info
151151
) > 0 then 1
152152
else 0
153153
end;

test/ut3_user/expectations/test_expectations_json.pkb

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ create or replace package body test_expectations_json is
6262
l_actual_message varchar2(32767);
6363
begin
6464
-- Arrange
65-
l_expected := json_element_t.parse('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
66-
l_actual := json_element_t.parse('{"Aidan Gillen": {"array": ["Game of Thron\"es","The Wire"],"string": "some string","int": 2,"aboolean": true, "boolean": true,"object": {"foo": "bar","object1": {"new prop1": "new prop value"},"object2": {"new prop1": "new prop value"},"object3": {"new prop1": "new prop value"},"object4": {"new prop1": "new prop value"}}},"Amy Ryan": {"one": "In Treatment","two": "The Wire"},"Annie Fitzgerald": ["Big Love","True Blood"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsgard": ["Generation Kill","True Blood"], "Clarke Peters": null}');
65+
l_actual := json_element_t.parse('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
66+
l_expected := json_element_t.parse('{"Aidan Gillen": {"array": ["Game of Thron\"es","The Wire"],"string": "some string","int": 2,"aboolean": true, "boolean": true,"object": {"foo": "bar","object1": {"new prop1": "new prop value"},"object2": {"new prop1": "new prop value"},"object3": {"new prop1": "new prop value"},"object4": {"new prop1": "new prop value"}}},"Amy Ryan": {"one": "In Treatment","two": "The Wire"},"Annie Fitzgerald": ["Big Love","True Blood"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsgard": ["Generation Kill","True Blood"], "Clarke Peters": null}');
6767

6868
--Act
6969
ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
@@ -387,7 +387,7 @@ create or replace package body test_expectations_json is
387387
l_actual_message varchar2(32767);
388388
begin
389389
-- Arrange
390-
l_expected := json_object_t.parse(' {
390+
l_actual := json_object_t.parse(' {
391391
"Actors": [
392392
{
393393
"name": "Tom Cruise",
@@ -424,7 +424,7 @@ create or replace package body test_expectations_json is
424424
]
425425
}'
426426
);
427-
l_actual := json_object_t.parse(' {
427+
l_expected := json_object_t.parse(' {
428428
"Actors":
429429
{
430430
"name": "Krzystof Jarzyna",
@@ -444,8 +444,8 @@ create or replace package body test_expectations_json is
444444

445445

446446
--Act
447-
ut3_develop.ut.expect(json_array_t(json_query(l_actual.stringify,'$.Actors.children'))).to_equal(json_array_t(json_query(l_expected
448-
.stringify,'$.Actors[1].children')));
447+
ut3_develop.ut.expect(json_array_t(json_query(l_actual.stringify,'$.Actors[1].children'))).to_equal(json_array_t(json_query(l_expected
448+
.stringify,'$.Actors.children')));
449449
--Assert
450450
l_expected_message := q'[%Actual: json was expected to equal: json
451451
%Diff: 1 differences found
@@ -1055,7 +1055,7 @@ create or replace package body test_expectations_json is
10551055
l_actual_message varchar2(32767);
10561056
begin
10571057
-- Arrange
1058-
l_expected := json_element_t.parse('[
1058+
l_actual := json_element_t.parse('[
10591059
{
10601060
"_id": "5ce6ec46cb9977b050f15d97",
10611061
"index": 0,
@@ -1282,7 +1282,7 @@ create or replace package body test_expectations_json is
12821282
"favoriteFruit": "strawberry"
12831283
}
12841284
]');
1285-
l_actual := json_element_t.parse('[
1285+
l_expected := json_element_t.parse('[
12861286
{
12871287
"_id": "5ce6ec6660565269b16cf836",
12881288
"index": 0,
@@ -1665,8 +1665,8 @@ create or replace package body test_expectations_json is
16651665
l_actual_message varchar2(32767);
16661666
begin
16671667
-- Arrange
1668-
l_expected := json('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
1669-
l_actual := json('{"Aidan Gillen": {"array": ["Game of Thron\"es","The Wire"],"string": "some string","int": 2,"aboolean": true, "boolean": true,"object": {"foo": "bar","object1": {"new prop1": "new prop value"},"object2": {"new prop1": "new prop value"},"object3": {"new prop1": "new prop value"},"object4": {"new prop1": "new prop value"}}},"Amy Ryan": {"one": "In Treatment","two": "The Wire"},"Annie Fitzgerald": ["Big Love","True Blood"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsgard": ["Generation Kill","True Blood"], "Clarke Peters": null}');
1668+
l_actual := json('{"Aidan Gillen": {"array": ["Game of Thrones","The Wire"],"string": "some string","int": "2","otherint": 4, "aboolean": "true", "boolean": false,"object": {"foo": "bar"}},"Amy Ryan": ["In Treatment","The Wire"],"Annie Fitzgerald": ["True Blood","Big Love","The Sopranos","Oz"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsg?rd": ["Generation Kill","True Blood"],"Alice Farmer": ["The Corner","Oz","The Wire"]}');
1669+
l_expected := json('{"Aidan Gillen": {"array": ["Game of Thron\"es","The Wire"],"string": "some string","int": 2,"aboolean": true, "boolean": true,"object": {"foo": "bar","object1": {"new prop1": "new prop value"},"object2": {"new prop1": "new prop value"},"object3": {"new prop1": "new prop value"},"object4": {"new prop1": "new prop value"}}},"Amy Ryan": {"one": "In Treatment","two": "The Wire"},"Annie Fitzgerald": ["Big Love","True Blood"],"Anwan Glover": ["Treme","The Wire"],"Alexander Skarsgard": ["Generation Kill","True Blood"], "Clarke Peters": null}');
16701670

16711671
--Act
16721672
ut3_develop.ut.expect( l_actual ).to_equal( l_expected );
@@ -1784,5 +1784,24 @@ create or replace package body test_expectations_json is
17841784
end;
17851785

17861786
$end
1787+
1788+
procedure p_1113_reg_exp_chg_with_act is
1789+
l_expected_message varchar2(32767);
1790+
l_actual_message varchar2(32767);
1791+
begin
1792+
ut3_develop.ut.expect(json_element_t.parse('{"a":"value a"}')).to_equal(json_element_t.parse('{"a":"value b"}'));
1793+
1794+
--Assert
1795+
l_expected_message := q'[%Actual: json was expected to equal: json
1796+
%Diff: 1 differences found
1797+
%1 unequal values
1798+
%Actual value: "value a" was expected to be: "value b" on path: $."a"%]';
1799+
1800+
l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
1801+
--Assert
1802+
ut.expect(l_actual_message).to_be_like(l_expected_message);
1803+
end;
1804+
1805+
17871806
end;
17881807
/

test/ut3_user/expectations/test_expectations_json.pks

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,9 @@ create or replace package test_expectations_json is
9999
procedure fail_not_to_have_count_njson;
100100

101101
$end
102+
103+
--%test( Regression scenario tests for issue #1113 where the expected has been switched with actual)
104+
procedure p_1113_reg_exp_chg_with_act;
105+
102106
end;
103107
/

0 commit comments

Comments
 (0)