add basic unit test for recursive_struct_to_class

This commit is contained in:
larshp 2023-07-28 06:02:36 +00:00
parent 425b6a2b7d
commit d4fa2db930

View File

@ -122,6 +122,7 @@ CLASS lcl_excel_common_test DEFINITION FOR TESTING
METHODS is_cell_in_range_upperside_out FOR TESTING. METHODS is_cell_in_range_upperside_out FOR TESTING.
METHODS is_cell_in_range_rightside_out FOR TESTING. METHODS is_cell_in_range_rightside_out FOR TESTING.
METHODS is_cell_in_range_lowerside_out FOR TESTING. METHODS is_cell_in_range_lowerside_out FOR TESTING.
METHODS recursive_struct_to_class FOR TESTING RAISING cx_static_check.
ENDCLASS. ENDCLASS.
@ -1597,4 +1598,28 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
ENDTRY. ENDTRY.
ENDMETHOD. "is_cell_in_range_lowerside_out. ENDMETHOD. "is_cell_in_range_lowerside_out.
METHOD recursive_struct_to_class.
DATA style TYPE REF TO zcl_excel_style.
DATA complete_style TYPE zexcel_s_cstyle_complete.
DATA complete_stylex TYPE zexcel_s_cstylex_complete.
CREATE OBJECT style.
complete_style-number_format-format_code = 'hello'.
complete_stylex-number_format-format_code = abap_true.
zcl_excel_common=>recursive_struct_to_class(
EXPORTING
i_source = complete_style
i_sourcex = complete_stylex
CHANGING
e_target = style ).
cl_abap_unit_assert=>assert_equals(
act = style->number_format->format_code
exp = 'hello' ).
ENDMETHOD.
ENDCLASS. ENDCLASS.