Skip to content

Commit 7f09f5d

Browse files
authored
Merge pull request #32 from SchwarzIT/31-replace-cl_aunit_assert-with-cl_abap_unit_assert
Issue #31 - Replace CL_AUNIT_ASSERT
2 parents 6fe9cac + 67c0b45 commit 7f09f5d

File tree

35 files changed

+672
-1119
lines changed

35 files changed

+672
-1119
lines changed

src/#usi#bal_cust_dao/#usi#cl_bal_cd_data_containers.clas.testclasses.abap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ CLASS lcl_unit_tests IMPLEMENTATION.
1616
METHOD test_throws_on_no_cust.
1717
TRY.
1818
cut->get_records( i_log_object_range = exclude_all_log_objects_range ).
19-
cl_aunit_assert=>fail( `Should throw exception on no data!` ).
19+
cl_abap_unit_assert=>fail( `Should throw exception on no data!` ).
2020
CATCH /usi/cx_bal_root.
2121
RETURN.
2222
ENDTRY.
Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,27 @@
11
*"* use this source file for your ABAP unit test classes
2-
CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING.
3-
"#AU Duration Short
4-
"#AU Risk_Level Harmless
2+
CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
53
PRIVATE SECTION.
6-
74
METHODS setup.
85
METHODS verify_throws_on_no_cust FOR TESTING.
96

107
DATA cut TYPE REF TO /usi/if_bal_cd_log_lv_by_clnt.
11-
DATA exclude_all_log_objects_range TYPE /usi/bal_log_object_range.
128

139
ENDCLASS.
1410

11+
1512
CLASS lcl_unit_tests IMPLEMENTATION.
1613
METHOD verify_throws_on_no_cust.
1714
TRY.
18-
cut->get_records( i_log_object_range = exclude_all_log_objects_range ).
19-
cl_aunit_assert=>fail( `Should throw exception on no data!` ).
15+
cut->get_records( i_log_object_range = VALUE #( ( sign = 'E'
16+
option = 'CP'
17+
low = '*' ) ) ).
18+
cl_abap_unit_assert=>fail( `Should throw exception on no data!` ).
2019
CATCH /usi/cx_bal_root.
2120
RETURN.
2221
ENDTRY.
2322
ENDMETHOD.
2423

2524
METHOD setup.
26-
DATA range_line TYPE /usi/bal_log_object_range_line.
27-
2825
cut = NEW /usi/cl_bal_cd_log_lv_by_clnt( ).
29-
30-
range_line-sign = 'E'.
31-
range_line-option = 'CP'.
32-
range_line-low = '*'.
33-
INSERT range_line INTO TABLE exclude_all_log_objects_range.
3426
ENDMETHOD.
3527
ENDCLASS.
Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,27 @@
11
*"* use this source file for your ABAP unit test classes
2-
CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING.
3-
"#AU Duration Short
4-
"#AU Risk_Level Harmless
2+
CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
53
PRIVATE SECTION.
6-
74
METHODS setup.
85
METHODS verify_throws_on_no_cust FOR TESTING.
96

107
DATA cut TYPE REF TO /usi/if_bal_cd_log_lv_by_obj.
11-
DATA exclude_all_log_objects_range TYPE /usi/bal_log_object_range.
128

139
ENDCLASS.
1410

15-
CLASS lcl_unit_tests IMPLEMENTATION.
1611

12+
CLASS lcl_unit_tests IMPLEMENTATION.
1713
METHOD verify_throws_on_no_cust.
1814
TRY.
19-
cut->get_records( i_log_object_range = exclude_all_log_objects_range ).
20-
cl_aunit_assert=>fail( `Should throw exception on no data!` ).
15+
cut->get_records( i_log_object_range = VALUE #( ( sign = 'E'
16+
option = 'CP'
17+
low = '*' ) ) ).
18+
cl_abap_unit_assert=>fail( `Should throw exception on no data!` ).
2119
CATCH /usi/cx_bal_root.
2220
RETURN.
2321
ENDTRY.
2422
ENDMETHOD.
2523

