Skip to content

isEqualToIgnoringGivenProperties does not check private fields #548

@ajax-maltsev-k

Description

@ajax-maltsev-k
data class Obj(val publicStr: String, private val privateStr: String)

@Test
fun t() {
    val obj1 = Obj("public", "private1")
    val obj2 = Obj("public", "private2")

    assertThat(obj1).isEqualToIgnoringGivenProperties(obj2, MyClass::publicStr)
}

This test results in successful assertion, despite that private fields values is different.

assertkVer: 0.28.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions