How to compile Kotlin unit test code that uses hamcrest 'is'
问题 I want to write a unit test for my Kotlin code and use junit/hamcrest matchers, I want to use the is method, but it is a reserved word in Kotlin. How can I get the following to compile? class testExample{ @Test fun example(){ assertThat(1, is(equalTo(1)) } } Currently my IDE, InteliJ is highlighting that as a compilation error, saying it is expecting a ) after is ? 回答1: In Kotlin, is is a reserved word . To get around this you need to escape the code using backticks, so the following will