register

fun register(mockFactory: MockFactory? = null, registrationBlock: SimpleServiceLocator<ServiceLocatorScope>.() -> Unit = {})

Initializes and registers a service locator for tests.

This should be called from a test setUp function. It sets the instance in MainServiceLocator to a test-specific locator.

Parameters

mockFactory

An implementation of MockFactory that integrates a mocking library (like Mockito or MockK). This is required for the automatic mocking of services that have not been explicitly registered. If this is null, any request for an unregistered service will throw an exception.

registrationBlock

A lambda where you can register specific fakes or pre-configured mocks for a test suite. Any service registered here will be used instead of an automatically generated mock.