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 | 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 | CLASS ltcl_part_collections DEFINITION
FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT
FINAL.
PUBLIC SECTION.
PRIVATE SECTION.
METHODS test FOR TESTING.
ENDCLASS.
CLASS ltcl_part_collections IMPLEMENTATION.
METHOD test.
DATA lo_html1 TYPE REF TO zcl_abapgit_html.
DATA lo_html2 TYPE REF TO zcl_abapgit_html.
DATA lo_html3 TYPE REF TO zcl_abapgit_html.
DATA lo_html_tmp TYPE REF TO zif_abapgit_html.
DATA lo_parts TYPE REF TO zcl_abapgit_html_parts.
DATA lt_col_exp TYPE string_table.
DATA lt_parts_act TYPE zif_abapgit_html=>ty_table_of.
CREATE OBJECT lo_html1.
CREATE OBJECT lo_html2.
CREATE OBJECT lo_html3.
CREATE OBJECT lo_parts.
lo_parts->add_part(
iv_collection = 'ABC'
ii_part = lo_html1 ).
lo_parts->add_part(
iv_collection = 'ABC'
ii_part = lo_html2 ).
lo_parts->add_part(
iv_collection = 'XYZ'
ii_part = lo_html3 ).
cl_abap_unit_assert=>assert_equals(
act = lo_parts->get_collection_size( 'ABC' )
exp = 2 ).
cl_abap_unit_assert=>assert_equals(
act = lo_parts->get_collection_size( 'XYZ' )
exp = 1 ).
cl_abap_unit_assert=>assert_equals(
act = lo_parts->get_collection_size( '123' )
exp = 0 ).
APPEND 'ABC' TO lt_col_exp.
APPEND 'XYZ' TO lt_col_exp.
cl_abap_unit_assert=>assert_equals(
act = lo_parts->get_collection_names( )
exp = lt_col_exp ).
lt_parts_act = lo_parts->get_parts( 'ABC' ).
cl_abap_unit_assert=>assert_equals(
act = lines( lt_parts_act )
exp = 2 ).
READ TABLE lt_parts_act INTO lo_html_tmp INDEX 1.
cl_abap_unit_assert=>assert_equals(
act = lo_html_tmp
exp = lo_html1 ).
READ TABLE lt_parts_act INTO lo_html_tmp INDEX 2.
cl_abap_unit_assert=>assert_equals(
act = lo_html_tmp
exp = lo_html2 ).
lt_parts_act = lo_parts->get_parts( 'XYZ' ).
cl_abap_unit_assert=>assert_equals(
act = lines( lt_parts_act )
exp = 1 ).
READ TABLE lt_parts_act INTO lo_html_tmp INDEX 1.
cl_abap_unit_assert=>assert_equals(
act = lo_html_tmp
exp = lo_html3 ).
lt_parts_act = lo_parts->get_parts( '123' ).
cl_abap_unit_assert=>assert_initial( lt_parts_act ).
lo_parts->clear( ).
cl_abap_unit_assert=>assert_initial( lo_parts->get_collection_names( ) ).
ENDMETHOD.
ENDCLASS.
|