Skip to content

Commit 706cb15

Browse files
committed
[Test] check optional parameters during dependency verification
1 parent dc0e047 commit 706cb15

File tree

1 file changed

+2
-1
lines changed
  • projects/core/koin-test/src/jvmMain/kotlin/org/koin/test/verify

1 file changed

+2
-1
lines changed

projects/core/koin-test/src/jvmMain/kotlin/org/koin/test/verify/Verification.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ class Verification(val module: Module, extraTypes: List<KClass<*>>, injections:
140140
if (isWhiteList) {
141141
println("| dependency '$ctorParamLabel' is whitelisted")
142142
}
143-
val isDefinitionDeclared = hasDefinition || isParameterInjected || isWhiteList
143+
val isOptionalParameter = constructorParameter.isOptional
144+
val isDefinitionDeclared = hasDefinition || isParameterInjected || isWhiteList || isOptionalParameter
144145

145146
val alreadyBoundFactory = verifiedFactories.keys.firstOrNull { ctorParamClass in listOf(it.beanDefinition.primaryType) + it.beanDefinition.secondaryTypes }
146147
val factoryDependencies = verifiedFactories[alreadyBoundFactory]

0 commit comments

Comments
 (0)