Trouble mocking ProducerScope

I have a function i need to write a Unit test for:

override suspend fun subscribeToPagedJourneys(journeyCount: Int,
                                              scoreType: Int,
                                              startDate: String,
                                              subscribe: Boolean): Flow<Output<List<JourneyEntity>>> {
    return coroutineHelper.channelFlow {
        if (subscribe) {
            journeyRepository.subscribe(this)
        }

        if (journeyRepository.canGetPagedJourneys(this)) {
            journeyRepository.getPagedJourneys(this, journeyCount, scoreType, startDate)
        }
    }
}

I need to verify that journeyRepository.subscribe(this) is called and to do that i need to mock ‘this’ which is

ProducerScope<Output<List<JourneyEntity>>>

I’ve really struggled finding the solution for this, its most likely ignorance on my part but I’ve had no responses on stack over flow so came here.

You don’t mock the instance under test, you mock its dependencies. You want to mock journeyRepository and then will you verify that subscribe is called on the mock with myInstanceUnderTest as the argument.