Jan Stoltman
09/14/2019, 3:21 PM@TestOnly
or @VisibleForTesting
annotations for K/Mp out there?Arkadii Ivanov
09/14/2019, 3:25 PMJan Stoltman
09/14/2019, 3:29 PMArkadii Ivanov
09/14/2019, 3:30 PMJan Stoltman
09/14/2019, 3:32 PMsaket
09/14/2019, 4:03 PMTODO: fix once we've time
.
The same can be said for powermocks, spies, etc. They're evil, but are incredibly useful in cases like untested legacy projects where you'd want to incrementally add tests without requiring to refactor the entire graph of classes in one go.russhwolf
09/14/2019, 4:19 PM@Experimental
annotation class VisibleForTesting
Now if you have a declaration like
@VisibleForTesting
public fun foo() { ... }
then you’ll get warnings/errors when using foo()
. You can then annotate your test classes with @UseExperimental(VisibleForTesting::class)
to suppress only in your tests.Jan Stoltman
09/14/2019, 4:28 PM