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 | 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 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 1x 1x 1x 1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port DEFINITION FINAL FOR TESTING. PUBLIC SECTION. INTERFACES: zif_abapgit_git_transport. ENDCLASS. CLASS ltd_branch_list DEFINITION FINAL FOR TESTING INHERITING FROM zcl_abapgit_git_branch_list. PUBLIC SECTION. METHODS: constructor IMPORTING iv_data TYPE string RAISING zcx_abapgit_exception, find_by_name REDEFINITION. ENDCLASS. CLASS ltcl_validate_form DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. CONSTANTS: c_git_repo_url TYPE string VALUE 'https://repo.com/demo.git'. DATA: mo_cut TYPE REF TO zcl_abapgit_gui_page_sett_remo, mo_repo TYPE REF TO zcl_abapgit_repo_online, mo_given_form_data TYPE REF TO zcl_abapgit_string_map, mo_act_validation_log TYPE REF TO zcl_abapgit_string_map, mo_git_transport_mock TYPE REF TO zif_abapgit_git_transport, mo_frontend_services_mock TYPE REF TO zif_abapgit_frontend_services. METHODS: setup RAISING cx_static_check, teardown RAISING cx_static_check, switch_to_offline_no_error FOR TESTING RAISING cx_static_check, invalid_url FOR TESTING RAISING cx_static_check, invalid_url2 FOR TESTING RAISING cx_static_check, valid_url_no_head_type FOR TESTING RAISING cx_static_check, invalid_branch FOR TESTING RAISING cx_static_check, valid_branch FOR TESTING RAISING cx_static_check, invalid_tag FOR TESTING RAISING cx_static_check, valid_tag FOR TESTING RAISING cx_static_check, invalid_pull_request FOR TESTING RAISING cx_static_check, valid_pull_request FOR TESTING RAISING cx_static_check, invalid_commit FOR TESTING RAISING cx_static_check, valid_commit FOR TESTING RAISING cx_static_check, when_validate_form RAISING zcx_abapgit_exception, then_no_error_shd_occur, then_error_shd_occur IMPORTING iv_exp_error_key TYPE string. ENDCLASS. CLASS zcl_abapgit_gui_page_sett_remo DEFINITION LOCAL FRIENDS ltcl_validate_form. CLASS ltd_git_transport IMPLEMENTATION. METHOD zif_abapgit_git_transport~branches. CONSTANTS: lc_dummy_data TYPE string VALUE '0000'. CREATE OBJECT ro_branch_list TYPE ltd_branch_list EXPORTING iv_data = lc_dummy_data. ENDMETHOD. ENDCLASS. CLASS ltd_branch_list IMPLEMENTATION. METHOD constructor. super->constructor( iv_data ). ENDMETHOD. METHOD find_by_name. IF iv_branch_name CS 'feature' OR iv_branch_name CS 'inv_tag' OR iv_branch_name CS 'inv_pr' OR iv_branch_name IS INITIAL. RAISE EXCEPTION TYPE zcx_abapgit_exception. ENDIF. ENDMETHOD. ENDCLASS. CLASS ltcl_validate_form IMPLEMENTATION. METHOD setup. DATA: ls_data TYPE zif_abapgit_persistence=>ty_repo. CREATE OBJECT mo_git_transport_mock TYPE ltd_git_transport. zcl_abapgit_git_injector=>set_git_transport( mo_git_transport_mock ). " Disable GUI mo_frontend_services_mock = zcl_abapgit_ui_factory=>get_frontend_services( abap_true ). ls_data-key = 1. ls_data-branch_name = 'main'. CREATE OBJECT mo_repo EXPORTING is_data = ls_data. CREATE OBJECT mo_given_form_data. mo_given_form_data->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-branch iv_val = 'main' ). CREATE OBJECT mo_cut EXPORTING io_repo = mo_repo. ENDMETHOD. METHOD teardown. CLEAR: mo_git_transport_mock, mo_frontend_services_mock. zcl_abapgit_git_injector=>set_git_transport( mo_git_transport_mock ). zcl_abapgit_ui_injector=>set_frontend_services( mo_frontend_services_mock ). ENDMETHOD. METHOD switch_to_offline_no_error. mo_given_form_data->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-offline iv_val = abap_true ). when_validate_form( ). then_no_error_shd_occur( ). ENDMETHOD. METHOD invalid_url. mo_given_form_data->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-offline iv_val = abap_false )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-url iv_val = 'http://test' ). when_validate_form( ). then_error_shd_occur( zcl_abapgit_gui_page_sett_remo=>c_id-url ). ENDMETHOD. METHOD invalid_url2. mo_given_form_data->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-offline iv_val = abap_false )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-url iv_val = 'test' ). when_validate_form( ). then_error_shd_occur( zcl_abapgit_gui_page_sett_remo=>c_id-url ). ENDMETHOD. METHOD valid_url_no_head_type. mo_given_form_data->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-offline iv_val = abap_false )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-url iv_val = c_git_repo_url ). when_validate_form( ). then_error_shd_occur( zcl_abapgit_gui_page_sett_remo=>c_id-head_type ). ENDMETHOD. METHOD invalid_branch. mo_given_form_data->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-offline iv_val = abap_false )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-url iv_val = c_git_repo_url )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-head_type iv_val = zcl_abapgit_gui_page_sett_remo=>c_head_types-branch )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-branch iv_val = 'feature' ). when_validate_form( ). then_error_shd_occur( zcl_abapgit_gui_page_sett_remo=>c_id-branch ). ENDMETHOD. METHOD valid_branch. mo_given_form_data->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-offline iv_val = abap_false )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-url iv_val = c_git_repo_url )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-head_type iv_val = zcl_abapgit_gui_page_sett_remo=>c_head_types-branch )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-branch iv_val = 'main' ). when_validate_form( ). then_no_error_shd_occur( ). ENDMETHOD. METHOD invalid_tag. mo_given_form_data->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-offline iv_val = abap_false )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-url iv_val = c_git_repo_url )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-head_type iv_val = zcl_abapgit_gui_page_sett_remo=>c_head_types-tag )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-tag iv_val = 'inv_tag' ). when_validate_form( ). then_error_shd_occur( zcl_abapgit_gui_page_sett_remo=>c_id-tag ). ENDMETHOD. METHOD valid_tag. mo_given_form_data->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-offline iv_val = abap_false )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-url iv_val = c_git_repo_url )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-head_type iv_val = zcl_abapgit_gui_page_sett_remo=>c_head_types-tag )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-tag iv_val = 'v1.1.3' ). when_validate_form( ). then_no_error_shd_occur( ). ENDMETHOD. METHOD invalid_pull_request. mo_given_form_data->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-offline iv_val = abap_false )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-url iv_val = c_git_repo_url )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-head_type iv_val = zcl_abapgit_gui_page_sett_remo=>c_head_types-pull_request )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-pull_request iv_val = 'x@inv_pr' ). when_validate_form( ). then_error_shd_occur( zcl_abapgit_gui_page_sett_remo=>c_id-pull_request ). ENDMETHOD. METHOD valid_pull_request. mo_given_form_data->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-offline iv_val = abap_false )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-url iv_val = c_git_repo_url )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-head_type iv_val = zcl_abapgit_gui_page_sett_remo=>c_head_types-pull_request )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-pull_request iv_val = 'x@pr' ). when_validate_form( ). then_no_error_shd_occur( ). ENDMETHOD. METHOD invalid_commit. mo_given_form_data->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-offline iv_val = abap_false )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-url iv_val = c_git_repo_url )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-head_type iv_val = zcl_abapgit_gui_page_sett_remo=>c_head_types-commit )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-commit iv_val = 'ABCD1234' ). when_validate_form( ). then_error_shd_occur( zcl_abapgit_gui_page_sett_remo=>c_id-commit ). ENDMETHOD. METHOD valid_commit. mo_given_form_data->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-offline iv_val = abap_false )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-url iv_val = c_git_repo_url )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-head_type iv_val = zcl_abapgit_gui_page_sett_remo=>c_head_types-commit )->set( iv_key = zcl_abapgit_gui_page_sett_remo=>c_id-commit iv_val = '1d4abf5342a939202ae24ab4a5ad78da3cad24fb' ). when_validate_form( ). then_no_error_shd_occur( ). ENDMETHOD. METHOD when_validate_form. mo_act_validation_log = mo_cut->validate_form( io_form_data = mo_given_form_data iv_connection_check = abap_false ). ENDMETHOD. METHOD then_no_error_shd_occur. cl_abap_unit_assert=>assert_equals( exp = abap_true act = mo_act_validation_log->is_empty( ) ). ENDMETHOD. METHOD then_error_shd_occur. cl_abap_unit_assert=>assert_not_initial( mo_act_validation_log->get( iv_exp_error_key ) ). ENDMETHOD. ENDCLASS. |