Skip to content

Unit tests do not pass in the copied class. #1

@netsrak-dev

Description

@netsrak-dev

Description / Steps to Reproduce

I have copied the class 'ZCL_AW_PART_VALUE' to 'ZCL_AW_PART_VALUE_USERID'.
I modified the method 'VALUE_FILL_STRUCTURE' (to make a test method fail):

METHOD ZIF_AW_PART_VALUE~VALUE_FILL_STRUCTURE.
  DATA: lv_country LIKE i_country.

  IF i_country = 'US'.
    lv_country = 'DE'.
  ELSE.
    lv_country = i_country.
  ENDIF.

  r_result = VALUE #(
    name      = i_name
    street    = i_street
    post_code = i_post_code
    city      = i_city
    country   = lv_country ).

ENDMETHOD.

In the local test class, the following is assigned:

DATA cut TYPE REF TO ZCL_AW_PART_VALUE_USERID.

Then, the unit test is executed in the class 'ZCL_AW_PART_VALUE_USERID'.

Expected Behavior

The test 'STRUCTURE' should trigger a Critical Assertion Error: 'Structure: ASSERT_EQUALS'.

Actual Behavior

All tests pass.

Assumption

I suspect the problem lies here: link to the problematic code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions