Skip to content

Long isEqualTo Int with equal value fails assertion #563

@NavorJames

Description

@NavorJames

I just swapped Google Truth with AssertK and found that equal assertion fails for Long/? and Int. Using equality operator in Kotlin also returns the error Operator '==' cannot be applied to 'Long?' and 'Int'. However, this succeeds with Google Truth and I think it's reasonable since they have equal values.

@Test
fun nullableLongToIntEqualityCheckIsTrue(){
    val actual: Long? = 2 + 2
    val expected: Int = 4
    assertThat(actual).isEqualTo(expected)
}

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