[Test] Don't override manually registered services during test configuration
There are two ways of test service registration: - manual call to `useAdditionalServices` in abstract test runner - using of `additionalServices` property in one of test entity (e.g. in handler) Services are registered in the same order (manual first, automatic second) This led to the situation that if there was registered more specific implementation of the service in the test configuration, it will be overridden with regular implementation from handler, which is fixed by this commit
This commit is contained in:
committed by
Nikolay Lunyak
parent
990da9fa1a
commit
cb3f41f669
+6
-3
@@ -39,7 +39,10 @@ class TestServices : ComponentArrayOwner<TestService, TestService>(){
|
||||
}
|
||||
}
|
||||
|
||||
fun register(data: ServiceRegistrationData) {
|
||||
fun register(data: ServiceRegistrationData, skipAlreadyRegistered: Boolean) {
|
||||
if (skipAlreadyRegistered && getOrNull(data.kClass) != null) {
|
||||
return
|
||||
}
|
||||
registerComponent(data.kClass, data.serviceConstructor(this))
|
||||
}
|
||||
|
||||
@@ -47,8 +50,8 @@ class TestServices : ComponentArrayOwner<TestService, TestService>(){
|
||||
registerComponent(kClass, service)
|
||||
}
|
||||
|
||||
fun register(data: List<ServiceRegistrationData>) {
|
||||
data.forEach { register(it) }
|
||||
fun register(data: List<ServiceRegistrationData>, skipAlreadyRegistered: Boolean) {
|
||||
data.forEach { register(it, skipAlreadyRegistered) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user