Skip to Content
4
Sep 12, 2017 at 08:02 PM

Testing private methods: Declaring a local test friend

6072 Views

I try to test the private methods of a class and therefor I declare a local test friend following this scheme:

class lcl_test definition deferred.
class zcl_testee definition local friends lcl_test.
...
class lcl_test definition for testing ...
...

This is been discussed in this wiki article or in this blog entry.

But all I get is the syntax error "The statement CLASS is unexpected".

What is wrong here?

My complete code:

CLASS lcl_test DEFINITION DEFERRED.
CLASS zcl_testee DEFINITION
 PUBLIC FINAL CREATE PUBLIC .
  PUBLIC SECTION.
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.

CLASS zcl_testee IMPLEMENTATION.
ENDCLASS.

CLASS lcl_test DEFINITION.
ENDCLASS.

CLASS lcl_test IMPLEMENTATION.
ENDCLASS.