We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!
The addition PARTIALLY IMPLEMENTED for statement INTERFACES for implementing interfaces in classes can only be used in test classes. This addition prevents the syntax check error/warning from occurring if not all concrete non-optional interface methods are implemented in the test class. The addition must be specified before the additions that list the attributes or methods.
If an interface method that is not implemented is called during a test, an exception from the class CX_SY_DYN_CALL_ILLEGAL_METHOD is raised.
The addition is particularly useful when classes that are used as test doubles implement interfaces and not all the methods of these implements are called by the code to be tested. Without this addition, it would be necessary to implement all unnecessary methods without values and assign them the needed pragma. This is because implementing methods without values produces a warning from the extended program check.
The class CL_HTTP_EXT_SERVICE_DEMO, described under Calling an HTTP Service, is an example of production code. This class demonstrates the function of a simple HTTP service. If the service is used normally, the method IF_HTTP_EXTENSION~HANDLE_REQUEST from ICF is called. ICF-independent tests can be run for the class: In its test include, local classes are declared as test doubles for the classes of ICF that implement the following interfaces:
Only the interface methods required to execute tests are implemented. The interfaces have numerous other methods. These methods must not be implemented when empty due to the addition PARTIALLY IMPLEMENTED.
The actual test class looks as follows:
In the test method, ICF is simulated by directly creating objects of the test doubles. The REQUEST test double simulates the form field. The RESPONSE test double contains the result that is checked after the method HANDLER is called for testing.