Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enum comparison with String is not working with recursive assertion #2616

@vimalbera92

Description

@vimalbera92

Summary

Comparison of enum with string fails with recursive assertion and strictTypeChecking as false. I would expect below code to be run successfully.

actual and expected objects and their fields were compared field by field recursively even if they were not of the same type - as per error, actual and expected values are same (CAR in below example) and test case should pass.

Example

public class TestEnumWithString {

    @Test
    public void testEnumWithString() {
        assertThat(Vehicle.CAR).usingRecursiveComparison().isEqualTo("CAR");
    }
}

enum Vehicle {
    CAR
}

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions