ADT fallback: Accept headers for FUNC; G0189 accepted; regen2 results
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
@@ -1,156 +0,0 @@
|
||||
CLASS {{p}}t02_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}prescription_check.
|
||||
|
||||
METHODS setup.
|
||||
METHODS empty_prescription FOR TESTING.
|
||||
METHODS expired_prescription FOR TESTING.
|
||||
METHODS valid_on_last_day FOR TESTING.
|
||||
METHODS unknown_drug FOR TESTING.
|
||||
METHODS zero_quantity FOR TESTING.
|
||||
METHODS zero_daily_dose FOR TESTING.
|
||||
METHODS dose_above_max FOR TESTING.
|
||||
METHODS duplicate_drug FOR TESTING.
|
||||
METHODS expired_before_quantity FOR TESTING.
|
||||
METHODS dose_before_duplicate FOR TESTING.
|
||||
METHODS valid_prescription FOR TESTING.
|
||||
METHODS message_texts FOR TESTING.
|
||||
|
||||
METHODS valid_item
|
||||
RETURNING VALUE(rt_item) TYPE {{p}}prescription_check=>tt_item.
|
||||
METHODS expect_reason
|
||||
IMPORTING iv_reason TYPE {{p}}cx_presc_error=>ty_reason
|
||||
it_item TYPE {{p}}prescription_check=>tt_item
|
||||
iv_as_of TYPE d DEFAULT '20240110'.
|
||||
METHODS expect_no_error
|
||||
IMPORTING it_item TYPE {{p}}prescription_check=>tt_item
|
||||
iv_as_of TYPE d DEFAULT '20240110'.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t02_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}prescription_check( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD valid_item.
|
||||
rt_item = VALUE #( ( drug_id = 'PARA500' quantity = 20 daily_dose = 1000 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD expect_reason.
|
||||
DATA lv_raised TYPE abap_bool.
|
||||
TRY.
|
||||
mo_cut->validate( iv_issue_date = '20240101'
|
||||
iv_valid_days = 30
|
||||
iv_as_of_date = iv_as_of
|
||||
it_item = it_item ).
|
||||
CATCH {{p}}cx_presc_error INTO DATA(lx_error).
|
||||
lv_raised = abap_true.
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_reason
|
||||
act = lx_error->get_reason( ) ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_true( act = lv_raised
|
||||
msg = |No exception with reason { iv_reason }| ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD expect_no_error.
|
||||
DATA lv_raised TYPE abap_bool.
|
||||
TRY.
|
||||
mo_cut->validate( iv_issue_date = '20240101'
|
||||
iv_valid_days = 30
|
||||
iv_as_of_date = iv_as_of
|
||||
it_item = it_item ).
|
||||
CATCH {{p}}cx_presc_error.
|
||||
lv_raised = abap_true.
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_false( act = lv_raised ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_prescription.
|
||||
expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-empty
|
||||
it_item = VALUE {{p}}prescription_check=>tt_item( ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD expired_prescription.
|
||||
expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-expired
|
||||
it_item = valid_item( )
|
||||
iv_as_of = '20240201' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD valid_on_last_day.
|
||||
expect_no_error( it_item = valid_item( )
|
||||
iv_as_of = '20240131' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_drug.
|
||||
expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-unknown
|
||||
it_item = VALUE #( ( drug_id = 'XXXXXX' quantity = 5 daily_dose = 10 ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zero_quantity.
|
||||
expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-quantity
|
||||
it_item = VALUE #( ( drug_id = 'PARA500' quantity = 0 daily_dose = 1000 ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD zero_daily_dose.
|
||||
expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-dose
|
||||
it_item = VALUE #( ( drug_id = 'PARA500' quantity = 5 daily_dose = 0 ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dose_above_max.
|
||||
expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-dose
|
||||
it_item = VALUE #( ( drug_id = 'META50' quantity = 5 daily_dose = 250 ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD duplicate_drug.
|
||||
expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-duplicate
|
||||
it_item = VALUE #( ( drug_id = 'PARA500' quantity = 5 daily_dose = 1000 )
|
||||
( drug_id = 'PARA500' quantity = 5 daily_dose = 1000 ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD expired_before_quantity.
|
||||
expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-expired
|
||||
it_item = VALUE #( ( drug_id = 'PARA500' quantity = 0 daily_dose = 1000 ) )
|
||||
iv_as_of = '20240201' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD dose_before_duplicate.
|
||||
expect_reason( iv_reason = {{p}}cx_presc_error=>c_reason-dose
|
||||
it_item = VALUE #( ( drug_id = 'META50' quantity = 5 daily_dose = 250 )
|
||||
( drug_id = 'META50' quantity = 5 daily_dose = 100 ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD valid_prescription.
|
||||
expect_no_error( it_item = VALUE #( ( drug_id = 'PARA500' quantity = 20 daily_dose = 4000 )
|
||||
( drug_id = 'IBU400' quantity = 10 daily_dose = 1200 ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD message_texts.
|
||||
DATA lo_error TYPE REF TO {{p}}cx_presc_error.
|
||||
|
||||
lo_error = NEW #( iv_reason = {{p}}cx_presc_error=>c_reason-empty ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'The prescription has no items'
|
||||
act = lo_error->get_message_text( ) ).
|
||||
|
||||
lo_error = NEW #( iv_reason = {{p}}cx_presc_error=>c_reason-expired ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'The prescription is expired'
|
||||
act = lo_error->get_message_text( ) ).
|
||||
|
||||
lo_error = NEW #( iv_reason = {{p}}cx_presc_error=>c_reason-quantity ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'The quantity is not positive'
|
||||
act = lo_error->get_message_text( ) ).
|
||||
|
||||
lo_error = NEW #( iv_reason = {{p}}cx_presc_error=>c_reason-unknown ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'The drug is not in the drug master'
|
||||
act = lo_error->get_message_text( ) ).
|
||||
|
||||
lo_error = NEW #( iv_reason = {{p}}cx_presc_error=>c_reason-dose ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'The daily dose is not allowed'
|
||||
act = lo_error->get_message_text( ) ).
|
||||
|
||||
lo_error = NEW #( iv_reason = {{p}}cx_presc_error=>c_reason-duplicate ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'The drug appears more than once'
|
||||
act = lo_error->get_message_text( ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
157
tasks_gen/eval/G0130/hidden/t_prov_hidden.clas.abap
Normal file
157
tasks_gen/eval/G0130/hidden/t_prov_hidden.clas.abap
Normal file
@@ -0,0 +1,157 @@
|
||||
CLASS {{p}}t_prov_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}provision_calc.
|
||||
|
||||
METHODS setup.
|
||||
METHODS empty_order_raises FOR TESTING.
|
||||
METHODS too_many_lines_raises FOR TESTING.
|
||||
METHODS material_missing_raises FOR TESTING.
|
||||
METHODS quantity_invalid_raises FOR TESTING.
|
||||
METHODS price_negative_raises FOR TESTING.
|
||||
METHODS duplicate_material_raises FOR TESTING.
|
||||
METHODS limit_exceeded_raises FOR TESTING.
|
||||
METHODS limit_boundary_is_ok FOR TESTING.
|
||||
METHODS valid_order_is_ok FOR TESTING.
|
||||
METHODS value_is_sum FOR TESTING.
|
||||
METHODS value_rounds_total FOR TESTING.
|
||||
METHODS invalid_order_propagates FOR TESTING.
|
||||
|
||||
METHODS expect_reason
|
||||
IMPORTING it_lines TYPE {{p}}provision_calc=>tt_lines
|
||||
iv_reason TYPE {{p}}provision_calc=>ty_reason.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t_prov_hidden IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}provision_calc( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD expect_reason.
|
||||
TRY.
|
||||
mo_cut->check_order( it_lines ).
|
||||
cl_abap_unit_assert=>fail( msg = |Expected reason { iv_reason }| ).
|
||||
CATCH {{p}}cx_prov_error INTO DATA(lx_error).
|
||||
cl_abap_unit_assert=>assert_equals( exp = iv_reason act = lx_error->reason ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD empty_order_raises.
|
||||
DATA lt_lines TYPE {{p}}provision_calc=>tt_lines.
|
||||
expect_reason( it_lines = lt_lines
|
||||
iv_reason = {{p}}provision_calc=>c_empty_order ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD too_many_lines_raises.
|
||||
DATA lt_lines TYPE {{p}}provision_calc=>tt_lines.
|
||||
DATA ls_line TYPE {{p}}provision_calc=>ty_line.
|
||||
DO 1000 TIMES.
|
||||
ls_line = VALUE #( material = |M{ sy-index }| quantity = 1 price = 1 ).
|
||||
INSERT ls_line INTO TABLE lt_lines.
|
||||
ENDDO.
|
||||
expect_reason( it_lines = lt_lines
|
||||
iv_reason = {{p}}provision_calc=>c_too_many_lines ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD material_missing_raises.
|
||||
DATA lt_lines TYPE {{p}}provision_calc=>tt_lines.
|
||||
lt_lines = VALUE #( ( material = ` ` quantity = 1 price = 1 ) ).
|
||||
expect_reason( it_lines = lt_lines
|
||||
iv_reason = {{p}}provision_calc=>c_material_missing ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD quantity_invalid_raises.
|
||||
DATA lt_lines TYPE {{p}}provision_calc=>tt_lines.
|
||||
lt_lines = VALUE #( ( material = 'ROPE' quantity = 0 price = 1 ) ).
|
||||
expect_reason( it_lines = lt_lines
|
||||
iv_reason = {{p}}provision_calc=>c_quantity_invalid ).
|
||||
|
||||
lt_lines = VALUE #( ( material = 'ROPE' quantity = -1 price = 1 ) ).
|
||||
expect_reason( it_lines = lt_lines
|
||||
iv_reason = {{p}}provision_calc=>c_quantity_invalid ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD price_negative_raises.
|
||||
DATA lt_lines TYPE {{p}}provision_calc=>tt_lines.
|
||||
lt_lines = VALUE #( ( material = 'ROPE' quantity = 1 price = -1 ) ).
|
||||
expect_reason( it_lines = lt_lines
|
||||
iv_reason = {{p}}provision_calc=>c_price_negative ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD duplicate_material_raises.
|
||||
DATA lt_lines TYPE {{p}}provision_calc=>tt_lines.
|
||||
lt_lines = VALUE #( ( material = 'ROPE' quantity = 1 price = 1 )
|
||||
( material = 'ROPE' quantity = 2 price = 1 ) ).
|
||||
expect_reason( it_lines = lt_lines
|
||||
iv_reason = {{p}}provision_calc=>c_duplicate_material ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD limit_exceeded_raises.
|
||||
DATA lt_lines TYPE {{p}}provision_calc=>tt_lines.
|
||||
lt_lines = VALUE #( ( material = 'ENGINE' quantity = 1 price = '100000.01' ) ).
|
||||
expect_reason( it_lines = lt_lines
|
||||
iv_reason = {{p}}provision_calc=>c_limit_exceeded ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD limit_boundary_is_ok.
|
||||
DATA lt_lines TYPE {{p}}provision_calc=>tt_lines.
|
||||
lt_lines = VALUE #( ( material = 'ENGINE' quantity = 1 price = '100000.00' ) ).
|
||||
TRY.
|
||||
mo_cut->check_order( lt_lines ).
|
||||
CATCH {{p}}cx_prov_error INTO DATA(lx_error).
|
||||
cl_abap_unit_assert=>fail( msg = |Unexpected reason { lx_error->reason }| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD valid_order_is_ok.
|
||||
DATA lt_lines TYPE {{p}}provision_calc=>tt_lines.
|
||||
lt_lines = VALUE #( ( material = 'ROPE' quantity = 2 price = '3.50' )
|
||||
( material = 'BOLT' quantity = 3 price = '1.25' ) ).
|
||||
TRY.
|
||||
mo_cut->check_order( lt_lines ).
|
||||
CATCH {{p}}cx_prov_error INTO DATA(lx_error).
|
||||
cl_abap_unit_assert=>fail( msg = |Unexpected reason { lx_error->reason }| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD value_is_sum.
|
||||
DATA lt_lines TYPE {{p}}provision_calc=>tt_lines.
|
||||
lt_lines = VALUE #( ( material = 'ROPE' quantity = 2 price = '3.50' )
|
||||
( material = 'BOLT' quantity = 3 price = '1.25' ) ).
|
||||
DATA lv_expected TYPE {{p}}provision_calc=>ty_amount VALUE '10.75'.
|
||||
DATA lv_value TYPE {{p}}provision_calc=>ty_amount.
|
||||
TRY.
|
||||
lv_value = mo_cut->calculate_value( lt_lines ).
|
||||
CATCH {{p}}cx_prov_error INTO DATA(lx_error).
|
||||
cl_abap_unit_assert=>fail( msg = |Unexpected reason { lx_error->reason }| ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_value ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD value_rounds_total.
|
||||
DATA lt_lines TYPE {{p}}provision_calc=>tt_lines.
|
||||
lt_lines = VALUE #( ( material = 'ROPE' quantity = '1.005' price = '1.00' )
|
||||
( material = 'BOLT' quantity = '1.005' price = '1.00' ) ).
|
||||
DATA lv_expected TYPE {{p}}provision_calc=>ty_amount VALUE '2.01'.
|
||||
DATA lv_value TYPE {{p}}provision_calc=>ty_amount.
|
||||
TRY.
|
||||
lv_value = mo_cut->calculate_value( lt_lines ).
|
||||
CATCH {{p}}cx_prov_error INTO DATA(lx_error).
|
||||
cl_abap_unit_assert=>fail( msg = |Unexpected reason { lx_error->reason }| ).
|
||||
ENDTRY.
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lv_value ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD invalid_order_propagates.
|
||||
DATA lt_lines TYPE {{p}}provision_calc=>tt_lines.
|
||||
lt_lines = VALUE #( ( material = '' quantity = 1 price = 1 ) ).
|
||||
TRY.
|
||||
mo_cut->calculate_value( lt_lines ).
|
||||
cl_abap_unit_assert=>fail( msg = 'Expected reason MATERIAL_MISSING' ).
|
||||
CATCH {{p}}cx_prov_error INTO DATA(lx_error).
|
||||
cl_abap_unit_assert=>assert_equals( exp = {{p}}provision_calc=>c_material_missing
|
||||
act = lx_error->reason ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user