class ltc_simu_tester definition deferred.
class ycl_simu definition local friends ltc_simu_tester.
class ltc_simu_tester definition for testing
risk level harmless
duration medium.
private section.
data: m_cut type ref to ycl_simu.
methods: setup,
methods some for testing raising cx_static_check.
endclass.
class ltc_simu_tester implementation.
method setup.
" Initialize Class Under Test:
"-----------------------------
m_cut = ycl_simu=>factory( ).
" test double injection:
"-----------------------
* data(lo_tmp) = new zsd_td_mat_custo( ).
* lo_tmp->property = 'zsd_cl_snmathandl_standard'.
* m_cut->o_mat_custo = lo_tmp.
endmethod.
method some.
test-injection test_select.
sflight_tab = value #( ( carrid = 'AA' connid = '17' fldate = '20.10.2020' price = '422.94' currency = 'USD' planetype = '747-400' )
( carrid = 'AA' connid = '17' fldate = '08.01.2021' price = '422.94' currency = 'USD' planetype = '747-400' ) ).
end-test-injection.
data(ls_result) = m_cut->select( i_1 = 2 ).
cl_abap_unit_assert=>assert_equals( exp = '10' " Data object with expected type
act = ls_result-id ). " Data object with current value
test-injection test_select.
sflight_tab = value #( ( carrid = 'AA' connid = '17' fldate = '20.10.2020' price = '422.94' currency = 'USD' planetype = '747-400' )
( carrid = 'AA' connid = '17' fldate = '08.01.2021' price = '422.94' currency = 'USD' planetype = '747-400' ) ).
end-test-injection.
ls_result = m_cut->select( i_1 = 3 ).
cl_abap_unit_assert=>assert_equals( exp = '11' act = ls_result-id ).
endmethod.
endclass.