Hi folks, i have a question about the Testcontaine...
# kotest
a
Hi folks, i have a question about the Testcontainer extension (see 🧵)
I was using TestContainerExtension like this:
Copy code
install(TestContainerExtension(BrowserWebDriverContainer())) {

        val that: BrowserWebDriverContainer<*> = this
        // configure container
You can see here that in the configure Block the container can be configured in a type-safe way. As TestComtainerExtension is deprecated i tried to switch to ContainerExtension. Unfortunately this breaks some code as the type information for the container is not available anymore.
Copy code
install(ContainerExtension(BrowserWebDriverContainer())) {

        var that: GenericContainer<*> = this
Is it possible to restore the previous typing to avoid needing casts here?
l
I don't have an idea, but this is a very good concern. It should be possible, maybe not implemented now
But this looks like "Kotlin hard generic magic" to work. Probably possible
Our problem with test containers is that we depend on their objects for most of the stuff. So if it doesn't support it, there would be no way for us to support ie either
a
Both ContainerExtension and TestContainerExtension are from kotest. Looks like this is the difference how they are defined:
Copy code
class ContainerExtension<T : GenericContainer<*>>(
Copy code
class TestContainerExtension<T : GenericContainer<out T>>(
i am no expert in generics but maybe this explains the difference?
👍 1
l
I think it does
I wonder what happens if we
out T
on
ContainerExtension