Object type mix: INTF, TABL, STRU, MSAG, exception tasks (harness G2, mutants, generator notes), balanced generator, kind-deficit job order, dashboard mix card
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
97
tasks_gen/train/G1902/hidden/t41_hidden.clas.abap
Normal file
97
tasks_gen/train/G1902/hidden/t41_hidden.clas.abap
Normal file
@@ -0,0 +1,97 @@
|
||||
CLASS {{p}}t41_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
METHODS msg_001_text FOR TESTING.
|
||||
METHODS msg_002_text FOR TESTING.
|
||||
METHODS msg_003_text FOR TESTING.
|
||||
METHODS msg_004_text FOR TESTING.
|
||||
METHODS msg_005_text FOR TESTING.
|
||||
METHODS placeholder_substitution FOR TESTING.
|
||||
METHODS exception_text_two_args FOR TESTING.
|
||||
METHODS exception_text_one_arg FOR TESTING.
|
||||
METHODS exception_is_catchable FOR TESTING.
|
||||
METHODS exception_is_static_check FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t41_hidden IMPLEMENTATION.
|
||||
METHOD msg_001_text.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '001' WITH 'ABAP101' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Course ABAP101 is fully booked' act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_002_text.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '002' WITH 'P-100' 'ABAP101' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Participant P-100 is already booked for course ABAP101'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_003_text.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '003' WITH 'ABAP101' '3' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Course ABAP101 has only 3 free seats left'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_004_text.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '004' WITH 'ABAP101' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Booking for course ABAP101 is confirmed'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD msg_005_text.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '005' WITH 'ABAP101' '20250301' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Course ABAP101 was cancelled on 20250301'
|
||||
act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD placeholder_substitution.
|
||||
DATA lv_text TYPE string.
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '001' WITH 'ABAP202' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Course ABAP202 is fully booked' act = lv_text ).
|
||||
MESSAGE ID '{{P}}MSG' TYPE 'E' NUMBER '001' WITH 'ABAP303' INTO lv_text.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'Course ABAP303 is fully booked' act = lv_text ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_text_two_args.
|
||||
DATA(lo_cx) = NEW {{p}}cx_booking( iv_msgno = '002' iv_arg1 = 'P-100' iv_arg2 = 'ABAP101' ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Participant P-100 is already booked for course ABAP101'
|
||||
act = lo_cx->get_text( ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_text_one_arg.
|
||||
DATA(lo_cx) = NEW {{p}}cx_booking( iv_msgno = '004' iv_arg1 = 'ABAP101' ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Booking for course ABAP101 is confirmed'
|
||||
act = lo_cx->get_text( ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_is_catchable.
|
||||
DATA lv_caught TYPE abap_bool.
|
||||
TRY.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_booking
|
||||
EXPORTING iv_msgno = '003' iv_arg1 = 'ABAP101' iv_arg2 = '1'.
|
||||
CATCH {{p}}cx_booking INTO DATA(lo_cx).
|
||||
lv_caught = abap_true.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'Course ABAP101 has only 1 free seats left'
|
||||
act = lo_cx->get_text( ) ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_true( lv_caught ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD exception_is_static_check.
|
||||
DATA lo_cx TYPE REF TO cx_static_check.
|
||||
lo_cx = NEW {{p}}cx_booking( iv_msgno = '001' iv_arg1 = 'ABAP101' ).
|
||||
cl_abap_unit_assert=>assert_bound( lo_cx ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user