CLASS {{p}}t_arc_msg DEFINITION PUBLIC FINAL CREATE PUBLIC FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. METHODS text_of IMPORTING iv_type TYPE symsgty iv_msgno TYPE symsgno iv_value1 TYPE string iv_value2 TYPE string RETURNING VALUE(rv_text) TYPE string. METHODS msg_001 FOR TESTING. METHODS msg_002 FOR TESTING. METHODS msg_003 FOR TESTING. METHODS msg_004 FOR TESTING. METHODS exception_text FOR TESTING. ENDCLASS. CLASS {{p}}t_arc_msg IMPLEMENTATION. METHOD text_of. MESSAGE ID '{{P}}MSG_ARC' TYPE iv_type NUMBER iv_msgno WITH iv_value1 iv_value2 INTO rv_text. ENDMETHOD. METHOD msg_001. cl_abap_unit_assert=>assert_equals( exp = `Archer Robin is not licensed for bow class recurve` act = text_of( iv_type = 'E' iv_msgno = '001' iv_value1 = 'Robin' iv_value2 = 'recurve' ) ). ENDMETHOD. METHOD msg_002. cl_abap_unit_assert=>assert_equals( exp = `Arrows 4 are below the minimum of 12` act = text_of( iv_type = 'E' iv_msgno = '002' iv_value1 = '4' iv_value2 = '12' ) ). ENDMETHOD. METHOD msg_003. cl_abap_unit_assert=>assert_equals( exp = `Group of 9 archers exceeds the range limit of 6` act = text_of( iv_type = 'W' iv_msgno = '003' iv_value1 = '9' iv_value2 = '6' ) ). ENDMETHOD. METHOD msg_004. cl_abap_unit_assert=>assert_equals( exp = `Booking B-2048 is confirmed for 5 archers` act = text_of( iv_type = 'I' iv_msgno = '004' iv_value1 = 'B-2048' iv_value2 = '5' ) ). ENDMETHOD. METHOD exception_text. DATA(lo_error) = NEW {{p}}cx_bow_check( iv_msgno = '004' iv_value1 = 'B-2048' iv_value2 = '5' ). cl_abap_unit_assert=>assert_equals( exp = `Booking B-2048 is confirmed for 5 archers` act = lo_error->get_message_text( ) ). ENDMETHOD. ENDCLASS.