Description
Problem: Teams using AppMattus KotlinFixture who want to migrate to Some must rewrite their test data generation code. The two libraries have similar capabilities but incompatible APIs (kotlinFixture() vs someSetup(), fixture<T>() vs some<T>(), repeatCount vs CollectionStrategy, etc.). This creates friction and blocks adoption.
User benefit: A dedicated compat module lets users migrate by changing only their Gradle dependency and import statements. All existing AppMattus patterns continue to work as thin aliases over Some's resolver chain.
Proposed solution: Add a new Gradle module compat-kotlin-fixture (artifact: dev.appoutlet:some-compat-kotlin-fixture) that depends on the core some artifact and provides extension functions / wrapper classes mapping the AppMattus public API to Some internals. The module is pure Kotlin with no additional runtime dependencies.
Scope
In scope:
- New Gradle module
compat-kotlin-fixture under repository root with its own build.gradle.kts
- Top-level
kotlinFixture() factory returning a wrapper around Some
Fixture type alias / wrapper with invoke() overloads:
fixture<T>() → some<T>()
fixture(listOf(...)) → random element from list
fixture(1..5) → random element from range
fixture.asSequence<T>() → Sequence<T> generation
fixture.new { } → derived fixture configuration
- Configuration DSL aliases:
repeatCount { } → CollectionStrategy
subType<Super, Sub>() → type factory registration
factory<T> { } → factory(KClass) { }
property(PropertyRef) { } → property(KProperty1) { }
filter<T> { } → sequence filtering
random = Random(seed) → seed
nullabilityStrategy(...) → NullableStrategy mapping
optionalStrategy(...) → DefaultValueStrategy mapping
recursionStrategy(...) → circular reference handling
- Strategy enum/object aliases (e.g.,
NeverNullStrategy → NullableStrategy.NeverNull)
- Unit tests proving each alias produces the same behavior as the native Some API
- Dokka documentation and a short migration guide
Out of scope (initial release):
loggingStrategy (no equivalent in Some today)
constructorStrategy (no equivalent in Some today)
fixture-javafaker / fixture-generex / fixture-kotest integrations
- Android-specific test artifacts
Acceptance criteria
Description
Problem: Teams using AppMattus KotlinFixture who want to migrate to Some must rewrite their test data generation code. The two libraries have similar capabilities but incompatible APIs (
kotlinFixture()vssomeSetup(),fixture<T>()vssome<T>(),repeatCountvsCollectionStrategy, etc.). This creates friction and blocks adoption.User benefit: A dedicated compat module lets users migrate by changing only their Gradle dependency and import statements. All existing AppMattus patterns continue to work as thin aliases over Some's resolver chain.
Proposed solution: Add a new Gradle module
compat-kotlin-fixture(artifact:dev.appoutlet:some-compat-kotlin-fixture) that depends on the coresomeartifact and provides extension functions / wrapper classes mapping the AppMattus public API to Some internals. The module is pure Kotlin with no additional runtime dependencies.Scope
In scope:
compat-kotlin-fixtureunder repository root with its ownbuild.gradle.ktskotlinFixture()factory returning a wrapper aroundSomeFixturetype alias / wrapper withinvoke()overloads:fixture<T>()→some<T>()fixture(listOf(...))→ random element from listfixture(1..5)→ random element from rangefixture.asSequence<T>()→Sequence<T>generationfixture.new { }→ derived fixture configurationrepeatCount { }→CollectionStrategysubType<Super, Sub>()→ type factory registrationfactory<T> { }→factory(KClass) { }property(PropertyRef) { }→property(KProperty1) { }filter<T> { }→ sequence filteringrandom = Random(seed)→seednullabilityStrategy(...)→NullableStrategymappingoptionalStrategy(...)→DefaultValueStrategymappingrecursionStrategy(...)→ circular reference handlingNeverNullStrategy→NullableStrategy.NeverNull)Out of scope (initial release):
loggingStrategy(no equivalent in Some today)constructorStrategy(no equivalent in Some today)fixture-javafaker/fixture-generex/fixture-kotestintegrationsAcceptance criteria
com.appmattus.fixturecode usingkotlinFixture()andfixture<T>()WHEN they replace the dependency with
dev.appoutlet:some-compat-kotlin-fixtureand update imports todev.appoutlet.some.compat.kotlinfixture.*THEN the code compiles and generates the same fixture shapes without further changes
repeatCount { 3 },factory<Int> { 42 }, andnullabilityStrategy(NeverNullStrategy)WHEN the compat layer builds the underlying
SomeConfigTHEN
some<List<String>>()produces exactly 3 items,some<Int>()always returns42, andsome<String?>()never returnsnullcompat-kotlin-fixturemodule is added to the projectWHEN
./gradlew :compat-kotlin-fixture:testrunsTHEN all compat layer tests pass and Kover line coverage for the new module is ≥ 90%
fixture.asSequence<User>().take(5).toList()through the compat APIWHEN the sequence is consumed
THEN it produces 5 distinct generated
Userinstances via the same resolver chain assome<User>()