All files / src/ui/lib zcl_abapgit_gui_page.clas.testclasses.abap

94.91% Statements 168/177
100% Branches 8/8
47.05% Functions 8/17
94.91% Lines 168/177

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 1781x 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 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 3x 3x 3x 3x 3x 3x 3x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 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  
CLASS ltd_frontend_services DEFINITION FINAL FOR TESTING.
 
  PUBLIC SECTION.
 
    INTERFACES zif_abapgit_frontend_services.
 
    METHODS constructor
      IMPORTING
        !iv_is_webgui             TYPE abap_bool
        !iv_is_sapgui_for_windows TYPE abap_bool.
 
  PRIVATE SECTION.
 
    DATA mv_is_webgui TYPE abap_bool.
    DATA mv_is_sapgui_for_windows TYPE abap_bool.
 
ENDCLASS.
 
 
CLASS ltd_frontend_services IMPLEMENTATION.
 
  METHOD constructor.
    mv_is_webgui = iv_is_webgui.
    mv_is_sapgui_for_windows = iv_is_sapgui_for_windows.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~is_webgui.
    rv_is_webgui = mv_is_webgui.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~is_sapgui_for_windows.
    rv_result = mv_is_sapgui_for_windows.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~is_sapgui_for_java.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~clipboard_export.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~directory_browse.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~directory_create.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~directory_exist.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~execute.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~file_download.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~file_upload.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~get_file_separator.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~get_gui_type.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~get_gui_version.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~get_system_directory.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~gui_is_available.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~open_ie_devtools.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~show_file_open_dialog.
  ENDMETHOD.
 
  METHOD zif_abapgit_frontend_services~show_file_save_dialog.
  ENDMETHOD.
 
ENDCLASS.
 
 
CLASS ltcl_render_environment DEFINITION FINAL FOR TESTING
  DURATION SHORT
  RISK LEVEL HARMLESS.
 
  PRIVATE SECTION.
 
    METHODS teardown.
 
    METHODS sapgui_for_html FOR TESTING RAISING cx_static_check.
    METHODS sapgui_for_windows FOR TESTING RAISING cx_static_check.
    METHODS sapgui_for_java FOR TESTING RAISING cx_static_check.
 
    METHODS assert_seeded
      IMPORTING
        !iv_is_webgui             TYPE abap_bool
        !iv_is_sapgui_for_windows TYPE abap_bool
        !iv_exp                   TYPE string
      RAISING
        cx_static_check.
 
ENDCLASS.
 
CLASS zcl_abapgit_gui_page DEFINITION LOCAL FRIENDS ltcl_render_environment.
 
 
CLASS ltcl_render_environment IMPLEMENTATION.
 
  METHOD teardown.
 
    DATA li_frontend_services TYPE REF TO zif_abapgit_frontend_services.
 
    " Unbound, so the factory creates the real implementation again
    zcl_abapgit_ui_injector=>set_frontend_services( li_frontend_services ).
 
  ENDMETHOD.
 
  METHOD assert_seeded.
 
    DATA li_frontend_services TYPE REF TO zif_abapgit_frontend_services.
    DATA li_html TYPE REF TO zif_abapgit_html.
    DATA lv_act TYPE string.
 
    CREATE OBJECT li_frontend_services TYPE ltd_frontend_services
      EXPORTING
        iv_is_webgui             = iv_is_webgui
        iv_is_sapgui_for_windows = iv_is_sapgui_for_windows.
 
    zcl_abapgit_ui_injector=>set_frontend_services( li_frontend_services ).
 
    CREATE OBJECT li_html TYPE zcl_abapgit_html.
 
    zcl_abapgit_gui_page=>render_environment( li_html ).
 
    " Layout is formatting; the contract common.js relies on is the call, the
    " key names and the JS literals, so compare without any whitespace
    lv_act = li_html->render( iv_no_line_breaks = abap_true ).
    CONDENSE lv_act NO-GAPS.
 
    cl_abap_unit_assert=>assert_equals(
      act = lv_act
      exp = iv_exp ).
 
  ENDMETHOD.
 
  METHOD sapgui_for_html.
 
    assert_seeded(
      iv_is_webgui             = abap_true
      iv_is_sapgui_for_windows = abap_false
      iv_exp                   = `setEnvironment({isWebGui:true,isSapGuiForWindows:false});` ).
 
  ENDMETHOD.
 
  METHOD sapgui_for_windows.
 
    assert_seeded(
      iv_is_webgui             = abap_false
      iv_is_sapgui_for_windows = abap_true
      iv_exp                   = `setEnvironment({isWebGui:false,isSapGuiForWindows:true});` ).
 
  ENDMETHOD.
 
  METHOD sapgui_for_java.
 
    assert_seeded(
      iv_is_webgui             = abap_false
      iv_is_sapgui_for_windows = abap_false
      iv_exp                   = `setEnvironment({isWebGui:false,isSapGuiForWindows:false});` ).
 
  ENDMETHOD.
 
ENDCLASS.