Step F first pass: 81/92 accepted; budget floor 60 calls; rejected slots moved for regeneration
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
177
tasks_gen/eval/G0132/hidden/t02_hidden.clas.abap
Normal file
177
tasks_gen/eval/G0132/hidden/t02_hidden.clas.abap
Normal file
@@ -0,0 +1,177 @@
|
||||
CLASS {{p}}t02_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS c_deadline TYPE d VALUE '20240331'.
|
||||
DATA mo_cut TYPE REF TO {{p}}exam_check.
|
||||
METHODS setup.
|
||||
METHODS ok_request
|
||||
RETURNING VALUE(rs_request) TYPE {{p}}if_exam_request=>ty_request.
|
||||
METHODS allowed_when_all_ok FOR TESTING.
|
||||
METHODS rejects_not_enrolled FOR TESTING.
|
||||
METHODS rejects_prereq_missing FOR TESTING.
|
||||
METHODS rejects_no_attempt_left FOR TESTING.
|
||||
METHODS rejects_deadline_passed FOR TESTING.
|
||||
METHODS last_attempt_allowed FOR TESTING.
|
||||
METHODS reg_on_deadline_allowed FOR TESTING.
|
||||
METHODS first_rule_wins FOR TESTING.
|
||||
METHODS attempts_before_deadline FOR TESTING.
|
||||
METHODS base_class_catches_all FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}t02_hidden IMPLEMENTATION.
|
||||
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}exam_check( iv_max_attempts = 3
|
||||
iv_deadline = c_deadline ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD ok_request.
|
||||
rs_request = VALUE #( student_id = 'S4711'
|
||||
enrolled = abap_true
|
||||
prereq_passed = abap_true
|
||||
prereq_id = 'P100'
|
||||
attempts = 0
|
||||
reg_date = CONV d( '20240115' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD allowed_when_all_ok.
|
||||
TRY.
|
||||
mo_cut->check( ok_request( ) ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |The registration must be allowed| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_not_enrolled.
|
||||
DATA(ls_request) = ok_request( ).
|
||||
ls_request-enrolled = abap_false.
|
||||
TRY.
|
||||
mo_cut->check( ls_request ).
|
||||
cl_abap_unit_assert=>fail( |Exception expected| ).
|
||||
CATCH {{p}}cx_not_enrolled INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'S4711'
|
||||
act = lo_error->mv_student_id ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'The student is not enrolled.'
|
||||
act = lo_error->mv_text ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |Wrong exception type| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_prereq_missing.
|
||||
DATA(ls_request) = ok_request( ).
|
||||
ls_request-prereq_passed = abap_false.
|
||||
TRY.
|
||||
mo_cut->check( ls_request ).
|
||||
cl_abap_unit_assert=>fail( |Exception expected| ).
|
||||
CATCH {{p}}cx_prereq_missing INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'P100'
|
||||
act = lo_error->mv_prereq ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'The prerequisite exam is not passed.'
|
||||
act = lo_error->mv_text ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |Wrong exception type| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_no_attempt_left.
|
||||
DATA(ls_request) = ok_request( ).
|
||||
ls_request-attempts = 3.
|
||||
TRY.
|
||||
mo_cut->check( ls_request ).
|
||||
cl_abap_unit_assert=>fail( |Exception expected| ).
|
||||
CATCH {{p}}cx_no_attempt_left INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3
|
||||
act = lo_error->mv_attempts ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'No attempt is left.'
|
||||
act = lo_error->mv_text ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |Wrong exception type| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD rejects_deadline_passed.
|
||||
DATA(ls_request) = ok_request( ).
|
||||
ls_request-reg_date = CONV d( '20240401' ).
|
||||
TRY.
|
||||
mo_cut->check( ls_request ).
|
||||
cl_abap_unit_assert=>fail( |Exception expected| ).
|
||||
CATCH {{p}}cx_deadline_passed INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals( exp = CONV d( '20240401' )
|
||||
act = lo_error->mv_reg_date ).
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = 'The registration deadline has passed.'
|
||||
act = lo_error->mv_text ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |Wrong exception type| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD last_attempt_allowed.
|
||||
DATA(ls_request) = ok_request( ).
|
||||
ls_request-attempts = 2.
|
||||
TRY.
|
||||
mo_cut->check( ls_request ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |The last free attempt must be allowed| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reg_on_deadline_allowed.
|
||||
DATA(ls_request) = ok_request( ).
|
||||
ls_request-reg_date = c_deadline.
|
||||
TRY.
|
||||
mo_cut->check( ls_request ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |The deadline day must be allowed| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD first_rule_wins.
|
||||
DATA(ls_request) = ok_request( ).
|
||||
ls_request-enrolled = abap_false.
|
||||
ls_request-prereq_passed = abap_false.
|
||||
ls_request-attempts = 9.
|
||||
ls_request-reg_date = CONV d( '20241231' ).
|
||||
TRY.
|
||||
mo_cut->check( ls_request ).
|
||||
cl_abap_unit_assert=>fail( |Exception expected| ).
|
||||
CATCH {{p}}cx_not_enrolled INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'S4711'
|
||||
act = lo_error->mv_student_id ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |Wrong exception type| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD attempts_before_deadline.
|
||||
DATA(ls_request) = ok_request( ).
|
||||
ls_request-attempts = 3.
|
||||
ls_request-reg_date = CONV d( '20241231' ).
|
||||
TRY.
|
||||
mo_cut->check( ls_request ).
|
||||
cl_abap_unit_assert=>fail( |Exception expected| ).
|
||||
CATCH {{p}}cx_no_attempt_left INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 3
|
||||
act = lo_error->mv_attempts ).
|
||||
CATCH {{p}}cx_exam_error.
|
||||
cl_abap_unit_assert=>fail( |Wrong exception type| ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD base_class_catches_all.
|
||||
DATA(ls_request) = ok_request( ).
|
||||
ls_request-prereq_passed = abap_false.
|
||||
TRY.
|
||||
mo_cut->check( ls_request ).
|
||||
cl_abap_unit_assert=>fail( |Exception expected| ).
|
||||
CATCH {{p}}cx_exam_error INTO DATA(lo_error).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'S4711'
|
||||
act = lo_error->mv_student_id ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user