CLASS {{p}}t_bowl_test DEFINITION PUBLIC FINAL CREATE PUBLIC FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. METHODS fee_for IMPORTING iv_lanes TYPE i iv_minutes TYPE i iv_players TYPE i iv_day TYPE string iv_start TYPE t iv_member TYPE abap_bool RETURNING VALUE(rv_fee) TYPE decfloat34. METHODS lane_fee FOR TESTING. METHODS surcharges FOR TESTING. METHODS member_discount FOR TESTING. METHODS invalid_input FOR TESTING. ENDCLASS. CLASS {{p}}t_bowl_test IMPLEMENTATION. METHOD fee_for. CALL FUNCTION '{{P}}BOWL_FEE_OLD' EXPORTING iv_lanes = iv_lanes iv_minutes = iv_minutes iv_players = iv_players iv_day = iv_day iv_start = iv_start iv_member = iv_member IMPORTING ev_fee = rv_fee EXCEPTIONS invalid_input = 1 OTHERS = 2. cl_abap_unit_assert=>assert_subrc( exp = 0 ). ENDMETHOD. METHOD lane_fee. cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '12.00' ) act = fee_for( iv_lanes = 1 iv_minutes = 60 iv_players = 0 iv_day = 'WED' iv_start = '140000' iv_member = abap_false ) ). ENDMETHOD. METHOD surcharges. cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '14.40' ) act = fee_for( iv_lanes = 1 iv_minutes = 60 iv_players = 0 iv_day = 'WED' iv_start = '190000' iv_member = abap_false ) ). cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '13.80' ) act = fee_for( iv_lanes = 1 iv_minutes = 60 iv_players = 0 iv_day = 'SAT' iv_start = '140000' iv_member = abap_false ) ). ENDMETHOD. METHOD member_discount. cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '30.60' ) act = fee_for( iv_lanes = 2 iv_minutes = 60 iv_players = 4 iv_day = 'WED' iv_start = '140000' iv_member = abap_true ) ). ENDMETHOD. METHOD invalid_input. DATA lv_fee TYPE decfloat34. CALL FUNCTION '{{P}}BOWL_FEE_OLD' EXPORTING iv_lanes = 0 iv_minutes = 60 iv_players = 0 iv_day = 'WED' iv_start = '140000' iv_member = abap_false IMPORTING ev_fee = lv_fee EXCEPTIONS invalid_input = 1 OTHERS = 2. cl_abap_unit_assert=>assert_equals( exp = 1 act = sy-subrc ). ENDMETHOD. ENDCLASS.