|
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) |
22 | | - is |
23 | | - 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 | | - ut3.ut_expectation_processor.clear_expectations(); |
44 | | - end; |
45 | | - |
46 | 3 | procedure blob_not_null |
47 | 4 | is |
48 | 5 | begin |
49 | | - test_success_expectacion('blob', 'to_blob(''abc'')'); |
| 6 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'blob', 'to_blob(''abc'')'); |
| 7 | + expectations_helpers.test_success_expectacion; |
50 | 8 | end; |
51 | 9 |
|
52 | 10 | procedure blob_0_lengt |
53 | 11 | is |
54 | 12 | begin |
55 | | - test_success_expectacion('blob', 'empty_blob()'); |
| 13 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'blob', 'empty_blob()'); |
| 14 | + expectations_helpers.test_success_expectacion; |
56 | 15 | end; |
57 | 16 |
|
58 | 17 | procedure boolean_not_null |
59 | 18 | is |
60 | 19 | begin |
61 | | - test_success_expectacion('boolean', 'true'); |
| 20 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'boolean', 'true'); |
| 21 | + expectations_helpers.test_success_expectacion; |
62 | 22 | end; |
63 | 23 |
|
64 | 24 | procedure clob_not_null |
65 | 25 | is |
66 | 26 | begin |
67 | | - test_success_expectacion('clob', 'to_clob(''abc'')'); |
| 27 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'clob', 'to_clob(''abc'')'); |
| 28 | + expectations_helpers.test_success_expectacion; |
68 | 29 | end; |
69 | 30 |
|
70 | 31 |
|
71 | 32 | procedure clob_0_lengt |
72 | 33 | is |
73 | 34 | begin |
74 | | - test_success_expectacion('clob', 'empty_clob()'); |
| 35 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'clob', 'empty_clob()'); |
| 36 | + expectations_helpers.test_success_expectacion; |
75 | 37 | end; |
76 | 38 |
|
77 | 39 | procedure date_not_null |
78 | 40 | is |
79 | 41 | begin |
80 | | - test_success_expectacion('date', 'sysdate'); |
| 42 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'date', 'sysdate'); |
| 43 | + expectations_helpers.test_success_expectacion; |
81 | 44 | end; |
82 | 45 |
|
83 | 46 | procedure number_not_null |
84 | 47 | is |
85 | 48 | begin |
86 | | - test_success_expectacion('number', '1234'); |
| 49 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'number', '1234'); |
| 50 | + expectations_helpers.test_success_expectacion; |
87 | 51 | end; |
88 | 52 |
|
89 | 53 | procedure timestamp_not_null |
90 | 54 | is |
91 | 55 | begin |
92 | | - test_success_expectacion('timestamp', 'systimestamp'); |
| 56 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'timestamp', 'systimestamp'); |
| 57 | + expectations_helpers.test_success_expectacion; |
93 | 58 | end; |
94 | 59 |
|
95 | 60 | procedure timestamp_with_ltz_not_null |
96 | 61 | is |
97 | 62 | begin |
98 | | - test_success_expectacion('timestamp with local time zone', 'systimestamp'); |
| 63 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'timestamp with local time zone', 'systimestamp'); |
| 64 | + expectations_helpers.test_success_expectacion; |
99 | 65 | end; |
100 | 66 |
|
101 | 67 | procedure timestamp_with_tz_not_null |
102 | 68 | is |
103 | 69 | begin |
104 | | - test_success_expectacion('timestamp with time zone', 'systimestamp'); |
| 70 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'timestamp with time zone', 'systimestamp'); |
| 71 | + expectations_helpers.test_success_expectacion; |
105 | 72 | end; |
106 | 73 |
|
107 | 74 | procedure varchar2_not_null |
108 | 75 | is |
109 | 76 | begin |
110 | | - test_success_expectacion('varchar2(4000)', '''abc'''); |
| 77 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'varchar2(4000)', '''abc'''); |
| 78 | + expectations_helpers.test_success_expectacion; |
111 | 79 | end; |
112 | 80 |
|
113 | 81 | procedure null_blob |
114 | 82 | is |
115 | 83 | begin |
116 | | - test_failure_expectacion('blob', 'null'); |
| 84 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'blob', 'null'); |
| 85 | + expectations_helpers.test_failure_expectacion; |
117 | 86 | end; |
118 | 87 |
|
119 | 88 |
|
120 | 89 | procedure null_boolean |
121 | 90 | is |
122 | 91 | begin |
123 | | - test_failure_expectacion('boolean', 'null'); |
| 92 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'boolean', 'null'); |
| 93 | + expectations_helpers.test_failure_expectacion; |
124 | 94 | end; |
125 | 95 |
|
126 | 96 |
|
127 | 97 | procedure null_clob |
128 | 98 | is |
129 | 99 | begin |
130 | | - test_failure_expectacion('clob', 'null'); |
| 100 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'clob', 'null'); |
| 101 | + expectations_helpers.test_failure_expectacion; |
131 | 102 | end; |
132 | 103 |
|
133 | 104 |
|
134 | 105 | procedure null_date |
135 | 106 | is |
136 | 107 | begin |
137 | | - test_failure_expectacion('date', 'null'); |
| 108 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'date', 'null'); |
| 109 | + expectations_helpers.test_failure_expectacion; |
138 | 110 | end; |
139 | 111 |
|
140 | 112 |
|
141 | 113 | procedure null_number |
142 | 114 | is |
143 | 115 | begin |
144 | | - test_failure_expectacion('number', 'null'); |
| 116 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'number', 'null'); |
| 117 | + expectations_helpers.test_failure_expectacion; |
145 | 118 | end; |
146 | 119 |
|
147 | 120 |
|
148 | 121 | procedure null_timestamp |
149 | 122 | is |
150 | 123 | begin |
151 | | - test_failure_expectacion('timestamp', 'null'); |
| 124 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'timestamp', 'null'); |
| 125 | + expectations_helpers.test_failure_expectacion; |
152 | 126 | end; |
153 | 127 |
|
154 | 128 |
|
155 | 129 | procedure null_timestamp_with_ltz |
156 | 130 | is |
157 | 131 | begin |
158 | | - test_failure_expectacion('timestamp with local time zone', 'null'); |
| 132 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'timestamp with local time zone', 'null'); |
| 133 | + expectations_helpers.test_failure_expectacion; |
159 | 134 | end; |
160 | 135 |
|
161 | 136 |
|
162 | 137 | procedure null_timestamp_with_tz |
163 | 138 | is |
164 | 139 | begin |
165 | | - test_failure_expectacion('timestamp with time zone', 'null'); |
| 140 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'timestamp with time zone', 'null'); |
| 141 | + expectations_helpers.test_failure_expectacion; |
166 | 142 | end; |
167 | 143 |
|
168 | 144 |
|
169 | 145 | procedure null_varchar2 |
170 | 146 | is |
171 | 147 | begin |
172 | | - test_failure_expectacion('varchar2(4000)', 'null'); |
| 148 | + expectations_helpers.execute_unary_expectation('not_to_be_null', 'varchar2(4000)', 'null'); |
| 149 | + expectations_helpers.test_failure_expectacion; |
173 | 150 | end; |
174 | 151 |
|
175 | 152 | end test_expect_not_to_be_null; |
|
0 commit comments