Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Why Assertion-Class CL_ABAP_UNIT_ASSERT is final?

majcon
SAP Champion
SAP Champion
0 Likes
828

Hi NG,

with Release NetWeaver 7.0 EhP2 SAP introduced the ABAP Unit Assertion-Class CL_ABAP_UNIT_ASSERT.

Compared with the old Assertion-Class (CL_AUNIT_ASSERT), the new class is declared as FINAL.

What is the reason behind this change?

It was really comfortable to inherit the CL_AUNIT_ASSERT class in my Test-Classes and to use the shorter-Form of the Assertion-Methods.

Any Idea, why the class is now closed for Inheritation?

Best regards,

Damir

3 REPLIES 3
Read only

wol
Active Participant
0 Likes
672

For me, it seems as if CL_ABAP_UNIT_ASSERT is a duplicate of CL_AUNIT_ASSERT (which exists longer). Why did SAP do that??

I have checked the documentation:

Until 7.01 only CL_AUNIT_ASSERT is mentioned. As of 7.02 the documentation tells you to use CL_ABAP_UNIT_ASSERT, however the documentation for "Local testclasses" seems to be forgotten (at least in german docu).

So thank you for that question. Does somebody know if CL_AUNIT_ASSERT is obsolete?

Btw: On Solution Manager 7.1 (which is based on Netweaver 7.02) both classes exist and none of them is final...

Read only

majcon
SAP Champion
SAP Champion
0 Likes
672

Hi Stefan,

the class cl_aunit_assert should not longer be used. Instead use the class cl_abap_unit_assert (offical SAP suggestion).

By the way, if you look into the class cl_aunit_assert there is a forwarding to the class cl_abap_unit_assert.

Best regards,

Damir

Read only

wol
Active Participant
0 Likes
672

Thank you for that information!

The only thing that is a pity for me is that code using the old class should be rafactored...