2624
METHOD setup.
27-
DATA range_line TYPE /usi/bal_log_object_range_line.
28-
2925
cut = NEW /usi/cl_bal_cd_log_lv_by_obj( ).
30-
31-
range_line-sign = 'E'.
32-
range_line-option = 'CP'.
33-
range_line-low = '*'.
34-
INSERT range_line INTO TABLE exclude_all_log_objects_range.
3526
ENDMETHOD.
36-
3727
ENDCLASS.
Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,28 @@
11
*"* use this source file for your ABAP unit test classes
2-
CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING.
3-
"#AU Duration Short
4-
"#AU Risk_Level Harmless
2+
CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
53
PRIVATE SECTION.
6-
74
METHODS setup.
85
METHODS verify_throws_on_no_cust FOR TESTING.
96

107
DATA cut TYPE REF TO /usi/if_bal_cd_log_lv_by_user.
11-
DATA exclude_all_log_objects_range TYPE /usi/bal_log_object_range.
128

139
ENDCLASS.
1410

15-
CLASS lcl_unit_tests IMPLEMENTATION.
1611

12+
CLASS lcl_unit_tests IMPLEMENTATION.
1713
METHOD verify_throws_on_no_cust.
1814
TRY.
1915
cut->get_records( i_user_name = sy-uname
20-
i_log_object_range = exclude_all_log_objects_range ).
21-
cl_aunit_assert=>fail( `Should throw exception on no data!` ).
16+
i_log_object_range = VALUE #( ( sign = 'E'
17+
option = 'CP'
18+
low = '*' ) ) ).
19+
cl_abap_unit_assert=>fail( `Should throw exception on no data!` ).
2220
CATCH /usi/cx_bal_root.
2321
RETURN.
2422
ENDTRY.
2523
ENDMETHOD.
2624

2725
METHOD setup.
28-
DATA range_line TYPE /usi/bal_log_object_range_line.
29-
3026
cut = NEW /usi/cl_bal_cd_log_lv_by_user( ).
31-
32-
range_line-sign = 'E'.
33-
range_line-option = 'CP'.
34-
range_line-low = '*'.
35-
INSERT range_line INTO TABLE exclude_all_log_objects_range.
3627
ENDMETHOD.
37-
3828
ENDCLASS.
Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,28 @@
11
*"* use this source file for your ABAP unit test classes
2-
CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING.
3-
"#AU Duration Short
4-
"#AU Risk_Level Harmless
2+
CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
53
PRIVATE SECTION.
6-
74
METHODS setup.
85
METHODS verify_throws_on_no_cust FOR TESTING.
96

107
DATA cut TYPE REF TO /usi/if_bal_cd_retention.
11-
DATA exclude_all_log_objects_range TYPE /usi/bal_log_object_range.
128

139
ENDCLASS.
1410

15-
CLASS lcl_unit_tests IMPLEMENTATION.
1611

12+
CLASS lcl_unit_tests IMPLEMENTATION.
1713
METHOD verify_throws_on_no_cust.
1814
TRY.
19-
cut->get_records( i_log_object_range = exclude_all_log_objects_range
15+
cut->get_records( i_log_object_range = VALUE #( ( sign = 'E'
16+
option = 'CP'
17+
low = '*' ) )
2018
i_log_level = /usi/cl_bal_enum_log_level=>everything->value ).
21-
cl_aunit_assert=>fail( `Should throw exception on no data!` ).
19+
cl_abap_unit_assert=>fail( `Should throw exception on no data!` ).
2220
CATCH /usi/cx_bal_root.
2321
RETURN.
2422
ENDTRY.
2523
ENDMETHOD.
2624

