Hello all. I have multiplatform project (actually...
# multiplatform
m
Hello all. I have multiplatform project (actually target platform is JVM only, but I have plan to add JS). It is multi-module gradle project. Module A contains internal object (implements public interface) which is injected as dependency in another module. Production code is fine, but I need direct access to this internal object from test code of module B. I don't want to make the object public, but I can't find way to access it. In java project I can use gradle plugin
java-test-fixtures
to expose this internal object for test code only, but I can't find appropriate gradle configuration for multiplatform project. I added custom sourceSet and custom compilation, but dependency from module B doesn't work. Is it possible to use test fixtures in multiplatform project?
j
You can access internal APIs with
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "INVISIBLE_SETTER")
(or a subset of those) at the top of your test file.
m
Thank you! It works. The annotation doesn't allow to access internal object, but allow access to package-level internal val. So my trouble is gone.