Skip to content

Long isEqualTo Int with equal value fails assertion #563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
NavorJames opened this issue Jan 31, 2025 · 0 comments
Open

Long isEqualTo Int with equal value fails assertion #563

NavorJames opened this issue Jan 31, 2025 · 0 comments

Comments

@NavorJames
Copy link

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)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant