mockk 1.9.3
In the test noticed if did static mock in previous test, the next test will be using same mock. Thought to do a reset at @After, but not sure which one to use clearAllMocks or unmockkAll.
unmockkAll unmocks object, static and constructor mocks
clearAllMocks clears regular, object, static and constructor mocks
but not clear what are the difference by unmocks
and clears
.
e.g.
@Test
fun test_1() {
mockkStatic(TextUtils::class)
every { TextUtils.isEmpty(param } returns true
//test
doSomeThingUsingTextUtils()
// verify
... ...
}
@Test
fun test_2() {
// in this test it does not want the mocked stub behavior
}
What it should use, clear
or 'unmock`?