
CLASS ltc_test_stasam_data_filtering DEFINITION FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT
FRIENDS zclewm_stasam_interface.
PRIVATE SECTION.
METHODS: test1_filter_out_QDOCID FOR TESTING.
ENDCLASS.
CLASS ltc_test_stasam_data_filtering IMPLEMENTATION.
METHOD test1_filter_out_QDOCID.
"given
DATA(cut) = NEW zclewm_stasam_interface( iv_lgnum = '1020' ).
DATA: lt_stock_mon TYPE /scwm/tt_stock_mon .
"fill with samples
APPEND VALUE #( matnr = '0815'
qdocid = 'hsdfksdhfk' )
TO lt_stock_mon.
*Sample has just 1 line, an that has a QDOCID;
*Filter should delete it:
"when
cut->filter_data_rem_picked_stock( CHANGING ct_stock_mon = lt_stock_mon ).
"then Table should be empty:
cl_abap_unit_assert=>assert_initial( act = lt_stock_mon ).
ENDMETHOD.
ENDCLASS.
CLASS ltc_test_stasam_data_filtering DEFINITION FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT.
PRIVATE SECTION.
METHODS: test1_filter_out_QDOCID FOR TESTING.
ENDCLASS.
CLASS ltc_test_stasam_data_filtering IMPLEMENTATION.
METHOD test1_filter_out_QDOCID.
"given
DATA(cut) = NEW zclewm_stasam_interface( iv_lgnum = '1020' ).
DATA: lt_stock_mon TYPE /scwm/tt_stock_mon .
"fill with samples
APPEND VALUE #( matnr = '0815'
qdocid = 'hsdfksdhfk' ) TO lt_stock_mon.
*Sample has just 1 line, an that has a QDOCID;
*Filter should delete it: "when
cut->filter_data_rem_picked_stock( CHANGING ct_stock_mon = lt_stock_mon ).
"then Table should be empty:
cl_abap_unit_assert=>assert_initial( act = lt_stock_mon ).
ENDMETHOD.
ENDCLASS.
METHOD test2_nothing_to_filter_out.
"given
DATA(cut) = NEW zclewm_stasam_interface( iv_lgnum = '1020' ).
DATA: lt_stock_mon TYPE /scwm/tt_stock_mon .
"fill with samples
APPEND VALUE #( matnr = '0815'
qdocid = space ) TO lt_stock_mon.
data(lt_copy_to_compare) = lt_stock_mon.
*Filter should keep it - it should not change: "when
cut->filter_data_rem_picked_stock( CHANGING ct_stock_mon = lt_stock_mon ).
"then un-changed Table should be same as the copy we made before:
cl_abap_unit_assert=>assert_equals( act = lt_stock_mon
exp = lt_copy_to_compare ).
ENDMETHOD.
CLASS ltc_test_stasam_data_filtering DEFINITION FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT.
PRIVATE SECTION.
DATA: cut TYPE REF TO zclewm_stasam_interface,
mt_stock_mon TYPE /scwm/tt_stock_mon .
METHODS:
setup,
test1_filter_out_QDOCID FOR TESTING,
test2_nothing_to_filter_out FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltc_test_stasam_data_filtering IMPLEMENTATION.
METHOD setup. "given
cut = NEW zclewm_stasam_interface( iv_lgnum = '1020' ).
ENDMETHOD.
METHOD test1_filter_out_QDOCID.
"given
DATA(cut) = NEW zclewm_stasam_interface( iv_lgnum = '1020' ).
DATA: lt_stock_mon TYPE /scwm/tt_stock_mon .
"fill with samples
APPEND VALUE #( matnr = '0815'
qdocid = 'hsdfksdhfk' ) TO lt_stock_mon.
*Sample has just 1 line, an that has a QDOCID;
*Filter should delete it: "when
cut->filter_data_rem_picked_stock( CHANGING ct_stock_mon = lt_stock_mon )
"then Table should be empty:
cl_abap_unit_assert=>assert_initial( act = lt_stock_mon ).
ENDMETHOD.
METHOD test2_nothing_to_filter_out.
"given: cut is in setup( ) now
"fill with samples
APPEND VALUE #( matnr = '0815'
qdocid = space ) TO mt_stock_mon.
DATA(lt_copy_to_compare) = mt_stock_mon.
*Filter should keep it - it should not change: "when
cut->filter_data_rem_picked_stock( CHANGING ct_stock_mon = mt_stock_mon ).
"then un-changed Table should be same as the copy we made before:
cl_abap_unit_assert=>assert_equals( act = mt_stock_mon
exp = lt_copy_to_compare ).
ENDMETHOD.
ENDCLASS.
METHOD setup. "given
cut = NEW zclewm_stasam_interface( iv_lgnum = '1020' ).
line_1_with_qdocid_filled = VALUE #( matnr = '0815' qdocid = '478326423648' ).
line_2_with_emtyp_qdocid = VALUE #( matnr = '0815' qdocid = space ).
ENDMETHOD.
CLASS ltc_test_stasam_data_filtering DEFINITION FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT.
PRIVATE SECTION.
DATA: cut TYPE REF TO zclewm_stasam_interface,
mt_stock_mon TYPE /scwm/tt_stock_mon ,
line_1_with_qdocid_filled type /scwm/s_stock_mon,
line_2_with_emtyp_qdocid type /scwm/s_stock_mon.
METHODS:
setup,
test1_filter_out_QDOCID FOR TESTING,
test2_nothing_to_filter_out FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltc_test_stasam_data_filtering IMPLEMENTATION.
METHOD setup. "given
cut = NEW zclewm_stasam_interface( iv_lgnum = '1020' ).
line_1_with_qdocid_filled = VALUE #( matnr = '0815' qdocid = '478326423648' ).
line_2_with_emtyp_qdocid = VALUE #( matnr = '0815' qdocid = space ).
ENDMETHOD.
METHOD test1_filter_out_QDOCID.
"given
DATA(cut) = NEW zclewm_stasam_interface( iv_lgnum = '1020' ).
DATA: lt_stock_mon TYPE /scwm/tt_stock_mon .
"fill with samples
APPEND VALUE #( matnr = '0815'
qdocid = 'hsdfksdhfk' ) TO lt_stock_mon.
*Sample has just 1 line, an that has a QDOCID;
*Filter should delete it: "when
cut->filter_data_rem_picked_stock( CHANGING ct_stock_mon = lt_stock_mon ).
"then Table should be empty:
cl_abap_unit_assert=>assert_initial( act = lt_stock_mon ).
ENDMETHOD.
METHOD test2_nothing_to_filter_out.
append line_2_with_emtyp_qdocid to mt_stock_mon.
DATA(lt_copy_to_compare) = mt_stock_mon.
*Filter should keep it - it should not change: "when
cut->filter_data_rem_picked_stock( CHANGING ct_stock_mon = mt_stock_mon ).
"then un-changed Table should be same as the copy we made before:
cl_abap_unit_assert=>assert_equals( act = mt_stock_mon
exp = lt_copy_to_compare ).
ENDMETHOD.
ENDCLASS.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
9 | |
9 | |
7 | |
4 | |
3 | |
3 | |
3 | |
2 | |
2 |