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

Skip to content

Commit e5f71b8

Browse files
authored
Merge pull request #555 from AlexisGaldamez/refactored_test_to_be_not_null
Test to_be_not_null refactored
2 parents efb772b + c7c2cad commit e5f71b8

10 files changed

Lines changed: 430 additions & 49 deletions

old_tests/RunAll.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ exec ut_coverage.coverage_start_develop();
4343
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_false.GivesFailureWhenExpessionIsTrue.sql
4444
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_false.GivesSuccessWhenExpessionIsFalse.sql
4545
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_like.FailsForUnsupportedDatatype.sql
46-
@@ut_expectations/ut.expect.to_be_not_null.GivesFailureWhenActualIsNull.sql
47-
@@ut_expectations/ut.expect.to_be_not_null.GivesSuccessWhenActualIsNotNull.sql
4846
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_null.anydata.GivesSuccessWhenAnydataIsNull.sql
4947
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_null.anydata.GivesSuccessWhenCollectionPassedIsNull.sql
5048
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_null.anydata.GivesSuccessWhenObjectPassedIsNull.sql

old_tests/ut_expectations/ut.expect.to_be_not_null.GivesFailureWhenActualIsNull.sql

Lines changed: 0 additions & 9 deletions
This file was deleted.

old_tests/ut_expectations/ut.expect.to_be_not_null.GivesSuccessWhenActualIsNotNull.sql

Lines changed: 0 additions & 9 deletions
This file was deleted.

test/core/expectations/test_expect_not_to_be_null.pkb

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,6 @@ is
2828
execute immediate 'drop type '||gc_varray_name;
2929
end;
3030

31-
function anydata_expectation_block(a_object_name in varchar2, a_object_value in varchar2,
32-
a_object_type in varchar2)
33-
return varchar2
34-
is
35-
begin
36-
return 'DECLARE
37-
l_object '||a_object_name||' := '||a_object_value||';
38-
BEGIN
39-
ut3.ut.expect(anydata.convert'||a_object_type||'(l_object)).not_to_be_null();
40-
END;';
41-
end;
42-
4331
procedure blob_not_null
4432
is
4533
begin
@@ -49,7 +37,7 @@ is
4937
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
5038
end;
5139

52-
procedure blob_0_lengt
40+
procedure blob_0_length
5341
is
5442
begin
5543
--Act
@@ -77,7 +65,7 @@ is
7765
end;
7866

7967

80-
procedure clob_0_lengt
68+
procedure clob_0_length
8169
is
8270
begin
8371
--Act
@@ -140,40 +128,43 @@ is
140128
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
141129
end;
142130

143-
procedure null_blob
131+
procedure initialized_object
144132
is
145133
begin
146134
--Act
147-
execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'blob', 'null');
135+
execute immediate expectations_helpers.unary_expectation_object_block('not_to_be_null', gc_object_name,
136+
gc_object_name||'(1)', 'object');
148137
--Assert
149-
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
138+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
150139
end;
151140

152-
procedure initialized_object
141+
procedure initialized_nested_table
153142
is
154143
begin
155144
--Act
156-
execute immediate anydata_expectation_block(gc_object_name, gc_object_name||'(1)', 'object');
145+
execute immediate expectations_helpers.unary_expectation_object_block('not_to_be_null', gc_nested_table_name,
146+
gc_nested_table_name||'()', 'collection');
157147
--Assert
158148
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
159149
end;
160150

161-
procedure initialized_nested_table
151+
procedure initialized_varray
162152
is
163153
begin
164154
--Act
165-
execute immediate anydata_expectation_block(gc_nested_table_name, gc_nested_table_name||'()', 'collection');
155+
execute immediate expectations_helpers.unary_expectation_object_block('not_to_be_null', gc_varray_name,
156+
gc_varray_name||'()', 'collection');
166157
--Assert
167158
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
168159
end;
169160

170-
procedure initialized_varray
161+
procedure null_blob
171162
is
172163
begin
173164
--Act
174-
execute immediate anydata_expectation_block(gc_varray_name, gc_varray_name||'()', 'collection');
165+
execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'blob', 'null');
175166
--Assert
176-
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
167+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
177168
end;
178169

179170
procedure null_boolean
@@ -268,7 +259,8 @@ is
268259
is
269260
begin
270261
--Act
271-
execute immediate anydata_expectation_block(gc_object_name, 'null', 'object');
262+
execute immediate expectations_helpers.unary_expectation_object_block('not_to_be_null', gc_object_name,
263+
'null', 'object');
272264
--Assert
273265
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
274266
end;
@@ -277,7 +269,8 @@ is
277269
is
278270
begin
279271
--Act
280-
execute immediate anydata_expectation_block(gc_nested_table_name, 'null', 'collection');
272+
execute immediate expectations_helpers.unary_expectation_object_block('not_to_be_null', gc_nested_table_name,
273+
'null', 'collection');
281274
--Assert
282275
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
283276
end;
@@ -286,7 +279,8 @@ is
286279
is
287280
begin
288281
--Act
289-
execute immediate anydata_expectation_block(gc_varray_name, 'null', 'collection');
282+
execute immediate expectations_helpers.unary_expectation_object_block('not_to_be_null', gc_varray_name,
283+
'null', 'collection');
290284
--Assert
291285
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
292286
end;

test/core/expectations/test_expect_not_to_be_null.pks

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ is
1616
procedure blob_not_null;
1717

1818
--%test(Gives success for blob with length 0)
19-
procedure blob_0_lengt;
19+
procedure blob_0_length;
2020

2121
--%test(Gives success for not null boolean)
2222
procedure boolean_not_null;
@@ -25,7 +25,7 @@ is
2525
procedure clob_not_null;
2626

2727
--%test(Gives success for clob with length 0)
28-
procedure clob_0_lengt;
28+
procedure clob_0_length;
2929

3030
--%test(Gives success for not null date)
3131
procedure date_not_null;

0 commit comments

Comments
 (0)