Closed tofas closed 5 years ago
You don't need a mock of your model
. You should just pass in a regular model
with status
set to PURCHASED
or am I missing something?
I was refactoring to Kotlin some clases and tests and wasn't sure if that test make sense at all. Thanks for answering anyway, I'm still learning abut kotlin and how to do proper unit tests with it's specific methods like .copy()
.
I have this mocked object in my test:
private val model: UiModel = mock { on{ status } doReturn PURCHASED }
and I want to test the return of this method:
fun refreshStatus(model: UiModel): UiModel { return model.copy(status = CANCELLED) }
I want to check if that new uiModel has updated the status, but it seems that copy method over a mock is returning null
val model = mapper.refreshStatus(uiModel)
assertEquals(model.status, CANCELLED)
Is this possible or even make sense?