Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
CLASS ltc_tyre_checker DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}tyre_checker.
|
||||
|
||||
METHODS setup.
|
||||
METHODS accepts_valid_order FOR TESTING.
|
||||
METHODS rejects_bad_qty FOR TESTING.
|
||||
METHODS rejects_wrong_size FOR TESTING.
|
||||
METHODS rejects_low_load FOR TESTING.
|
||||
METHODS rejects_low_speed FOR TESTING.
|
||||
METHODS reports_qty_message FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_tyre_checker IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}tyre_checker(
|
||||
is_vehicle = VALUE #( width_mm = 205 profile_pct = 55 rim_inch = 16
|
||||
load_index = 91 speed_kmh = 240 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD accepts_valid_order.
|
||||
TRY.
|
||||
mo_cut->check_order(
|
||||
is_order = VALUE #( width_mm = 205 profile_pct = 55 rim_inch = 16
|
||||
load_index = 91 speed_kmh = 240 qty = 4 ) ).
|
||||
CATCH {{p}}cx_tyre_error INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>fail( |Unexpected exception: { lo_error->mv_text }| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_bad_qty.
|
||||
TRY.
|
||||
mo_cut->check_order(
|
||||
is_order = VALUE #( width_mm = 205 profile_pct = 55 rim_inch = 16
|
||||
load_index = 91 speed_kmh = 240 qty = 0 ) ).
|
||||
cl_abap_unit_assert=>fail( `An exception is expected` ).
|
||||
CATCH {{p}}cx_tyre_error INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Quantity must be between 1 and 4`
|
||||
act = lo_error->mv_text ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_wrong_size.
|
||||
TRY.
|
||||
mo_cut->check_order(
|
||||
is_order = VALUE #( width_mm = 205 profile_pct = 60 rim_inch = 16
|
||||
load_index = 91 speed_kmh = 240 qty = 2 ) ).
|
||||
cl_abap_unit_assert=>fail( `An exception is expected` ).
|
||||
CATCH {{p}}cx_tyre_error INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Tyre size does not match the vehicle`
|
||||
act = lo_error->mv_text ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_low_load.
|
||||
TRY.
|
||||
mo_cut->check_order(
|
||||
is_order = VALUE #( width_mm = 205 profile_pct = 55 rim_inch = 16
|
||||
load_index = 90 speed_kmh = 240 qty = 2 ) ).
|
||||
cl_abap_unit_assert=>fail( `An exception is expected` ).
|
||||
CATCH {{p}}cx_tyre_error INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Load index is too low`
|
||||
act = lo_error->mv_text ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_low_speed.
|
||||
TRY.
|
||||
mo_cut->check_order(
|
||||
is_order = VALUE #( width_mm = 205 profile_pct = 55 rim_inch = 16
|
||||
load_index = 91 speed_kmh = 230 qty = 2 ) ).
|
||||
cl_abap_unit_assert=>fail( `An exception is expected` ).
|
||||
CATCH {{p}}cx_tyre_error INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Speed rating is too low`
|
||||
act = lo_error->mv_text ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reports_qty_message.
|
||||
TRY.
|
||||
mo_cut->check_order(
|
||||
is_order = VALUE #( width_mm = 205 profile_pct = 55 rim_inch = 16
|
||||
load_index = 91 speed_kmh = 240 qty = 5 ) ).
|
||||
cl_abap_unit_assert=>fail( `An exception is expected` ).
|
||||
CATCH {{p}}cx_tyre_error INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = `Quantity must be between 1 and 4`
|
||||
act = lo_error->mv_text ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user