Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x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2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 1x 5x 5x 5x 5x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 1x 1x | *"* use this source file for your ABAP unit test classes CLASS lcl_mock_event DEFINITION. PUBLIC SECTION. INTERFACES zif_abapgit_gui_event. METHODS constructor. METHODS set_file IMPORTING iv_key TYPE csequence iv_value TYPE csequence RAISING zcx_abapgit_exception. PRIVATE SECTION. DATA mo_files TYPE REF TO zcl_abapgit_string_map. ENDCLASS. CLASS ltcl_stage DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. DATA: mo_mock_event TYPE REF TO lcl_mock_event, mt_status TYPE zif_abapgit_definitions=>ty_results_ts_path, mt_local TYPE zif_abapgit_definitions=>ty_files_item_tt, mo_stage TYPE REF TO zcl_abapgit_stage, mx_error TYPE REF TO zcx_abapgit_exception. METHODS: setup RAISING cx_static_check, emtpy_list FOR TESTING RAISING cx_static_check, unknown_file FOR TESTING RAISING cx_static_check, add FOR TESTING RAISING cx_static_check, uppercase_path FOR TESTING RAISING cx_static_check, uppercase_status_path FOR TESTING RAISING cx_static_check, mixed_case FOR TESTING RAISING cx_static_check, unknown_method FOR TESTING RAISING cx_static_check, status_missing FOR TESTING RAISING cx_static_check, remove FOR TESTING RAISING cx_static_check, check_selected_rm FOR TESTING RAISING cx_static_check, skip FOR TESTING RAISING cx_static_check, when_stage_selected RAISING zcx_abapgit_exception, given_file IMPORTING iv_key TYPE csequence iv_value TYPE csequence RAISING zcx_abapgit_exception, given_status IMPORTING iv_path TYPE csequence iv_filename TYPE csequence, then_file_is_ignored IMPORTING iv_path TYPE csequence iv_filename TYPE csequence, then_file_is_added IMPORTING iv_path TYPE csequence iv_filename TYPE csequence, then_error_contains IMPORTING iv_exp_error TYPE csequence, given_local IMPORTING iv_path TYPE csequence iv_filename TYPE csequence, then_file_is_removed IMPORTING iv_path TYPE csequence iv_filename TYPE csequence, then_there_is_nothing_to_stage, assert_table_contains IMPORTING is_stage TYPE zif_abapgit_definitions=>ty_stage it_stage TYPE zif_abapgit_definitions=>ty_stage_tt. ENDCLASS. CLASS lcl_mock_event IMPLEMENTATION. METHOD constructor. CREATE OBJECT mo_files. ENDMETHOD. METHOD zif_abapgit_gui_event~form_data. ro_string_map = mo_files. ENDMETHOD. METHOD zif_abapgit_gui_event~query. ENDMETHOD. METHOD set_file. mo_files->set( iv_key = iv_key iv_val = iv_value ). ENDMETHOD. ENDCLASS. CLASS ltcl_stage IMPLEMENTATION. METHOD setup. CREATE OBJECT mo_mock_event TYPE lcl_mock_event. ENDMETHOD. METHOD emtpy_list. when_stage_selected( ). then_error_contains( 'empty list' ). ENDMETHOD. METHOD unknown_file. given_file( iv_key = '/src/zddls.ddls.baseinfo' iv_value = zif_abapgit_definitions=>c_method-add ). given_status( iv_path = '/src/' iv_filename = 'zddls.ddls.baseinfo' ). when_stage_selected( ). then_error_contains( 'unknown file' ). ENDMETHOD. METHOD add. given_file( iv_key = '/src/zddls.ddls.baseinfo' iv_value = zif_abapgit_definitions=>c_method-add ). given_status( iv_path = '/src/' iv_filename = 'zddls.ddls.baseinfo' ). given_local( iv_path = '/src/' iv_filename = 'zddls.ddls.baseinfo' ). when_stage_selected( ). then_file_is_added( iv_path = '/src/' iv_filename = 'zddls.ddls.baseinfo' ). ENDMETHOD. METHOD uppercase_path. given_file( iv_key = '/SRC/ZDDLS.DDLS.BASEINFO' iv_value = zif_abapgit_definitions=>c_method-ignore ). given_status( iv_path = '/src/' iv_filename = 'zddls.ddls.baseinfo' ). when_stage_selected( ). then_file_is_ignored( iv_path = '/src/' iv_filename = 'zddls.ddls.baseinfo' ). ENDMETHOD. METHOD uppercase_status_path. given_file( iv_key = '/CODE/ZFALV.FUGR.SCREEN_0200.ABAP' iv_value = zif_abapgit_definitions=>c_method-ignore ). given_status( iv_path = '/CODE/' iv_filename = 'zfalv.fugr.screen_0200.abap' ). given_local( iv_path = '/CODE/' iv_filename = 'zfalv.fugr.screen_0200.abap' ). when_stage_selected( ). then_file_is_ignored( iv_path = '/CODE/' iv_filename = 'zfalv.fugr.screen_0200.abap' ). ENDMETHOD. METHOD mixed_case. given_file( iv_key = '/SRC/PACKAGE.DEVC.XML' iv_value = zif_abapgit_definitions=>c_method-add ). given_status( iv_path = '/SrC/' iv_filename = 'package.devc.xml' ). given_local( iv_path = '/SrC/' iv_filename = 'package.devc.xml' ). when_stage_selected( ). then_file_is_added( iv_path = '/SrC/' iv_filename = 'package.devc.xml' ). ENDMETHOD. METHOD unknown_method. given_file( iv_key = '/SRC/ZDDLS.DDLS.BASEINFO' iv_value = 'X' ). given_status( iv_path = '/src/' iv_filename = 'zddls.ddls.baseinfo' ). when_stage_selected( ). then_error_contains( 'unknown method' ). ENDMETHOD. METHOD status_missing. given_file( iv_key = '/SRC/ZDDLS.DDLS.BASEINFO' iv_value = zif_abapgit_definitions=>c_method-add ). when_stage_selected( ). then_error_contains( 'Unable to stage' ). ENDMETHOD. METHOD remove. given_file( iv_key = '/src/zddls.ddls.baseinfo' iv_value = zif_abapgit_definitions=>c_method-rm ). given_status( iv_path = '/src/' iv_filename = 'zddls.ddls.baseinfo' ). given_local( iv_path = '/src/' iv_filename = 'zddls.ddls.baseinfo' ). when_stage_selected( ). then_file_is_removed( iv_path = '/src/' iv_filename = 'zddls.ddls.baseinfo' ). ENDMETHOD. METHOD check_selected_rm. given_file( iv_key = '/src/p1/zddls.ddls.baseinfo' iv_value = zif_abapgit_definitions=>c_method-add ). given_file( iv_key = '/src/p2/zddls.ddls.baseinfo' iv_value = zif_abapgit_definitions=>c_method-add ). given_status( iv_path = '/src/' iv_filename = 'zddls.ddls.baseinfo' ). given_local( iv_path = '/src/' iv_filename = 'zddls.ddls.baseinfo' ). when_stage_selected( ). then_error_contains( |you have to remove| ). ENDMETHOD. METHOD skip. given_file( iv_key = '/src/zddls.ddls.baseinfo' iv_value = zif_abapgit_definitions=>c_method-skip ). when_stage_selected( ). then_there_is_nothing_to_stage( ). ENDMETHOD. METHOD when_stage_selected. TRY. mo_stage = lcl_selected=>get_instance( )->stage_selected( ii_event = mo_mock_event it_status = mt_status it_local = mt_local ). CATCH zcx_abapgit_exception INTO mx_error. ENDTRY. ENDMETHOD. METHOD given_file. mo_mock_event->set_file( iv_key = iv_key iv_value = iv_value ). ENDMETHOD. METHOD given_status. DATA ls_status LIKE LINE OF mt_status. ls_status-path = iv_path. ls_status-filename = iv_filename. INSERT ls_status INTO TABLE mt_status. ENDMETHOD. METHOD then_file_is_ignored. DATA: lt_stage TYPE zif_abapgit_definitions=>ty_stage_tt. DATA: ls_exp LIKE LINE OF lt_stage. lt_stage = mo_stage->get_all( ). ls_exp-file-path = iv_path. ls_exp-file-filename = iv_filename. ls_exp-method = zif_abapgit_definitions=>c_method-ignore. assert_table_contains( is_stage = ls_exp it_stage = lt_stage ). ENDMETHOD. METHOD then_file_is_added. DATA: lt_stage TYPE zif_abapgit_definitions=>ty_stage_tt. DATA: ls_exp LIKE LINE OF lt_stage. lt_stage = mo_stage->get_all( ). ls_exp-file-path = iv_path. ls_exp-file-filename = iv_filename. ls_exp-method = zif_abapgit_definitions=>c_method-add. ls_exp-status-filename = iv_filename. ls_exp-status-path = iv_path. assert_table_contains( is_stage = ls_exp it_stage = lt_stage ). ENDMETHOD. METHOD then_error_contains. cl_abap_unit_assert=>assert_text_matches( pattern = iv_exp_error text = mx_error->get_text( ) ). ENDMETHOD. METHOD given_local. DATA ls_local LIKE LINE OF mt_local. ls_local-file-path = iv_path. ls_local-file-filename = iv_filename. INSERT ls_local INTO TABLE mt_local. ENDMETHOD. METHOD then_file_is_removed. DATA: lt_stage TYPE zif_abapgit_definitions=>ty_stage_tt. DATA: ls_exp LIKE LINE OF lt_stage. lt_stage = mo_stage->get_all( ). ls_exp-file-path = iv_path. ls_exp-file-filename = iv_filename. ls_exp-method = zif_abapgit_definitions=>c_method-rm. ls_exp-status-filename = iv_filename. ls_exp-status-path = iv_path. assert_table_contains( is_stage = ls_exp it_stage = lt_stage ). ENDMETHOD. METHOD then_there_is_nothing_to_stage. cl_abap_unit_assert=>assert_initial( mo_stage->get_all( ) ). ENDMETHOD. METHOD assert_table_contains. FIELD-SYMBOLS: <ls_stage> LIKE LINE OF it_stage. READ TABLE it_stage WITH TABLE KEY file-path = is_stage-file-path file-filename = is_stage-file-filename ASSIGNING <ls_stage>. cl_abap_unit_assert=>assert_subrc( 0 ). cl_abap_unit_assert=>assert_equals( act = <ls_stage> exp = is_stage ). ENDMETHOD. ENDCLASS. |