Pipeline controller: plan 2 (hard +, error +50 %), backlog throttle, 2 trajectory workers, stop rules, summaries every 50; budget reserve
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
115
tasks_gen/train/G1024/reference/holiday_checker.testclasses.abap
Normal file
115
tasks_gen/train/G1024/reference/holiday_checker.testclasses.abap
Normal file
@@ -0,0 +1,115 @@
|
||||
CLASS ltc_holiday_checker DEFINITION FINAL FOR TESTING
|
||||
DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS c_today TYPE d VALUE '20260101'.
|
||||
|
||||
DATA mo_cut TYPE REF TO {{p}}holiday_checker.
|
||||
|
||||
METHODS setup.
|
||||
METHODS valid_booking FOR TESTING.
|
||||
METHODS minimum_values FOR TESTING.
|
||||
METHODS unknown_destination FOR TESTING.
|
||||
METHODS too_many_travellers FOR TESTING.
|
||||
METHODS bad_nights FOR TESTING.
|
||||
METHODS early_departure FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_holiday_checker IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}holiday_checker( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD valid_booking.
|
||||
DATA(lv_done) = abap_false.
|
||||
TRY.
|
||||
mo_cut->check( is_booking = VALUE #( dest_code = 'KYOTO'
|
||||
travellers = 8
|
||||
nights = 10
|
||||
departure = '20260301' )
|
||||
iv_today = c_today ).
|
||||
lv_done = abap_true.
|
||||
CATCH {{p}}cx_holiday_error INTO DATA(lx).
|
||||
cl_abap_unit_assert=>fail( |Unexpected exception: { lx->mv_message }| ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_done ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD minimum_values.
|
||||
DATA(lv_done) = abap_false.
|
||||
TRY.
|
||||
mo_cut->check( is_booking = VALUE #( dest_code = 'LAPLAND'
|
||||
travellers = 1
|
||||
nights = 2
|
||||
departure = '20260115' )
|
||||
iv_today = c_today ).
|
||||
lv_done = abap_true.
|
||||
CATCH {{p}}cx_holiday_error INTO DATA(lx).
|
||||
cl_abap_unit_assert=>fail( |Unexpected exception: { lx->mv_message }| ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_equals( exp = abap_true act = lv_done ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_destination.
|
||||
TRY.
|
||||
mo_cut->check( is_booking = VALUE #( dest_code = 'MARS'
|
||||
travellers = 2
|
||||
nights = 7
|
||||
departure = '20260301' )
|
||||
iv_today = c_today ).
|
||||
cl_abap_unit_assert=>fail( 'CX_UNKNOWN_DEST expected' ).
|
||||
CATCH {{p}}cx_unknown_dest INTO DATA(lx).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `MARS` act = lx->mv_dest ).
|
||||
CATCH {{p}}cx_holiday_error.
|
||||
cl_abap_unit_assert=>fail( 'Wrong exception type' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD too_many_travellers.
|
||||
TRY.
|
||||
mo_cut->check( is_booking = VALUE #( dest_code = 'SAFARI'
|
||||
travellers = 8
|
||||
nights = 7
|
||||
departure = '20260301' )
|
||||
iv_today = c_today ).
|
||||
cl_abap_unit_assert=>fail( 'CX_BAD_TRAVELLERS expected' ).
|
||||
CATCH {{p}}cx_bad_travellers INTO DATA(lx).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 8 act = lx->mv_travellers ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 7 act = lx->mv_max ).
|
||||
CATCH {{p}}cx_holiday_error.
|
||||
cl_abap_unit_assert=>fail( 'Wrong exception type' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD bad_nights.
|
||||
TRY.
|
||||
mo_cut->check( is_booking = VALUE #( dest_code = 'ALPS'
|
||||
travellers = 2
|
||||
nights = 30
|
||||
departure = '20260301' )
|
||||
iv_today = c_today ).
|
||||
cl_abap_unit_assert=>fail( 'CX_BAD_NIGHTS expected' ).
|
||||
CATCH {{p}}cx_bad_nights INTO DATA(lx).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 30 act = lx->mv_nights ).
|
||||
CATCH {{p}}cx_holiday_error.
|
||||
cl_abap_unit_assert=>fail( 'Wrong exception type' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD early_departure.
|
||||
TRY.
|
||||
mo_cut->check( is_booking = VALUE #( dest_code = 'CRETE'
|
||||
travellers = 2
|
||||
nights = 7
|
||||
departure = '20260110' )
|
||||
iv_today = c_today ).
|
||||
cl_abap_unit_assert=>fail( 'CX_BAD_DEPARTURE expected' ).
|
||||
CATCH {{p}}cx_bad_departure INTO DATA(lx).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV d( '20260115' )
|
||||
act = lx->mv_earliest ).
|
||||
CATCH {{p}}cx_holiday_error.
|
||||
cl_abap_unit_assert=>fail( 'Wrong exception type' ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user