https://kotlinlang.org logo
#mockk
Title
# mockk
s

Sergio Crespo Toubes

02/22/2019, 9:32 AM
How can i reset the verify count?
Copy code
verify(exactly = 1) { mView.showLocations(any()) }

// Reset verify

locationListPresenter.onFilterTextChanged(text)
verify(exactly = 1) { mView.showLocations(any()) }
i am with this isolationMode
IsolationMode.InstancePerLeaf
o

oleksiyp

02/24/2019, 1:46 PM
Sorry missed notification. clearMockk should reset I believe. You can customize it to clear all recorded calls, but keep behavior
s

Sergio Crespo Toubes

02/25/2019, 1:04 PM
Copy code
Given("filter") {
            val locationListPresenter = LocationListPresenter(mView, mLocationManager, true)
            When("text changed") {
                val text = "test"
                verify(exactly = 1) { mView.showLocations(any()) }
                verify(exactly = 1) { mView.setSelectedItem(any()) }
                locationListPresenter.onFilterTextChanged(text)

                Then("store user first time") {
                    verify(exactly = 2) { mView.showLocations(any()) }
                    verify(exactly = 2) { mView.setSelectedItem(any()) }
                }
            }
        }
No problem @oleksiyp. This is my solution... like LocationListPresenter call the same methods i had to verify two times the methods calls.
2 Views