3 ms·
Kotlin has an interesting approach to solving this. You can name functions using backticks, and in those backticks you can put basically anything. So it's comm
by yen223 2y ago
Kotlin has an interesting approach to solving this. You can name functions using backticks, and in those backticks you can put basically anything.
So it's common to see unit tests like
@Test
fun `this tests something very complicated`() {
...
}
- sfn42 2y agoYou can do that in Java as well. Can't remember if it's exactly the same syntax
- lmz 2y agoYou can't put spaces in the function name, but you can set a display name for JUnit - https://junit.org/junit5/docs/5.0.3/api/org/junit/jupiter/api/DisplayName.html https://junit.org/junit5/docs/5.0.3/api/org/junit/jupiter/ap...
- sfn42 2y agoMy bad, it seems I was misremembering
- bunderbunder 2y agoI don't think you can do it in Java specifically. But once upon a time it was rather popular to write test fixtures for Java code in Groovy, which does let you do it.
- sfn42 2y agoMy bad, it seems I was misremembering