2725
METHOD setup.
28-
DATA range_line TYPE /usi/bal_log_object_range_line.
29-
3026
cut = NEW /usi/cl_bal_cd_retention( ).
31-
32-
range_line-sign = 'E'.
33-
range_line-option = 'CP'.
34-
range_line-low = '*'.
35-
INSERT range_line INTO TABLE exclude_all_log_objects_range.
3627
ENDMETHOD.
37-
3828
ENDCLASS.
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
*"* use this source file for your ABAP unit test classes
2-
CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING.
3-
"#AU Duration Short
4-
"#AU Risk_Level Harmless
2+
CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
53
PRIVATE SECTION.
6-
74
DATA cut TYPE REF TO /usi/cl_bal_cust_dao_factory.
85

96
METHODS setup.
@@ -16,33 +13,34 @@ CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING.
1613

1714
ENDCLASS.
1815

16+
1917
CLASS lcl_unit_tests IMPLEMENTATION.
2018
METHOD setup.
2119
cut = NEW #( ).
2220
ENDMETHOD.
2321

2422
METHOD test_exception_mapper_dao.
2523
DATA(actual_result) = cut->/usi/if_bal_cust_dao_factory~get_exception_mapper( ).
26-
cl_aunit_assert=>assert_bound( actual_result ).
24+
cl_abap_unit_assert=>assert_bound( actual_result ).
2725
ENDMETHOD.
2826

2927
METHOD test_regular_log_level_dao.
3028
DATA(actual_result) = cut->/usi/if_bal_cust_dao_factory~get_log_level_by_log_object( ).
31-
cl_aunit_assert=>assert_bound( actual_result ).
29+
cl_abap_unit_assert=>assert_bound( actual_result ).
3230
ENDMETHOD.
3331

3432
METHOD test_increased_log_level_dao.
3533
DATA(actual_result) = cut->/usi/if_bal_cust_dao_factory~get_log_level_by_user( ).
36-
cl_aunit_assert=>assert_bound( actual_result ).
34+
cl_abap_unit_assert=>assert_bound( actual_result ).
3735
ENDMETHOD.
3836

3937
METHOD test_message_context_data_dao.
4038
DATA(actual_result) = cut->/usi/if_bal_cust_dao_factory~get_data_containers( ).
41-
cl_aunit_assert=>assert_bound( actual_result ).
39+
cl_abap_unit_assert=>assert_bound( actual_result ).
4240
ENDMETHOD.
4341

4442
METHOD test_retention_parameter_dao.
4543
DATA(actual_result) = cut->/usi/if_bal_cust_dao_factory~get_retention_parameters( ).
46-
cl_aunit_assert=>assert_bound( actual_result ).
44+
cl_abap_unit_assert=>assert_bound( actual_result ).
4745
ENDMETHOD.
4846
ENDCLASS.

src/#usi#bal_cust_evaluation/#usi#cl_bal_ce_cx_mapper.clas.testclasses.abap

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
*"* use this source file for your ABAP unit test classes
22

3-
*--------------------------------------------------------------------*
4-
* Test-Double for DAO (To inject customizing)
5-
*--------------------------------------------------------------------*
3+
" ---------------------------------------------------------------------
4+
" Test-Double for DAO (To inject customizing)
5+
" ---------------------------------------------------------------------
66
CLASS lcl_test_double_cust_dao DEFINITION FOR TESTING.
77
PUBLIC SECTION.
88
INTERFACES /usi/if_bal_cd_cx_mapper.
@@ -15,13 +15,13 @@ CLASS lcl_test_double_cust_dao DEFINITION FOR TESTING.
1515
DATA mock_data TYPE /usi/if_bal_cd_cx_mapper=>ty_records.
1616
ENDCLASS.
1717

