*There is a check, that the stock passed in has to have certain characteristics,
*e.g. a stock type (cat), that is defined as "available".
*The definition which stock types are "available" (e.g. F1, F2) is done in customizing-tables
*and read by and stored in the parameter object (zifewm_mon_stock_mover_params ), that is passed into
*the stock_mover (code under test = cut).
METHOD is_not_available_stock_cat.
"[given:]
mt_mock_data = VALUE #( ( cat = 'B6' ) ). "Data, simulating a line in /SCWM/MON: it has a certain value for stock type. (all other fields don't matter)
mref_mock_prameters->clear_stock_cat_available( ). "Make sure that stock type is not in the list of acceptable stock types.
"create the stock mover, passing in the mock data and the mock parameters object.
cut = NEW zclewm_mon_stock_mover( it_data = mt_mock_data
iref_parameters = mref_mock_prameters ).
"[when:]
*we can now call the public method that contains the check.
TRY.
cut->check_and_move_stock( ).
CATCH zclewm_cx_input_false .
"[then:]
"if this check fails, an exception is thrown. This is the expected result, so the test passes: we are done here:
RETURN. "ok!
ENDTRY.
"only if for some reason there was NO exception, we reach this point. This is NOT what we expected. The test failed, so this is what we do:
cl_abap_unit_assert=>fail( ).
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 |