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

Skip to content

Commit d26e13a

Browse files
authored
Merge pull request #558 from AlexisGaldamez/refactored_test_to_be_null
Test refactored for the expectation to_be_null
2 parents 3776018 + 9f31fcf commit d26e13a

6 files changed

Lines changed: 388 additions & 36 deletions

File tree

old_tests/RunAll.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ exec ut_coverage.coverage_start_develop();
4646
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_null.anydata.GivesSuccessWhenAnydataIsNull.sql
4747
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_null.anydata.GivesSuccessWhenCollectionPassedIsNull.sql
4848
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_null.anydata.GivesSuccessWhenObjectPassedIsNull.sql
49-
@@ut_expectations/ut.expect.to_be_null.sql
5049
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_true.GivesFailureWhenExpessionIsFalse.sql
5150
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_true.GivesFailureWhenExpessionIsNotBoolean.sql
5251
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_true.GivesFailureWhenExpessionIsNull.sql

old_tests/ut_expectations/common/ut.expect.unuary_comparator.scalar.common.sql

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

old_tests/ut_expectations/ut.expect.to_be_null.sql

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 289 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
create or replace package body test_expect_to_be_null
2+
is
3+
gc_object_name constant varchar2(30) := 't_to_be_null_test';
4+
gc_nested_table_name constant varchar2(30) := 'tt_to_be_null_test';
5+
gc_varray_name constant varchar2(30) := 'tv_to_be_null_test';
6+
7+
procedure cleanup_expectations
8+
is
9+
begin
10+
ut3.ut_expectation_processor.clear_expectations();
11+
end;
12+
13+
procedure create_types
14+
is
15+
pragma autonomous_transaction;
16+
begin
17+
execute immediate 'create type '||gc_object_name||' is object (dummy number)';
18+
execute immediate 'create type '||gc_nested_table_name||' is table of number';
19+
execute immediate 'create type '||gc_varray_name||' is varray(1) of number';
20+
end;
21+
22+
procedure drop_types
23+
is
24+
pragma autonomous_transaction;
25+
begin
26+
execute immediate 'drop type '||gc_object_name;
27+
execute immediate 'drop type '||gc_nested_table_name;
28+
execute immediate 'drop type '||gc_varray_name;
29+
end;
30+
31+
procedure null_blob
32+
is
33+
begin
34+
--Act
35+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'blob', 'null');
36+
--Assert
37+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
38+
end;
39+
40+
procedure null_boolean
41+
is
42+
begin
43+
--Act
44+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'boolean', 'null');
45+
--Assert
46+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
47+
end;
48+
49+
50+
procedure null_clob
51+
is
52+
begin
53+
--Act
54+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'clob', 'null');
55+
--Assert
56+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
57+
end;
58+
59+
60+
procedure null_date
61+
is
62+
begin
63+
--Act
64+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'date', 'null');
65+
--Assert
66+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
67+
end;
68+
69+
70+
procedure null_number
71+
is
72+
begin
73+
--Act
74+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'number', 'null');
75+
--Assert
76+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
77+
end;
78+
79+
80+
procedure null_timestamp
81+
is
82+
begin
83+
--Act
84+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'timestamp', 'null');
85+
--Assert
86+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
87+
end;
88+
89+
90+
procedure null_timestamp_with_ltz
91+
is
92+
begin
93+
--Act
94+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'timestamp with local time zone', 'null');
95+
--Assert
96+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
97+
end;
98+
99+
100+
procedure null_timestamp_with_tz
101+
is
102+
begin
103+
--Act
104+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'timestamp with time zone', 'null');
105+
--Assert
106+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
107+
end;
108+
109+
110+
procedure null_varchar2
111+
is
112+
begin
113+
--Act
114+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'varchar2(4000)', 'null');
115+
--Assert
116+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
117+
end;
118+
119+
procedure null_anydata
120+
is
121+
begin
122+
--Act
123+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'anydata', 'null');
124+
--Assert
125+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
126+
end;
127+
128+
procedure uninit_object_in_anydata
129+
is
130+
begin
131+
--Act
132+
execute immediate expectations_helpers.unary_expectation_object_block('to_be_null', gc_object_name,
133+
'null', 'object');
134+
--Assert
135+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
136+
end;
137+
138+
procedure uninit_nested_table_in_anydata
139+
is
140+
begin
141+
--Act
142+
execute immediate expectations_helpers.unary_expectation_object_block('to_be_null', gc_nested_table_name,
143+
'null', 'collection');
144+
--Assert
145+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
146+
end;
147+
148+
procedure uninit_varray_in_anydata
149+
is
150+
begin
151+
--Act
152+
execute immediate expectations_helpers.unary_expectation_object_block('to_be_null', gc_varray_name,
153+
'null', 'collection');
154+
--Assert
155+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty();
156+
end;
157+
158+
procedure blob_not_null
159+
is
160+
begin
161+
--Act
162+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'blob', 'to_blob(''abc'')');
163+
--Assert
164+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
165+
end;
166+
167+
procedure blob_0_length
168+
is
169+
begin
170+
--Act
171+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'blob', 'empty_blob()');
172+
--Assert
173+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
174+
end;
175+
176+
procedure boolean_not_null
177+
is
178+
begin
179+
--Act
180+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'boolean', 'true');
181+
--Assert
182+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
183+
end;
184+
185+
procedure clob_not_null
186+
is
187+
begin
188+
--Act
189+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'clob', 'to_clob(''abc'')');
190+
--Assert
191+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
192+
end;
193+
194+
195+
procedure clob_0_length
196+
is
197+
begin
198+
--Act
199+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'clob', 'empty_clob()');
200+
--Assert
201+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
202+
end;
203+
204+
procedure date_not_null
205+
is
206+
begin
207+
--Act
208+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'date', 'sysdate');
209+
--Assert
210+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
211+
end;
212+
213+
procedure number_not_null
214+
is
215+
begin
216+
--Act
217+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'number', '1234');
218+
--Assert
219+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
220+
end;
221+
222+
procedure timestamp_not_null
223+
is
224+
begin
225+
--Act
226+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'timestamp', 'systimestamp');
227+
--Assert
228+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
229+
end;
230+
231+
procedure timestamp_with_ltz_not_null
232+
is
233+
begin
234+
--Act
235+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'timestamp with local time zone', 'systimestamp');
236+
--Assert
237+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
238+
end;
239+
240+
procedure timestamp_with_tz_not_null
241+
is
242+
begin
243+
--Act
244+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'timestamp with time zone', 'systimestamp');
245+
--Assert
246+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
247+
end;
248+
249+
procedure varchar2_not_null
250+
is
251+
begin
252+
--Act
253+
execute immediate expectations_helpers.unary_expectation_block('to_be_null', 'varchar2(4000)', '''abc''');
254+
--Assert
255+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
256+
end;
257+
258+
procedure initialized_object
259+
is
260+
begin
261+
--Act
262+
execute immediate expectations_helpers.unary_expectation_object_block('to_be_null', gc_object_name,
263+
gc_object_name||'(1)', 'object');
264+
--Assert
265+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
266+
end;
267+
268+
procedure initialized_nested_table
269+
is
270+
begin
271+
--Act
272+
execute immediate expectations_helpers.unary_expectation_object_block('to_be_null', gc_nested_table_name,
273+
gc_nested_table_name||'()', 'collection');
274+
--Assert
275+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
276+
end;
277+
278+
procedure initialized_varray
279+
is
280+
begin
281+
--Act
282+
execute immediate expectations_helpers.unary_expectation_object_block('to_be_null', gc_varray_name,
283+
gc_varray_name||'()', 'collection');
284+
--Assert
285+
ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty();
286+
end;
287+
288+
end test_expect_to_be_null;
289+
/

0 commit comments

Comments
 (0)