18+
1819
CLASS lcl_test_double_cust_dao IMPLEMENTATION.
1920
METHOD /usi/if_bal_cd_cx_mapper~get_records.
2021
r_result = mock_data.
2122
IF r_result IS INITIAL.
2223
RAISE EXCEPTION TYPE /usi/cx_bal_not_found
23-
EXPORTING
24-
textid = /usi/cx_bal_not_found=>no_db_entries_found.
24+
EXPORTING textid = /usi/cx_bal_not_found=>no_db_entries_found.
2525
ENDIF.
2626
ENDMETHOD.
2727

@@ -30,12 +30,11 @@ CLASS lcl_test_double_cust_dao IMPLEMENTATION.
3030
ENDMETHOD.
3131
ENDCLASS.
3232

33-
*--------------------------------------------------------------------*
34-
* Unit test
35-
*--------------------------------------------------------------------*
36-
CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING.
37-
"#AU Risk_Level Harmless
38-
"#AU Duration Short
33+
34+
" ---------------------------------------------------------------------
35+
" Unit test
36+
" ---------------------------------------------------------------------
37+
CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
3938
PRIVATE SECTION.
4039
TYPES:
4140
BEGIN OF ty_request,
@@ -48,15 +47,15 @@ CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING.
4847
cut TYPE REF TO /usi/if_bal_ce_cx_mapper.
4948

5049
METHODS setup.
51-
METHODS test_ignore_invalid_mappers FOR TESTING.
52-
METHODS test_match_class FOR TESTING.
53-
METHODS test_match_new_interface FOR TESTING.
54-
METHODS test_match_superclass FOR TESTING.
55-
METHODS test_validate_fallback FOR TESTING.
50+
METHODS test_ignore_invalid_mappers FOR TESTING.
51+
METHODS test_match_class FOR TESTING.
52+
METHODS test_match_new_interface FOR TESTING.
53+
METHODS test_match_superclass FOR TESTING.
54+
METHODS test_validate_fallback FOR TESTING.
5655

5756
METHODS reset_cut
5857
IMPORTING
59-
i_quit TYPE aunit_flowctrl DEFAULT cl_aunit_assert=>method.
58+
i_quit TYPE aunit_flowctrl DEFAULT if_aunit_constants=>method.
6059

6160
METHODS assert_expected_result
6261
IMPORTING
@@ -65,10 +64,11 @@ CLASS lcl_unit_tests DEFINITION FINAL FOR TESTING.
6564
i_expected_result TYPE /usi/bal_exception_mapper.
6665
ENDCLASS.
6766

67+
6868
CLASS lcl_unit_tests IMPLEMENTATION.
6969
METHOD setup.
7070
test_double_cust_dao = NEW #( ).
71-
reset_cut( cl_aunit_assert=>class ).
71+
reset_cut( if_aunit_constants=>class ).
7272
ENDMETHOD.
7373

7474
METHOD reset_cut.
@@ -179,8 +179,8 @@ CLASS lcl_unit_tests IMPLEMENTATION.
179179
/usi/cl_bal_aunit_exception=>fail_on_unexpected_exception( unexpected_exception ).
180180
ENDTRY.
181181

182-
cl_aunit_assert=>assert_equals( act = mapper_class_name
183-
exp = i_expected_result ).
182+
cl_abap_unit_assert=>assert_equals( exp = i_expected_result
183+
act = mapper_class_name ).
184184
ENDMETHOD.
185185

186186
METHOD test_validate_fallback.
@@ -200,7 +200,7 @@ CLASS lcl_unit_tests IMPLEMENTATION.
200200

201201
IF object_description->is_implementing( mapper_interface_name ) <> abap_true
202202
OR object_description->is_instantiatable( ) <> abap_true.
203-
cl_aunit_assert=>fail( 'Invalid fallback for mapper class!' ).
203+
cl_abap_unit_assert=>fail( 'Invalid fallback for mapper class!' ).
204204
ENDIF.
205205
ENDMETHOD.
206206
ENDCLASS.

0 commit comments

Comments
 (0)