CLASS {{p}}t_locksmith_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. DATA mo_cut TYPE REF TO {{p}}if_locksmith_pricer. METHODS setup. METHODS dup_standard_basic FOR TESTING. METHODS dup_discount_from_five FOR TESTING. METHODS dup_discount_from_twenty FOR TESTING. METHODS dup_no_discount_for_four FOR TESTING. METHODS dup_zero_quantity FOR TESTING. METHODS unknown_key_type FOR TESTING. METHODS lockout_standard FOR TESTING. METHODS lockout_after_hours FOR TESTING. METHODS lockout_weekend FOR TESTING. METHODS rekey_standard FOR TESTING. METHODS rekey_electronic FOR TESTING. METHODS unknown_job_type FOR TESTING. METHODS assert_price IMPORTING iv_expected TYPE {{p}}if_locksmith_pricer=>ty_amount iv_actual TYPE {{p}}if_locksmith_pricer=>ty_amount iv_msg TYPE string DEFAULT ''. ENDCLASS. CLASS {{p}}t_locksmith_hidden IMPLEMENTATION. METHOD setup. mo_cut = NEW {{p}}locksmith_pricer( ). ENDMETHOD. METHOD dup_standard_basic. assert_price( iv_expected = '13.50' iv_actual = mo_cut->calculate_price( iv_job_type = 'K' iv_quantity = 3 iv_key_type = 'S' iv_callout = 'N' ) ). ENDMETHOD. METHOD dup_discount_from_five. assert_price( iv_expected = '20.25' iv_actual = mo_cut->calculate_price( iv_job_type = 'K' iv_quantity = 5 iv_key_type = 'S' iv_callout = 'N' ) ). ENDMETHOD. METHOD dup_discount_from_twenty. assert_price( iv_expected = '156.80' iv_actual = mo_cut->calculate_price( iv_job_type = 'K' iv_quantity = 20 iv_key_type = 'Y' iv_callout = 'N' ) ). ENDMETHOD. METHOD dup_no_discount_for_four. assert_price( iv_expected = '96.00' iv_actual = mo_cut->calculate_price( iv_job_type = 'K' iv_quantity = 4 iv_key_type = 'E' iv_callout = 'N' ) ). ENDMETHOD. METHOD dup_zero_quantity. assert_price( iv_expected = '0.00' iv_actual = mo_cut->calculate_price( iv_job_type = 'K' iv_quantity = 0 iv_key_type = 'S' iv_callout = 'N' ) ). ENDMETHOD. METHOD unknown_key_type. assert_price( iv_expected = '0.00' iv_msg = 'duplicate' iv_actual = mo_cut->calculate_price( iv_job_type = 'K' iv_quantity = 3 iv_key_type = 'X' iv_callout = 'N' ) ). assert_price( iv_expected = '0.00' iv_msg = 'rekey' iv_actual = mo_cut->calculate_price( iv_job_type = 'R' iv_quantity = 2 iv_key_type = 'X' iv_callout = 'N' ) ). ENDMETHOD. METHOD lockout_standard. assert_price( iv_expected = '89.00' iv_actual = mo_cut->calculate_price( iv_job_type = 'L' iv_quantity = 5 iv_key_type = 'X' iv_callout = 'N' ) ). ENDMETHOD. METHOD lockout_after_hours. assert_price( iv_expected = '149.00' iv_actual = mo_cut->calculate_price( iv_job_type = 'L' iv_quantity = 0 iv_key_type = 'X' iv_callout = 'A' ) ). ENDMETHOD. METHOD lockout_weekend. assert_price( iv_expected = '179.00' iv_actual = mo_cut->calculate_price( iv_job_type = 'L' iv_quantity = 0 iv_key_type = 'X' iv_callout = 'W' ) ). ENDMETHOD. METHOD rekey_standard. assert_price( iv_expected = '82.00' iv_actual = mo_cut->calculate_price( iv_job_type = 'R' iv_quantity = 2 iv_key_type = 'S' iv_callout = 'N' ) ). ENDMETHOD. METHOD rekey_electronic. assert_price( iv_expected = '61.00' iv_actual = mo_cut->calculate_price( iv_job_type = 'R' iv_quantity = 1 iv_key_type = 'E' iv_callout = 'N' ) ). ENDMETHOD. METHOD unknown_job_type. assert_price( iv_expected = '0.00' iv_actual = mo_cut->calculate_price( iv_job_type = 'X' iv_quantity = 1 iv_key_type = 'S' iv_callout = 'N' ) ). ENDMETHOD. METHOD assert_price. cl_abap_unit_assert=>assert_equals( exp = iv_expected act = iv_actual msg = iv_msg ). ENDMETHOD. ENDCLASS.