Hello, can anyone tell me how can we create a help...
# announcements
k
Hello, can anyone tell me how can we create a helper function for a Java static method so that we can avoid the class names on every method call eg.
Copy code
Assertions.assertThat()
can be called like
Copy code
someFun()
is it possible?
k
fun someFun(...) = Assertions.assertThat(...)
Maybe even mark it
inline
.
d
Or just an import:
import Assertions.assertThat
or even
import Assertions.*
Much less boilerplate 😉
k
Ah, of course.
k
@karelpeeters okay but there are many implimentations of assertThat() how can we specify which one to call
d
With the bouncer-fun approach you need a separate bouncer fun for every variant of
assertThat
.
k
Just use @diesieben07's solution, I've not entirely waken up yet.
☕ 2
k
😅 but intellij seems to be sleeping as well as there is no auto static import popping up(like it use to with java) and i have to manually import in every test file