https://kotlinlang.org logo
#announcements
Title
# announcements
s

Sergio Pro

08/05/2019, 7:46 AM
Could anyone explain why this works
Copy code
val longs = List(100) { random.nextLong(6868L) }
assertThat(longs.all { it < 6869L }).isTrue()
But when I use property access syntax for
isTrue
it throws
Cannot infer type parameter SELF in val <SELF : AbstractBooleanAssert<SELF!>!> AbstractBooleanAssert<SELF>.isTrue: SELF!
Copy code
val longs = List(100) { random.nextLong(6868L) }
assertThat(longs.all { it < 6869L }).isTrue
I'm using assertJ. Just wondering if this is kotlin or assertj issue.
w

wbertan

08/05/2019, 8:33 AM
🤔
Copy code
class AssertJTest {
    @Test
    fun asas1() {
        val longs = List(100) { Random.nextLong(6868L) }
        Assertions.assertThat(longs.all { it < 6869L }).isTrue()
    }

    @Test
    fun asas2() {
        val longs = List(100) { Random.nextLong(6868L) }
        Assertions.assertThat(longs.all { it < 6869L }).isTrue
    }
}
Could be an issue? When I'm looking into the bytecode, both will generate the same.
2 Views