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