‎2012 May 02 11:45 AM
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
‎2013 Sep 30 6:56 PM
Hello Damir,
as you wrote it is popular to inherite from cl_Aunit_Assert to save typing. That made cl_Aunit_Assert to the class with the most child classes in the ABAP word. With that many child classes it is impossible to add a new method to cl_Aunit_Assert without the risk to break a child class. Therefore a new classes with new methods and no possibility to inherit has been introduced. Extensibility is the major reason..
Best Regards
Klaus
‎2013 Sep 30 6:56 PM
Hello Damir,
as you wrote it is popular to inherite from cl_Aunit_Assert to save typing. That made cl_Aunit_Assert to the class with the most child classes in the ABAP word. With that many child classes it is impossible to add a new method to cl_Aunit_Assert without the risk to break a child class. Therefore a new classes with new methods and no possibility to inherit has been introduced. Extensibility is the major reason..
Best Regards
Klaus
‎2013 Oct 03 5:57 PM
Hi Klaus,
thanks for the answer.
In Perspective of Customers or Tool-Developer it`s harder to extend or use the Framework.
But, It is important to think about clean-code and clean-architecture so avoiding such God-Classes in an System seems to be a good decision...
Best Regards,
Damir