You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a NumberResolver that handles kotlin.Number so that some<Number>() returns a random concrete numeric value instead of throwing SomeUnresolvableTypeException.
Number is abstract and cannot be instantiated directly. The resolver should randomly select one of the concrete numeric subtypes (e.g., Int, Long, Double, Float, Short, Byte) and delegate resolution to the existing resolver chain.
Scope and constraints
In scope: NumberResolver class, unit tests, registration in SomeConfig.buildResolvers()
Out of scope: BigInteger, BigDecimal, and AtomicInteger/AtomicLong are not kotlin.Number subtypes and remain handled by their own resolvers
Must be registered after all concrete numeric resolvers in the chain (first-match-wins means concrete types like Int must match before Number)
Must use type == typeOf<Number>() for exact type matching, not toString().contains()
References
Follows the same pattern as existing numeric resolvers (IntResolver, LongResolver, etc.)
Scope
Create NumberResolver.kt in dev.appoutlet.some.resolver
Create NumberResolverTest.kt in dev.appoutlet.some.resolver
Register NumberResolver in SomeConfig.buildResolvers() after ShortResolver and before KotlinUuidResolver
Acceptance criteria
some<Number>() returns a value that is an instance of kotlin.Number (one of Int, Long, Double, Float, Short, Byte)
NumberResolver.canResolve() returns false for concrete numeric types (Int, Long, Double, etc.) — those are handled by their own resolvers
NumberResolver is registered in SomeConfig after all concrete numeric resolvers
Unit tests follow the standard 3-test pattern: generation, positive detection, negative rejection
./gradlew test passes
Additional information
Since Number is abstract, the resolver should randomly pick a concrete numeric subtype and delegate to the ResolverChain (e.g., chain.resolve(typeOf<Int>())) rather than generating values directly. This keeps the resolver consistent with the chain pattern and ensures any user-registered custom factories for numeric types are respected.
Description
Add a
NumberResolverthat handleskotlin.Numberso thatsome<Number>()returns a random concrete numeric value instead of throwingSomeUnresolvableTypeException.Numberis abstract and cannot be instantiated directly. The resolver should randomly select one of the concrete numeric subtypes (e.g.,Int,Long,Double,Float,Short,Byte) and delegate resolution to the existing resolver chain.Scope and constraints
NumberResolverclass, unit tests, registration inSomeConfig.buildResolvers()BigInteger,BigDecimal, andAtomicInteger/AtomicLongare notkotlin.Numbersubtypes and remain handled by their own resolversIntmust match beforeNumber)type == typeOf<Number>()for exact type matching, nottoString().contains()References
IntResolver,LongResolver, etc.)Scope
NumberResolver.ktindev.appoutlet.some.resolverNumberResolverTest.ktindev.appoutlet.some.resolverNumberResolverinSomeConfig.buildResolvers()afterShortResolverand beforeKotlinUuidResolverAcceptance criteria
some<Number>()returns a value that is an instance ofkotlin.Number(one ofInt,Long,Double,Float,Short,Byte)NumberResolver.canResolve(typeOf<Number>())returnstrueNumberResolver.canResolve()returnsfalsefor concrete numeric types (Int,Long,Double, etc.) — those are handled by their own resolversNumberResolveris registered inSomeConfigafter all concrete numeric resolvers./gradlew testpassesAdditional information
Since
Numberis abstract, the resolver should randomly pick a concrete numeric subtype and delegate to theResolverChain(e.g.,chain.resolve(typeOf<Int>())) rather than generating values directly. This keeps the resolver consistent with the chain pattern and ensures any user-registered custom factories for numeric types are respected.