|
1 | 1 | create or replace package body test_expect_not_to_be_null |
2 | 2 | is |
3 | | - |
4 | | - procedure execute_expectation(a_data_type in varchar2, |
5 | | - a_data_value in varchar2) |
6 | | - is |
7 | | - l_execute varchar2(32000); |
8 | | - begin |
9 | | - -- arrange |
10 | | - l_execute := ' declare |
11 | | - l_expected '||a_data_type||' := '||a_data_value||'; |
12 | | - begin |
13 | | - --act - execute the expectation |
14 | | - ut3.ut.expect(l_expected).not_to_be_null(); |
15 | | - end;'; |
16 | | - |
17 | | - execute immediate l_execute; |
18 | | - end; |
19 | | - |
20 | | - procedure test_success_expectacion(a_data_type in varchar2, |
21 | | - a_data_value in varchar2) |
| 3 | + procedure cleanup_expectations |
22 | 4 | is |
23 | 5 | begin |
24 | | - execute_expectation(a_data_type, a_data_value); |
25 | | - |
26 | | - --assert - check that expectation was executed successfully |
27 | | - ut.expect(ut3.ut_expectation_processor.get_status()).to_equal(ut3.ut_utils.tr_success); |
28 | | - |
29 | | - -- cleanup |
30 | | - ut3.ut_expectation_processor.clear_expectations(); |
31 | | - end; |
32 | | - |
33 | | - procedure test_failure_expectacion(a_data_type in varchar2, |
34 | | - a_data_value in varchar2) |
35 | | - is |
36 | | - begin |
37 | | - execute_expectation(a_data_type, a_data_value); |
38 | | - |
39 | | - --assert - check that expectation was a failure |
40 | | - ut.expect(ut3.ut_expectation_processor.get_status()).to_equal(ut3.ut_utils.tr_failure); |
41 | | - |
42 | | - -- cleanup |
43 | 6 | ut3.ut_expectation_processor.clear_expectations(); |
44 | 7 | end; |
45 | 8 |
|
46 | 9 | procedure blob_not_null |
47 | 10 | is |
48 | 11 | begin |
49 | | - test_success_expectacion('blob', 'to_blob(''abc'')'); |
| 12 | + --Act |
| 13 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'blob', 'to_blob(''abc'')'); |
| 14 | + --Assert |
| 15 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty(); |
50 | 16 | end; |
51 | 17 |
|
52 | 18 | procedure blob_0_lengt |
53 | 19 | is |
54 | 20 | begin |
55 | | - test_success_expectacion('blob', 'empty_blob()'); |
| 21 | + --Act |
| 22 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'blob', 'empty_blob()'); |
| 23 | + --Assert |
| 24 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty(); |
56 | 25 | end; |
57 | 26 |
|
58 | 27 | procedure boolean_not_null |
59 | 28 | is |
60 | 29 | begin |
61 | | - test_success_expectacion('boolean', 'true'); |
| 30 | + --Act |
| 31 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'boolean', 'true'); |
| 32 | + --Assert |
| 33 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty(); |
62 | 34 | end; |
63 | 35 |
|
64 | 36 | procedure clob_not_null |
65 | 37 | is |
66 | 38 | begin |
67 | | - test_success_expectacion('clob', 'to_clob(''abc'')'); |
| 39 | + --Act |
| 40 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'clob', 'to_clob(''abc'')'); |
| 41 | + --Assert |
| 42 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty(); |
68 | 43 | end; |
69 | 44 |
|
70 | 45 |
|
71 | 46 | procedure clob_0_lengt |
72 | 47 | is |
73 | 48 | begin |
74 | | - test_success_expectacion('clob', 'empty_clob()'); |
| 49 | + --Act |
| 50 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'clob', 'empty_clob()'); |
| 51 | + --Assert |
| 52 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty(); |
75 | 53 | end; |
76 | 54 |
|
77 | 55 | procedure date_not_null |
78 | 56 | is |
79 | 57 | begin |
80 | | - test_success_expectacion('date', 'sysdate'); |
| 58 | + --Act |
| 59 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'date', 'sysdate'); |
| 60 | + --Assert |
| 61 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty(); |
81 | 62 | end; |
82 | 63 |
|
83 | 64 | procedure number_not_null |
84 | 65 | is |
85 | 66 | begin |
86 | | - test_success_expectacion('number', '1234'); |
| 67 | + --Act |
| 68 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'number', '1234'); |
| 69 | + --Assert |
| 70 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty(); |
87 | 71 | end; |
88 | 72 |
|
89 | 73 | procedure timestamp_not_null |
90 | 74 | is |
91 | 75 | begin |
92 | | - test_success_expectacion('timestamp', 'systimestamp'); |
| 76 | + --Act |
| 77 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'timestamp', 'systimestamp'); |
| 78 | + --Assert |
| 79 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty(); |
93 | 80 | end; |
94 | 81 |
|
95 | 82 | procedure timestamp_with_ltz_not_null |
96 | 83 | is |
97 | 84 | begin |
98 | | - test_success_expectacion('timestamp with local time zone', 'systimestamp'); |
| 85 | + --Act |
| 86 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'timestamp with local time zone', 'systimestamp'); |
| 87 | + --Assert |
| 88 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty(); |
99 | 89 | end; |
100 | 90 |
|
101 | 91 | procedure timestamp_with_tz_not_null |
102 | 92 | is |
103 | 93 | begin |
104 | | - test_success_expectacion('timestamp with time zone', 'systimestamp'); |
| 94 | + --Act |
| 95 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'timestamp with time zone', 'systimestamp'); |
| 96 | + --Assert |
| 97 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty(); |
105 | 98 | end; |
106 | 99 |
|
107 | 100 | procedure varchar2_not_null |
108 | 101 | is |
109 | 102 | begin |
110 | | - test_success_expectacion('varchar2(4000)', '''abc'''); |
| 103 | + --Act |
| 104 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'varchar2(4000)', '''abc'''); |
| 105 | + --Assert |
| 106 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).to_be_empty(); |
111 | 107 | end; |
112 | 108 |
|
113 | 109 | procedure null_blob |
114 | 110 | is |
115 | 111 | begin |
116 | | - test_failure_expectacion('blob', 'null'); |
| 112 | + --Act |
| 113 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'blob', 'null'); |
| 114 | + --Assert |
| 115 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty(); |
117 | 116 | end; |
118 | 117 |
|
119 | 118 |
|
120 | 119 | procedure null_boolean |
121 | 120 | is |
122 | 121 | begin |
123 | | - test_failure_expectacion('boolean', 'null'); |
| 122 | + --Act |
| 123 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'boolean', 'null'); |
| 124 | + --Assert |
| 125 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty(); |
124 | 126 | end; |
125 | 127 |
|
126 | 128 |
|
127 | 129 | procedure null_clob |
128 | 130 | is |
129 | 131 | begin |
130 | | - test_failure_expectacion('clob', 'null'); |
| 132 | + --Act |
| 133 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'clob', 'null'); |
| 134 | + --Assert |
| 135 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty(); |
131 | 136 | end; |
132 | 137 |
|
133 | 138 |
|
134 | 139 | procedure null_date |
135 | 140 | is |
136 | 141 | begin |
137 | | - test_failure_expectacion('date', 'null'); |
| 142 | + --Act |
| 143 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'date', 'null'); |
| 144 | + --Assert |
| 145 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty(); |
138 | 146 | end; |
139 | 147 |
|
140 | 148 |
|
141 | 149 | procedure null_number |
142 | 150 | is |
143 | 151 | begin |
144 | | - test_failure_expectacion('number', 'null'); |
| 152 | + --Act |
| 153 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'number', 'null'); |
| 154 | + --Assert |
| 155 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty(); |
145 | 156 | end; |
146 | 157 |
|
147 | 158 |
|
148 | 159 | procedure null_timestamp |
149 | 160 | is |
150 | 161 | begin |
151 | | - test_failure_expectacion('timestamp', 'null'); |
| 162 | + --Act |
| 163 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'timestamp', 'null'); |
| 164 | + --Assert |
| 165 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty(); |
152 | 166 | end; |
153 | 167 |
|
154 | 168 |
|
155 | 169 | procedure null_timestamp_with_ltz |
156 | 170 | is |
157 | 171 | begin |
158 | | - test_failure_expectacion('timestamp with local time zone', 'null'); |
| 172 | + --Act |
| 173 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'timestamp with local time zone', 'null'); |
| 174 | + --Assert |
| 175 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty(); |
159 | 176 | end; |
160 | 177 |
|
161 | 178 |
|
162 | 179 | procedure null_timestamp_with_tz |
163 | 180 | is |
164 | 181 | begin |
165 | | - test_failure_expectacion('timestamp with time zone', 'null'); |
| 182 | + --Act |
| 183 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'timestamp with time zone', 'null'); |
| 184 | + --Assert |
| 185 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty(); |
166 | 186 | end; |
167 | 187 |
|
168 | 188 |
|
169 | 189 | procedure null_varchar2 |
170 | 190 | is |
171 | 191 | begin |
172 | | - test_failure_expectacion('varchar2(4000)', 'null'); |
| 192 | + --Act |
| 193 | + execute immediate expectations_helpers.unary_expectation_block('not_to_be_null', 'varchar2(4000)', 'null'); |
| 194 | + --Assert |
| 195 | + ut.expect(anydata.convertCollection(ut3.ut_expectation_processor.get_failed_expectations())).not_to_be_empty(); |
173 | 196 | end; |
174 | 197 |
|
175 | 198 | end test_expect_not_to_be_null; |
|
0 commit comments