├── .gitattributes ├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md ├── labeler.yml ├── labels.yml └── workflows │ ├── ci-label-sync.yml │ ├── ci-labeler.yml │ ├── ci-pull-request-formcheck.yml │ ├── ci-pull-request-validation.yml │ ├── ci-release.yml │ └── ci-snapshot.yml ├── .gitignore ├── .idea ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── copyright │ ├── anitbytes_license.xml │ └── profiles_settings.xml └── inspectionProfiles │ ├── anitbytes_inspections.xml │ ├── ktlint.xml │ └── profiles_settings.xml ├── .java_version ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dangerfile.df.kts ├── LICENSE ├── README.md ├── SECURITY.md ├── build.gradle.kts ├── detekt └── baseline.xml ├── docs ├── build.gradle.kts ├── mkdocs.yml ├── src │ ├── assets │ │ ├── badge-license.svg │ │ ├── badge-platform-support.svg │ │ └── badge-release-latest.svg │ ├── changelog.md │ ├── concept.md │ ├── development │ │ ├── badges.md │ │ ├── code-of-conduct.md │ │ ├── contributing.md │ │ └── releasing.md │ ├── howto │ │ ├── advanced.md │ │ ├── annotations.md │ │ ├── assertion.md │ │ ├── install.md │ │ ├── proxy.md │ │ ├── setup.md │ │ └── terminology.md │ ├── index.md │ ├── license.md │ ├── migration.md │ ├── quickstart.md │ ├── roadmap.md │ └── security.md └── theme │ └── assets │ └── extra.css ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── integration-android-application ├── build.gradle.kts └── src │ ├── androidTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── integration │ │ └── app │ │ └── SampleComposableSpec.kt │ ├── debug │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── integration │ │ └── app │ │ └── SampleComposablePreview.kt │ ├── main │ ├── AndroidManifest.xml │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── integration │ │ ├── SampleController.kt │ │ ├── app │ │ ├── AppContract.kt │ │ ├── MainActivity.kt │ │ └── SampleComposable.kt │ │ └── contract │ │ └── ExampleContract.kt │ └── test │ └── kotlin │ └── tech │ └── antibytes │ └── kmock │ └── integration │ └── SampleControllerAutoStubSpec.kt ├── integration-kmp ├── build.gradle.kts └── src │ ├── androidInstrumentedTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── integration │ │ └── AndroidSampleControllerAutoStubSpec.kt │ ├── androidMain │ ├── AndroidManifest.xml │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── integration │ │ └── contract │ │ ├── AndroidThing.kt │ │ └── PlatformDecoder.kt │ ├── commonMain │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── integration │ │ ├── SampleController.kt │ │ └── contract │ │ ├── ExampleContract.kt │ │ └── PlatformDecoder.kt │ ├── commonTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── integration │ │ ├── Relaxer.kt │ │ ├── SampleControllerAlternativeAccessSpec.kt │ │ ├── SampleControllerAutoSpyFactorySpec.kt │ │ ├── SampleControllerAutoStubFactorySpec.kt │ │ ├── SampleControllerAutoStubRelaxedSpec.kt │ │ └── SampleControllerAutoStubSpec.kt │ ├── iosMain │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── integration │ │ └── contract │ │ └── PlatformThingContract.kt │ ├── iosTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── integration │ │ └── contract │ │ └── PlatformDecoderSpec.kt │ ├── jsMain │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── integration │ │ └── contract │ │ ├── ExampleContractJs.kt │ │ └── PlatformDecoder.kt │ ├── jsTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── integration │ │ ├── SampleControllerAutoStubFactoryJsSpec.kt │ │ └── contract │ │ └── JsDecoderAutoSpec.kt │ ├── jvmMain │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── integration │ │ └── contract │ │ ├── ExampleContractJvm.kt │ │ └── PlatformDecoder.kt │ ├── jvmTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── integration │ │ └── contract │ │ └── JvmDecoderAutoSpec.kt │ └── nativeMain │ └── kotlin │ └── tech │ └── antibytes │ └── kmock │ └── integration │ └── contract │ └── PlatformDecoder.kt ├── kmock-gradle ├── api │ └── kmock-gradle.api ├── build.gradle.kts ├── src-processor │ └── main │ │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── gradle │ │ └── kmock │ │ └── source │ │ └── Processor.kt └── src │ ├── main │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── gradle │ │ └── kmock │ │ ├── CacheController.kt │ │ ├── KMockExtension.kt │ │ ├── KMockGradleExperimental.kt │ │ ├── KMockPlugin.kt │ │ ├── KMockPluginContract.kt │ │ ├── KSPBridge.kt │ │ ├── source │ │ ├── AndroidSourceBinder.kt │ │ ├── DependencyGraph.kt │ │ ├── KmpCleanup.kt │ │ ├── KmpSourceSetsConfigurator.kt │ │ ├── KmpTestTaskChain.kt │ │ └── SingleSourceSetConfigurator.kt │ │ └── util │ │ └── ProjectExtensions.kt │ └── test │ └── kotlin │ └── tech │ └── antibytes │ └── gradle │ └── kmock │ ├── CacheControllerSpec.kt │ ├── ExtensionSpec.kt │ ├── KMockPluginSpec.kt │ ├── KSPBridgeSpec.kt │ ├── fixture │ └── StringAlphaGenerator.kt │ ├── source │ ├── AndroidSourceBinderSpec.kt │ ├── DependencyGraphSpec.kt │ ├── KmpCleanupSpec.kt │ ├── KmpSourceSetsConfiguratorSpec.kt │ ├── KmpTestTaskChainSpec.kt │ └── SingleSourceSetConfiguratorSpec.kt │ └── util │ └── ProjectExtensionSpec.kt ├── kmock-processor ├── api │ └── kmock-processor.api ├── build.gradle.kts └── src │ ├── main │ ├── kotlin │ │ └── tech │ │ │ └── antibytes │ │ │ └── kmock │ │ │ └── processor │ │ │ ├── KMockCodeGenerator.kt │ │ │ ├── KMockGenerics.kt │ │ │ ├── KMockOptionExtractor.kt │ │ │ ├── KMockProcessor.kt │ │ │ ├── KMockProcessorProvider.kt │ │ │ ├── ProcessorContract.kt │ │ │ ├── aggregation │ │ │ ├── BaseSourceAggregator.kt │ │ │ ├── KMockMultiSourceAggregator.kt │ │ │ ├── KMockRelaxationAggregator.kt │ │ │ └── KMockSingleSourceAggregator.kt │ │ │ ├── factory │ │ │ ├── KMockFactoryEntryPointGenerator.kt │ │ │ ├── KMockFactoryGenerator.kt │ │ │ ├── KMockFactoryGeneratorUtil.kt │ │ │ ├── KMockFactoryMultiInterfaceGenerator.kt │ │ │ ├── KMockFactoryWithGenerics.kt │ │ │ ├── KMockFactoryWithoutGenerics.kt │ │ │ └── NoopFactoryGenerator.kt │ │ │ ├── kotlinpoet │ │ │ ├── ArgumentMapping.kt │ │ │ ├── ParameterTypeMapping.kt │ │ │ ├── ProxyResolving.kt │ │ │ ├── Shared.kt │ │ │ ├── TypeNameMapping.kt │ │ │ └── TypeParameterResolver.kt │ │ │ ├── mock │ │ │ ├── FunSpecExtensions.kt │ │ │ ├── GenericDeclarationExtension.kt │ │ │ ├── KMockBuildInMethodGenerator.kt │ │ │ ├── KMockGenerator.kt │ │ │ ├── KMockMethodGenerator.kt │ │ │ ├── KMockNonIntrusiveInvocationGenerator.kt │ │ │ ├── KMockPropertyGenerator.kt │ │ │ ├── KMockProxyAccessMethodGenerator.kt │ │ │ ├── KMockProxyNameSelector.kt │ │ │ ├── KMockReceiverGenerator.kt │ │ │ ├── KMockRelaxerGenerator.kt │ │ │ ├── KMockSpyGenerator.kt │ │ │ ├── MemberReturnTypeInfoExtensions.kt │ │ │ └── MethodGeneratorHelper.kt │ │ │ ├── multi │ │ │ ├── KMockMultiInterfaceBinder.kt │ │ │ ├── KMockParentFinder.kt │ │ │ └── TemplateMultiSource.kt │ │ │ └── utils │ │ │ ├── AnnotationFilter.kt │ │ │ ├── KSExtensions.kt │ │ │ ├── SourceFilter.kt │ │ │ ├── SourceSetValidator.kt │ │ │ ├── SpyContainer.kt │ │ │ └── StringExtension.kt │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── test │ ├── kotlin │ └── tech │ │ └── antibytes │ │ └── kmock │ │ ├── fixture │ │ └── StringAlphaGenerator.kt │ │ ├── integration │ │ ├── KMockFactoriesSpec.kt │ │ ├── KMockMocksSpec.kt │ │ └── KMockMultiInterfaceMocksSpec.kt │ │ └── processor │ │ ├── KMockCodeGeneratorSpec.kt │ │ ├── KMockOptionExtractorSpec.kt │ │ ├── KMockProcessorProviderSpec.kt │ │ ├── KMockProcessorSpec.kt │ │ ├── aggregation │ │ ├── KMockMultiSourceAggregatorAgnosticAnnotationSpec.kt │ │ ├── KMockMultiSourceAggregatorCommonSpec.kt │ │ ├── KMockMultiSourceAggregatorFactorySpec.kt │ │ ├── KMockMultiSourceAggregatorPlatformSpec.kt │ │ ├── KMockMultiSourceAggregatorSharedSpec.kt │ │ ├── KMockRelaxationAggregatorSpec.kt │ │ ├── KMockSingleSourceAggregatorAgnosticAnnotationSpec.kt │ │ ├── KMockSingleSourceAggregatorCommonSpec.kt │ │ ├── KMockSingleSourceAggregatorFactorySpec.kt │ │ ├── KMockSingleSourceAggregatorPlatformSpec.kt │ │ └── KMockSingleSourceAggregatorSharedSpec.kt │ │ ├── factory │ │ ├── KMockFactoryEntryPointGeneratorSpec.kt │ │ ├── KMockFactorySpec.kt │ │ ├── KMockFunctionUtilsSpec.kt │ │ ├── MockFactoryWithGenericsSpec.kt │ │ ├── MockFactoryWithoutGenericsSpec.kt │ │ └── NoopFactoryGeneratorSpec.kt │ │ ├── mock │ │ ├── GenericDeclarationExtensionSpec.kt │ │ ├── KMockBuildInFunctionGeneratorSpec.kt │ │ ├── KMockGeneratorSpec.kt │ │ ├── KMockGenericsSpec.kt │ │ ├── KMockMethodGeneratorSpec.kt │ │ ├── KMockNonIntrusiveInvocationGeneratorSpec.kt │ │ ├── KMockPropertyGeneratorSpec.kt │ │ ├── KMockProxyNameSelectorSpec.kt │ │ ├── KMockReceiverGeneratorSpec.kt │ │ ├── KMockRelaxerGeneratorSpec.kt │ │ ├── KMockSpyGeneratorSpec.kt │ │ ├── MemberReturnTypeInfoExtensionsSpec.kt │ │ ├── MethodGeneratorHelperSpec.kt │ │ └── ProxyAccessMethodGeneratorSpec.kt │ │ ├── multi │ │ ├── MultiInterfaceBinderSpec.kt │ │ ├── ParentFinderSpec.kt │ │ └── TemplateMultiSourceSpec.kt │ │ └── utils │ │ ├── AnnotationFilterSpec.kt │ │ ├── KSClassDeclarationSpec.kt │ │ ├── SourceFilterSpec.kt │ │ ├── SourceSetValidatorSpec.kt │ │ ├── SpyContainerSpec.kt │ │ └── StringExtensionsSpec.kt │ └── resources │ ├── factory │ ├── expected │ │ ├── alias │ │ │ ├── CommonActual.kt │ │ │ ├── CommonExpect.kt │ │ │ ├── Generic.kt │ │ │ └── Platform.kt │ │ ├── customshared │ │ │ ├── SharedActual.kt │ │ │ └── SharedExpect.kt │ │ ├── freeze │ │ │ ├── CommonActual.kt │ │ │ ├── CommonExpect.kt │ │ │ └── Platform.kt │ │ ├── generic │ │ │ ├── CommonActual.kt │ │ │ ├── CommonExpect.kt │ │ │ ├── Platform.kt │ │ │ ├── Shared1Expect.kt │ │ │ ├── Shared2Expect.kt │ │ │ └── SharedActual.kt │ │ ├── interfaze │ │ │ ├── Alias.kt │ │ │ ├── CommonActual.kt │ │ │ ├── CommonExpect.kt │ │ │ ├── NoSpy.kt │ │ │ ├── Platform.kt │ │ │ ├── SharedActual.kt │ │ │ └── SharedExpect.kt │ │ ├── mixed │ │ │ └── Actual.kt │ │ ├── nocommon │ │ │ └── CommonExpect.kt │ │ ├── regular │ │ │ ├── CommonActual.kt │ │ │ ├── CommonExpect.kt │ │ │ └── Platform.kt │ │ ├── relaxed │ │ │ ├── CommonActual.kt │ │ │ ├── CommonExpect.kt │ │ │ └── Platform.kt │ │ ├── spiesonly │ │ │ ├── CommonActual.kt │ │ │ ├── CommonExpect.kt │ │ │ ├── Platform.kt │ │ │ ├── SharedActual.kt │ │ │ └── SharedExpect.kt │ │ └── spy │ │ │ ├── CommonActual.kt │ │ │ ├── CommonExpect.kt │ │ │ ├── Platform.kt │ │ │ ├── SharedActual.kt │ │ │ └── SharedExpect.kt │ └── template │ │ ├── alias │ │ ├── Common.kt │ │ ├── Generic.kt │ │ └── Platform.kt │ │ ├── customshared │ │ └── Shared.kt │ │ ├── freeze │ │ ├── Common.kt │ │ └── Platform.kt │ │ ├── generic │ │ ├── Common.kt │ │ ├── Platform.kt │ │ ├── Shared1.kt │ │ ├── Shared2.kt │ │ └── Shared3.kt │ │ ├── interfaze │ │ ├── Common.kt │ │ ├── Platform.kt │ │ └── Shared.kt │ │ ├── mixed │ │ ├── Common.kt │ │ ├── Platform.kt │ │ └── Shared.kt │ │ ├── nocommon │ │ ├── Platform.kt │ │ └── Shared.kt │ │ ├── nofactory │ │ ├── Common.kt │ │ ├── Platform.kt │ │ └── Shared.kt │ │ ├── regular │ │ ├── Common.kt │ │ └── Platform.kt │ │ ├── relaxed │ │ ├── Common.kt │ │ └── Platform.kt │ │ ├── spiesonly │ │ ├── Common.kt │ │ ├── Platform.kt │ │ └── Shared.kt │ │ └── spy │ │ ├── Common.kt │ │ ├── Platform.kt │ │ └── Shared.kt │ ├── mock │ ├── expected │ │ ├── access │ │ │ ├── AsyncFun.kt │ │ │ ├── BuildIn.kt │ │ │ ├── Overloaded.kt │ │ │ ├── Property.kt │ │ │ └── SyncFun.kt │ │ ├── alias │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ └── Shared.kt │ │ ├── async │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ └── Shared.kt │ │ ├── buildIn │ │ │ ├── Collision.kt │ │ │ ├── Common.kt │ │ │ ├── NoBuildIns.kt │ │ │ ├── Platform.kt │ │ │ └── Shared.kt │ │ ├── customshared │ │ │ └── Shared.kt │ │ ├── generic │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ ├── Shared.kt │ │ │ └── SuperTyped.kt │ │ ├── kmock │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ └── Shared.kt │ │ ├── methodreceiver │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ ├── Relaxed.kt │ │ │ ├── Spied.kt │ │ │ └── SuperType.kt │ │ ├── mixedannotation │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ └── Shared.kt │ │ ├── overloaded │ │ │ ├── Collision.kt │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ ├── Refined.kt │ │ │ └── Shared.kt │ │ ├── property │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ └── Shared.kt │ │ ├── propertyreceiver │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ ├── Relaxed.kt │ │ │ ├── Spied.kt │ │ │ └── SuperType.kt │ │ ├── relaxed │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ └── Shared.kt │ │ ├── renamed │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ └── Shared.kt │ │ ├── spy │ │ │ ├── Alias.kt │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ ├── Relaxed.kt │ │ │ └── Shared.kt │ │ ├── sync │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ └── Shared.kt │ │ └── typealiaz │ │ │ ├── Access.kt │ │ │ ├── Common.kt │ │ │ ├── Platform.kt │ │ │ ├── PreventResolving.kt │ │ │ ├── Receiver.kt │ │ │ ├── Relaxed.kt │ │ │ ├── Shared.kt │ │ │ └── SuperType.kt │ └── template │ │ ├── access │ │ ├── AsyncFun.kt │ │ ├── BuildIn.kt │ │ ├── Overloaded.kt │ │ ├── Property.kt │ │ └── SyncFun.kt │ │ ├── alias │ │ ├── Common.kt │ │ ├── Platform.kt │ │ └── Shared.kt │ │ ├── async │ │ ├── Common.kt │ │ ├── Platform.kt │ │ └── Shared.kt │ │ ├── buildIn │ │ ├── Collision.kt │ │ ├── Common.kt │ │ ├── NoBuildIns.kt │ │ ├── Platform.kt │ │ └── Shared.kt │ │ ├── customshared │ │ └── Shared.kt │ │ ├── generic │ │ ├── Common.kt │ │ ├── Platform.kt │ │ ├── Shared.kt │ │ └── SuperTyped.kt │ │ ├── kmock │ │ ├── Common.kt │ │ ├── Platform.kt │ │ └── Shared.kt │ │ ├── methodreceiver │ │ ├── Common.kt │ │ ├── Platform.kt │ │ ├── Relaxed.kt │ │ ├── Spied.kt │ │ └── SuperType.kt │ │ ├── mixedannotation │ │ └── Sample.kt │ │ ├── overloaded │ │ ├── Collision.kt │ │ ├── Common.kt │ │ ├── Platform.kt │ │ ├── Refined.kt │ │ └── Shared.kt │ │ ├── property │ │ ├── Common.kt │ │ ├── Platform.kt │ │ └── Shared.kt │ │ ├── propertyreceiver │ │ ├── Common.kt │ │ ├── Platform.kt │ │ ├── Relaxed.kt │ │ ├── Spied.kt │ │ └── SuperType.kt │ │ ├── relaxed │ │ ├── Common.kt │ │ ├── Platform.kt │ │ └── Shared.kt │ │ ├── renamed │ │ ├── Common.kt │ │ ├── Platform.kt │ │ └── Shared.kt │ │ ├── spy │ │ ├── Common.kt │ │ ├── Platform.kt │ │ ├── Relaxed.kt │ │ └── Shared.kt │ │ ├── sync │ │ ├── Common.kt │ │ ├── Platform.kt │ │ └── Shared.kt │ │ └── typealiaz │ │ ├── AccessMethods.kt │ │ ├── Common.kt │ │ ├── Platform.kt │ │ ├── PreventResolving.kt │ │ ├── Receiver.kt │ │ ├── Relaxed.kt │ │ ├── Shared.kt │ │ └── SuperType.kt │ └── multi │ ├── expected │ ├── common │ │ ├── RegularActualFactory.kt │ │ ├── RegularExpectFactory.kt │ │ ├── RegularInterface.kt │ │ ├── RegularMock.kt │ │ ├── SpiedRegularActualFactory.kt │ │ ├── SpiedRegularExpectFactory.kt │ │ └── SpiedRegularMock.kt │ ├── commonGeneric │ │ ├── GenericActualFactory.kt │ │ ├── GenericExpectFactory.kt │ │ ├── GenericInterface.kt │ │ ├── GenericMock.kt │ │ ├── SpiedGenericActualFactory.kt │ │ ├── SpiedGenericExpectFactory.kt │ │ ├── SpiedGenericInterface.kt │ │ └── SpiedGenericMock.kt │ ├── custom │ │ ├── RegularActualFactory.kt │ │ ├── RegularInterface.kt │ │ ├── RegularMock.kt │ │ ├── SpiedRegularActualFactory.kt │ │ ├── SpiedRegularExpectFactory.kt │ │ └── SpiedRegularMock.kt │ ├── kmock │ │ ├── Common.kt │ │ ├── CommonInterface.kt │ │ ├── Platform.kt │ │ ├── PlatformInterface.kt │ │ ├── Shared.kt │ │ └── SharedInterface.kt │ ├── mixed │ │ ├── ActualFactory.kt │ │ ├── ExpectedFactory.kt │ │ └── Interface.kt │ ├── platform │ │ ├── RegularActualFactory.kt │ │ ├── RegularInterface.kt │ │ ├── RegularMock.kt │ │ ├── SpiedRegularActualFactory.kt │ │ └── SpiedRegularMock.kt │ ├── platformGeneric │ │ ├── GenericActualFactory.kt │ │ ├── GenericInterface.kt │ │ ├── GenericMock.kt │ │ ├── SpiedGenericActualFactory.kt │ │ ├── SpiedGenericInterface.kt │ │ └── SpiedGenericMock.kt │ ├── receiver │ │ └── SpiedReceiverMock.kt │ ├── shared │ │ ├── RegularActualFactory.kt │ │ ├── RegularInterface.kt │ │ ├── RegularMock.kt │ │ ├── SpiedRegularActualFactory.kt │ │ ├── SpiedRegularExpectFactory.kt │ │ └── SpiedRegularMock.kt │ └── sharedGeneric │ │ ├── GenericActualFactory.kt │ │ ├── GenericExpectFactory.kt │ │ ├── GenericInterface.kt │ │ ├── GenericMock.kt │ │ ├── SpiedGenericActualFactory.kt │ │ ├── SpiedGenericExpectFactory.kt │ │ ├── SpiedGenericInterface.kt │ │ └── SpiedGenericMock.kt │ └── template │ ├── common │ ├── Regular1.kt │ ├── Regular2.kt │ └── nested │ │ └── Regular3.kt │ ├── commonGeneric │ ├── Generic1.kt │ ├── Generic3.kt │ └── nested │ │ └── Generic2.kt │ ├── custom │ ├── Regular1.kt │ ├── Regular2.kt │ └── nested │ │ └── Regular3.kt │ ├── kmock │ ├── common │ │ ├── Regular1.kt │ │ ├── Regular2.kt │ │ └── nested │ │ │ └── Regular3.kt │ ├── platform │ │ ├── Regular1.kt │ │ ├── Regular2.kt │ │ └── nested │ │ │ └── Regular3.kt │ └── shared │ │ ├── Regular1.kt │ │ ├── Regular2.kt │ │ └── nested │ │ └── Regular3.kt │ ├── mixed │ ├── Generic1.kt │ ├── Generic3.kt │ ├── Regular1.kt │ ├── Regular2.kt │ └── nested │ │ ├── Generic2.kt │ │ └── Regular3.kt │ ├── platform │ ├── Regular1.kt │ ├── Regular2.kt │ └── nested │ │ └── Regular3.kt │ ├── platformGeneric │ ├── Generic1.kt │ ├── Generic3.kt │ └── nested │ │ └── Generic2.kt │ ├── receiver │ ├── Methods.kt │ └── Properties.kt │ ├── shared │ ├── Regular1.kt │ ├── Regular2.kt │ └── nested │ │ └── Regular3.kt │ └── sharedGeneric │ ├── Generic1.kt │ ├── Generic3.kt │ └── nested │ └── Generic2.kt ├── kmock-test-plugin ├── build.gradle.kts ├── gradle.properties ├── kmock-gradle-shadow │ ├── build.gradle.kts │ ├── src-processor │ │ └── main │ │ │ └── kotlin │ │ │ └── tech │ │ │ └── antibytes │ │ │ └── gradle │ │ │ └── kmock │ │ │ └── source │ │ │ └── Processor.kt │ └── src │ │ └── main ├── kmock-shadow │ ├── build.gradle.kts │ └── src │ │ ├── androidMain │ │ ├── commonMain │ │ ├── iosMain │ │ ├── jsMain │ │ ├── jvmMain │ │ └── nativeMain └── settings.gradle.kts ├── kmock ├── api │ ├── android │ │ └── kmock.api │ └── jvm │ │ └── kmock.api ├── build.gradle.kts └── src │ ├── androidMain │ ├── AndroidManifest.xml │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ ├── SafeJvmName.kt │ │ └── util │ │ └── ClassNameExtractor.kt │ ├── androidUnitTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── util │ │ └── ClassNameExtractorSpec.kt │ ├── commonMain │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ ├── Annotation.kt │ │ ├── Hint.kt │ │ ├── KMockContract.kt │ │ ├── SafeJvmName.kt │ │ ├── error │ │ └── MockError.kt │ │ ├── proxy │ │ ├── AsyncFunProxy.kt │ │ ├── FunProxy.kt │ │ ├── FunProxyArgumentRetrieval.kt │ │ ├── NonIntrusiveFunConfigurator.kt │ │ ├── NonIntrusivePropertyConfigurator.kt │ │ ├── NoopCollector.kt │ │ ├── PropertyProxy.kt │ │ ├── ProxyFactory.kt │ │ ├── RelaxationGuard.kt │ │ ├── SideEffectChain.kt │ │ ├── SpyGuard.kt │ │ ├── SyncFunProxy.kt │ │ └── UnitFunRelaxer.kt │ │ ├── util │ │ ├── ClassNameExtractor.kt │ │ └── StringFormatter.kt │ │ └── verification │ │ ├── ArgumentMatcher.kt │ │ ├── Asserter.kt │ │ ├── AsserterBase.kt │ │ ├── AssertionChain.kt │ │ ├── Assertions.kt │ │ ├── BaseAssertionContext.kt │ │ ├── Expectation.kt │ │ ├── NonFreezingAsserter.kt │ │ ├── Operators.kt │ │ ├── StrictVerificationChain.kt │ │ ├── UnchainedAssertion.kt │ │ ├── VerificationAndAssertion.kt │ │ ├── VerificationChain.kt │ │ ├── VerificationContext.kt │ │ └── constraints │ │ ├── ArgumentConstraintWrapper.kt │ │ ├── and.kt │ │ ├── any.kt │ │ ├── eq.kt │ │ ├── isNot.kt │ │ ├── isNotSame.kt │ │ ├── isSame.kt │ │ ├── not.kt │ │ └── or.kt │ ├── commonTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ ├── kmock │ │ ├── HintSpec.kt │ │ ├── fixture │ │ │ ├── Proxy.kt │ │ │ └── VerificationHandle.kt │ │ ├── proxy │ │ │ ├── AsyncFunProxyInvocationsSpec.kt │ │ │ ├── AsyncFunProxySpec.kt │ │ │ ├── AsyncFunProxyUnfrozenInvocationsSpec.kt │ │ │ ├── AsyncFunProxyUnfrozenSpec.kt │ │ │ ├── FunProxyArgumentRetrievalSpec.kt │ │ │ ├── NonIntrusiveFunConfiguratorSpec.kt │ │ │ ├── NonIntrusivePropertyConfiguratorSpec.kt │ │ │ ├── NoopCollectorSpec.kt │ │ │ ├── PropertyProxySpec.kt │ │ │ ├── PropertyProxyUnfrozenSpec.kt │ │ │ ├── ProxyFactorySpec.kt │ │ │ ├── RelaxationGuardSpec.kt │ │ │ ├── SideEffectChainSpec.kt │ │ │ ├── SideEffectChainUnfrozenSpec.kt │ │ │ ├── SpyGuardSpec.kt │ │ │ ├── SyncFunProxyInvocationsSpec.kt │ │ │ ├── SyncFunProxySpec.kt │ │ │ ├── SyncFunProxyUnfrozenInvocationsSpec.kt │ │ │ ├── SyncFunProxyUnfrozenSpec.kt │ │ │ └── UnitFunRelaxerSpec.kt │ │ ├── util │ │ │ ├── ClassNameExtractorSpec.kt │ │ │ └── StringFormatterSpec.kt │ │ └── verification │ │ │ ├── ArgumentMatcherSpec.kt │ │ │ ├── AsserterSpec.kt │ │ │ ├── AssertionChainSpec.kt │ │ │ ├── AssertionsSpec.kt │ │ │ ├── NonFreezingAsserterSpec.kt │ │ │ ├── OperationSpec.kt │ │ │ ├── StrictVerificationChainSpec.kt │ │ │ ├── UnchainedAssertionSpec.kt │ │ │ ├── VerificationAndAssertionAsyncSpec.kt │ │ │ ├── VerificationAndAssertionSpec.kt │ │ │ ├── VerificationChainSpec.kt │ │ │ ├── VerificationContextSpec.kt │ │ │ └── constraints │ │ │ ├── AndSpec.kt │ │ │ ├── AnySpec.kt │ │ │ ├── ArgumentConstraintWrapperSpec.kt │ │ │ ├── EqualSpec.kt │ │ │ ├── IsNotSameSpec.kt │ │ │ ├── IsNotSpec.kt │ │ │ ├── IsSameSpec.kt │ │ │ ├── NotSpec.kt │ │ │ └── OrSpec.kt │ │ └── mock │ │ ├── AsserterStub.kt │ │ ├── AssertionsStub.kt │ │ ├── AsyncFunProxyStub.kt │ │ ├── PropertyProxyStub.kt │ │ └── SyncFunProxyStub.kt │ ├── jsMain │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ ├── SafeJvmName.kt │ │ └── util │ │ └── ClassNameExtractor.kt │ ├── jsTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── util │ │ └── ClassNameExtractorSpec.kt │ ├── jvmMain │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ ├── SafeJvmName.kt │ │ └── util │ │ └── ClassNameExtractor.kt │ ├── jvmTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── util │ │ └── ClassNameExtractorSpec.kt │ ├── nativeMain │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ ├── SafeJvmName.kt │ │ └── util │ │ └── ClassNameExtractor.kt │ └── nativeTest │ └── kotlin │ └── tech │ └── antibytes │ └── kmock │ └── util │ └── ClassNameExtractorSpec.kt ├── playground ├── build.gradle.kts └── src │ ├── androidInstrumentedTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── example │ │ └── AndroidSampleControllerAutoStubSpec.kt │ ├── androidMain │ ├── AndroidManifest.xml │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── example │ │ └── contract │ │ ├── AndroidThing.kt │ │ └── PlatformDecoder.kt │ ├── commonMain │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── example │ │ ├── SampleController.kt │ │ └── contract │ │ ├── ExampleContract.kt │ │ └── PlatformDecoder.kt │ ├── commonTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── example │ │ ├── Relaxer.kt │ │ ├── SampleControllerAlternativeAccessSpec.kt │ │ ├── SampleControllerAutoSpyFactorySpec.kt │ │ ├── SampleControllerAutoStubFactorySpec.kt │ │ ├── SampleControllerAutoStubRelaxedSpec.kt │ │ └── SampleControllerAutoStubSpec.kt │ ├── iosMain │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── example │ │ └── contract │ │ └── PlatformThingContract.kt │ ├── iosTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── example │ │ └── contract │ │ └── PlatformDecoderSpec.kt │ ├── jsMain │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── example │ │ └── contract │ │ ├── ExampleContractJs.kt │ │ └── PlatformDecoder.kt │ ├── jsTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── example │ │ ├── SampleControllerAutoStubFactoryJsSpec.kt │ │ └── contract │ │ └── JsDecoderAutoSpec.kt │ ├── jvmMain │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── example │ │ └── contract │ │ ├── ExampleContractJvm.kt │ │ └── PlatformDecoder.kt │ ├── jvmTest │ └── kotlin │ │ └── tech │ │ └── antibytes │ │ └── kmock │ │ └── example │ │ └── contract │ │ └── JvmDecoderAutoSpec.kt │ └── nativeMain │ └── kotlin │ └── tech │ └── antibytes │ └── kmock │ └── example │ └── contract │ └── PlatformDecoder.kt ├── settings.gradle.kts └── setup ├── build.gradle.kts ├── settings.gradle.kts └── src └── main └── kotlin └── tech └── antibytes └── gradle └── kmock └── config ├── SetupPlugin.kt ├── publishing ├── KMockConfiguration.kt ├── KMockGradleConfiguration.kt ├── KMockProcessorConfiguration.kt ├── KMockPublishingConfiguration.kt └── PublishingGroup.kt ├── quality ├── Excludes.kt ├── Linter.kt ├── SonarConfiguration.kt └── StableApi.kt └── repositories └── Repositories.kt /.gitattributes: -------------------------------------------------------------------------------- 1 | *.bat text eol=crlf 2 | 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | 4 | ## Expected Behavior 5 | 6 | 7 | ## Actual Behavior 8 | 9 | 10 | ## Possible Fix 11 | 12 | 13 | ## Steps to Reproduce 14 | 15 | 16 | 1. 17 | 2. 18 | 3. 19 | 4. 20 | 21 | ## Context 22 | 23 | 24 | ## Your Environment 25 | 26 | * Version used: 27 | * Environment name and version: 28 | * Operating System and version (desktop or mobile): 29 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### :pushpin: References 2 | * **Issue:** #1, #2 3 | * **Related PRs:** #3, #4 4 | 5 | ### What does the PR achieve/Which part improves the PR? 6 | 7 | 8 | ### What is the overall concept of the implementation? 9 | 10 | 11 | ### :thinking: DOD Checklist 12 | 13 | - [ ] My code passes the lint checks. 14 | - [ ] My changes are covered with proper tests. 15 | - [ ] All tests are pass. 16 | - [ ] My changes update the documentation. 17 | - [ ] My changes are reflected in the changelog. 18 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | ci: 2 | - .github/**/* 3 | 4 | dependencies: 5 | - setup/**/* 6 | 7 | documentation: 8 | - docs/**/* 9 | - README.md 10 | - LICENSE 11 | - CHANGELOG.md 12 | - CODE-OF-CONDUCT.md 13 | - CODE_OF_CONDUCT.md 14 | - CONTRIBUTION.md 15 | - SECURITY.md 16 | 17 | # Library 18 | kmock: 19 | - kmock/**/* 20 | 21 | kmock-gradle: 22 | - kmock-gradle/**/* 23 | 24 | kmock-processor: 25 | - kmock-processor/**/* 26 | 27 | integration-kmp: 28 | - integration-kmp/**/* 29 | 30 | integration-android-application: 31 | - integration-android-application/**/* 32 | 33 | playground: 34 | - playground/**/* 35 | 36 | integration-plugin: 37 | - gradlePlugin/kmock-test-plugin/**/* 38 | -------------------------------------------------------------------------------- /.github/workflows/ci-label-sync.yml: -------------------------------------------------------------------------------- 1 | name: Antibytes CI - Label Synchronisation 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | sync-labels: 8 | uses: bitpogo/workflows/.github/workflows/shared-label-sync.yml@main 9 | with: 10 | labels-path: .github/labels.yml 11 | secrets: 12 | github-token: ${{ secrets.GITHUB_TOKEN }} 13 | -------------------------------------------------------------------------------- /.github/workflows/ci-labeler.yml: -------------------------------------------------------------------------------- 1 | name: Antibytes CI - Label Pull Request Labels 2 | 3 | on: 4 | pull_request: 5 | types: [ opened, synchronize, edited, reopened ] 6 | branches: 7 | - main 8 | - feature/* 9 | - release/* 10 | - core/* 11 | - plugin/* 12 | - bugfix/* 13 | workflow_dispatch: 14 | 15 | jobs: 16 | add-pr-labels: 17 | uses: bitpogo/workflows/.github/workflows/shared-labeler.yml@main 18 | with: 19 | labels-path: .github/labeler.yml 20 | secrets: 21 | github-token: ${{ secrets.GITHUB_TOKEN }} 22 | -------------------------------------------------------------------------------- /.github/workflows/ci-pull-request-formcheck.yml: -------------------------------------------------------------------------------- 1 | name: Antibytes CI - Pull-Request Formcheck 2 | 3 | on: 4 | pull_request: 5 | types: [opened, synchronize, edited, reopened] 6 | branches: 7 | - main 8 | - feature/* 9 | - release/* 10 | - core/* 11 | - plugin/* 12 | - bugfix/* 13 | 14 | jobs: 15 | pull-request-precheck: 16 | uses: bitpogo/workflows/.github/workflows/shared-pull-request-form-check.yml@main 17 | secrets: 18 | github-token: ${{ secrets.GITHUB_TOKEN }} 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Gradle 2 | .gradle/ 3 | build/ 4 | local.properties 5 | build-cache/ 6 | 7 | # IDEA/Android Studio ignores 8 | *iml 9 | .idea/* 10 | 11 | # IDEA/Android Studio includes 12 | !.idea/fileTemplates/ 13 | !.idea/inspectionProfiles/ 14 | !.idea/scopes/ 15 | !.idea/codeStyles/ 16 | !.idea/encoding.xml 17 | !.idea/copyright/ 18 | 19 | # Others 20 | captures/ 21 | 22 | .asciidoctor/ 23 | 24 | .DS_Store 25 | 26 | example-android-app/ 27 | 28 | # generated 29 | 30 | # kotlin-js 31 | kotlin-js-store/ 32 | 33 | # Editors 34 | *.suo 35 | *.ntvs* 36 | *.njsproj 37 | *.sln 38 | *.sw? 39 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/copyright/anitbytes_license.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/anitbytes_inspections.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/ktlint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /.java_version: -------------------------------------------------------------------------------- 1 | 17 2 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Versions currently being supported with security updates: 6 | 7 | | Version | Supported | 8 | | ------- | ------------------ | 9 | | latest | :white_check_mark: | 10 | 11 | ## Reporting a Vulnerability 12 | 13 | Please use an [Issue](https://github.com/bitPogo/kmock/issues) to report vulnerabilities. 14 | 15 | If security bug is discovered, following actions will be taken: 16 | 17 | - Confirm the problem and determine the affected versions. 18 | - Audit code to find any potential similar problems. 19 | - Prepare fixes for all releases still under maintenance. 20 | -------------------------------------------------------------------------------- /docs/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | import tech.antibytes.gradle.kmock.config.publishing.KMockPublishingConfiguration 8 | 9 | plugins { 10 | alias(antibytesCatalog.plugins.gradle.antibytes.mkDocs) 11 | } 12 | 13 | antibytesDocumentation { 14 | versioning.set(KMockPublishingConfiguration(project).versioning) 15 | } 16 | -------------------------------------------------------------------------------- /docs/src/assets/badge-license.svg: -------------------------------------------------------------------------------- 1 | license: Apache 2.0licenseApache 2.0 -------------------------------------------------------------------------------- /docs/src/assets/badge-release-latest.svg: -------------------------------------------------------------------------------- 1 | Release: 0.3.0-rc08Release0.3.0-rc08 -------------------------------------------------------------------------------- /docs/src/changelog.md: -------------------------------------------------------------------------------- 1 | ../../CHANGELOG.md -------------------------------------------------------------------------------- /docs/src/development/badges.md: -------------------------------------------------------------------------------- 1 | # Create a badge 2 | 3 | The badges are generate with [Shields.io](https://shields.io/) to generate our Badges. Use the following links in order to document or update any used badge and place the resulting SVG files the projects `assets/images` folder. 4 | 5 | ## Badges 6 | 7 | - Latest release 8 | 9 | ```bash 10 | curl "https://img.shields.io/badge/Release-0.3.0--rc08-blueviolet.svg?style=flat" -s -o badge-release-latest.svg 11 | ``` 12 | 13 | - Platforms 14 | 15 | ```bash 16 | curl "https://img.shields.io/badge/Platform-Android%20|%20JVM%20|%20Js%20|%20iOS%20|%20macOS%20|%20watchOS%20|%20tvOS%20|%20LinuxX64%20|%20MingwX64%20-blue.svg" -s -o badge-platform-support.svg 17 | ``` 18 | 19 | - License 20 | 21 | ```bash 22 | curl "https://img.shields.io/badge/license-Apache_2.0-blue.svg" -s -o badge-license.svg 23 | ``` 24 | 25 | ### License 26 | 27 | Shields is licensed under _Creative Commons Zero v1.0 Universal_ (as of 2022-02-23) 28 | -------------------------------------------------------------------------------- /docs/src/development/code-of-conduct.md: -------------------------------------------------------------------------------- 1 | ../../../CODE_OF_CONDUCT.md -------------------------------------------------------------------------------- /docs/src/development/contributing.md: -------------------------------------------------------------------------------- 1 | ../../../CONTRIBUTING.md -------------------------------------------------------------------------------- /docs/src/development/releasing.md: -------------------------------------------------------------------------------- 1 | # Releasing 2 | 3 | Releases are automatically created from added tags using GitHub Actions. 4 | 5 | A tag needs to be in the form of `v{major}.{minor}.{patch}`. 6 | 7 | ## Release preparation 8 | 9 | 1. Create a release branch of from `main` branch with this pattern: 10 | 11 | - `release/{major}.{minor}/prepare-{major}.{minor}.{patch}` 12 | 13 | 2. Update [changelog.md](../changelog.md) by creating a new Unreleased section and change current unreleased to release version 14 | 3. Update the latest release [badge](badges.md) 15 | 16 | ## Release 17 | 18 | For a release, this project uses GitHub releases: 19 | 20 | 1. Create a [new release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository) 21 | 2. Set the tag 22 | 3. Set the title 23 | 4. Add a description in form of a changelog 24 | 5. Publish when ready 25 | -------------------------------------------------------------------------------- /docs/src/howto/terminology.md: -------------------------------------------------------------------------------- 1 | # Terminology 2 | Just to prevent any confusion about terms let's make some quick definitions: 3 | 4 | * A Proxy relates to a single property (PropertyProxy) or method (FunProxy). 5 | * A Mock owns multiple Proxies based on an given Interface. 6 | * Interfaces and their members are used as Templates for Proxies or a Mock. 7 | * Assertion is strict about order which makes them fail in place and they are absolute/explicit about what they cover. 8 | * Verification fails after they traversed all available sources, which means they can skip elements. 9 | -------------------------------------------------------------------------------- /docs/src/index.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /docs/src/license.md: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /docs/src/roadmap.md: -------------------------------------------------------------------------------- 1 | # Roadmap 2 | 3 | ## 0.3.0 4 | - optimize & stabilize proxy access methods 5 | - stabilize agnostic annotations 6 | - improve support for Android ✅ 7 | - prototype class mocking for JVM based sources sets 8 | - support more platforms ✅ 9 | 10 | ## 0.2.0 11 | - stabilize of the mock generation in respect of base use-cases ✅️ 12 | - support varargs ✅️ 13 | - support receivers ✅️ 14 | - support custom annotations ✅️ 15 | - support mocks based on multiple interfaces ✅️ 16 | - stabilize verification/assertion ✅️ 17 | - stabilize proxy api ✅️ 18 | - introduce a more robust way to access proxies ✅️ 19 | - prototype an agnostic annotation for arbitrary sources ✅️ 20 | - publish to MavenCentral ✅️ 21 | 22 | ## 0.1.0 23 | - support hierarchical source sets ✅ 24 | - support properties ✅ 25 | - support methods ✅ 26 | - support overloading ✅ 27 | - support generics ✅ 28 | - support spies ✅ 29 | - support relaxation ✅ 30 | - support verification ✅ 31 | - support verification over multiple proxies ✅ 32 | - prototype assertion ✅ 33 | -------------------------------------------------------------------------------- /docs/src/security.md: -------------------------------------------------------------------------------- 1 | ../../SECURITY.md -------------------------------------------------------------------------------- /docs/theme/assets/extra.css: -------------------------------------------------------------------------------- 1 | .md-content__inner a { 2 | color: #6791e0!important; 3 | } 4 | 5 | .md-typeset table:not([class]) { 6 | font-size: 0.75rem; 7 | } 8 | 9 | .md-typeset td > code { 10 | word-break: keep-all!important; 11 | } 12 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | # 4 | # Use of this source code is governed by Apache v2.0 5 | # 6 | 7 | # Gradle 8 | org.gradle.jvmargs=-Xmx4048m 9 | org.gradle.parallel=true 10 | org.gradle.dependency.verification.console=verbose 11 | org.gradle.caching=true 12 | org.gradle.welcome=never 13 | org.gradle.configuration-cache=true 14 | org.gradle.configuration-cache.problems=warn 15 | # Kotlin 16 | kotlin.incremental.multiplatform=true 17 | kotlin.mpp.stability.nowarn=true 18 | kotlin.code.style=official 19 | kotlin.mpp.applyDefaultHierarchyTemplate=false 20 | # Native 21 | kotlin.native.ignoreIncorrectDependencies=true 22 | kotlin.mpp.enableCInteropCommonization=true 23 | kotlin.native.cacheKind=none 24 | kotlin.native.osVersionMin.ios_x64=14.0 25 | kotlin.native.osVersionMin.ios_arm64=14.0 26 | kotlin.native.osVersionMin.ios_arm32=14.0 27 | kotlin.native.osVersionMin.ios_simulator_arm64=14.0 28 | # Android 29 | android.useAndroidX=true 30 | android.enableJetifier=false 31 | # see: https://github.com/robolectric/robolectric/issues/6521 32 | android.jetifier.ignorelist=bcprov 33 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitPogo/kmock/9a94e2842f615b08d4e2942c4987278a3d5c9f43/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /integration-android-application/src/debug/kotlin/tech/antibytes/kmock/integration/app/SampleComposablePreview.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.app 8 | 9 | import androidx.compose.runtime.Composable 10 | import androidx.compose.ui.tooling.preview.Preview 11 | import kotlinx.coroutines.flow.MutableStateFlow 12 | import kotlinx.coroutines.flow.StateFlow 13 | 14 | @Preview 15 | @Composable 16 | fun SampleComposablePreview() { 17 | val flow = MutableStateFlow("generic text") 18 | 19 | SampleComposable(viewModel = ViewModelStub(flow)) 20 | } 21 | 22 | private class ViewModelStub(override val flow: StateFlow) : AppContract.SampleViewModel { 23 | override fun doSomething() { 24 | TODO("Not yet implemented") 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /integration-android-application/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /integration-android-application/src/main/kotlin/tech/antibytes/kmock/integration/app/AppContract.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.app 8 | 9 | import kotlinx.coroutines.flow.StateFlow 10 | 11 | interface AppContract { 12 | interface SampleViewModel { 13 | val flow: StateFlow 14 | 15 | fun doSomething() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /integration-android-application/src/main/kotlin/tech/antibytes/kmock/integration/app/MainActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.app 8 | 9 | import android.os.Bundle 10 | import androidx.activity.ComponentActivity 11 | 12 | class MainActivity : ComponentActivity() { 13 | override fun onCreate(savedInstanceState: Bundle?) { 14 | super.onCreate(savedInstanceState) 15 | TODO() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /integration-android-application/src/main/kotlin/tech/antibytes/kmock/integration/app/SampleComposable.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.app 8 | 9 | import androidx.compose.material.Text 10 | import androidx.compose.material.TextButton 11 | import androidx.compose.runtime.Composable 12 | import androidx.compose.runtime.collectAsState 13 | 14 | @Composable 15 | fun SampleComposable(viewModel: AppContract.SampleViewModel) { 16 | val genericText = viewModel.flow.collectAsState() 17 | 18 | Text(genericText.value) 19 | 20 | TextButton(onClick = { viewModel.doSomething() }) { 21 | Text("Click me") 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /integration-android-application/src/main/kotlin/tech/antibytes/kmock/integration/contract/ExampleContract.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.contract 8 | 9 | import kotlinx.coroutines.flow.SharedFlow 10 | 11 | interface ExampleContract { 12 | interface SampleDomainObject { 13 | var id: String 14 | val value: Int 15 | } 16 | 17 | interface SampleRemoteRepository { 18 | suspend fun fetch(url: String): SampleDomainObject 19 | fun find(id: String): SampleDomainObject 20 | } 21 | 22 | interface SampleLocalRepository { 23 | suspend fun store(id: String, value: Int): SampleDomainObject 24 | fun contains(id: String): Boolean 25 | fun fetch(id: String): SampleDomainObject 26 | } 27 | 28 | interface SampleController { 29 | suspend fun fetchAndStore(url: String): SampleDomainObject 30 | fun find(id: String): SharedFlow 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /integration-kmp/src/androidMain/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /integration-kmp/src/androidMain/kotlin/tech/antibytes/kmock/integration/contract/AndroidThing.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.contract 8 | 9 | interface AndroidThing { 10 | fun doSomeAndroidThings() 11 | } 12 | -------------------------------------------------------------------------------- /integration-kmp/src/androidMain/kotlin/tech/antibytes/kmock/integration/contract/PlatformDecoder.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.contract 8 | 9 | import android.util.Base64 10 | 11 | actual typealias PlatformDecoder = Base64 12 | -------------------------------------------------------------------------------- /integration-kmp/src/commonMain/kotlin/tech/antibytes/kmock/integration/contract/PlatformDecoder.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.contract 8 | 9 | expect class PlatformDecoder 10 | -------------------------------------------------------------------------------- /integration-kmp/src/iosMain/kotlin/tech/antibytes/kmock/integration/contract/PlatformThingContract.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.contract 8 | 9 | import platform.Foundation.NSData 10 | 11 | interface PlatformThingContract { 12 | val payload: NSData 13 | } 14 | -------------------------------------------------------------------------------- /integration-kmp/src/iosTest/kotlin/tech/antibytes/kmock/integration/contract/PlatformDecoderSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.contract 8 | 9 | import kotlin.test.Test 10 | import tech.antibytes.kmock.Mock 11 | 12 | @Mock(PlatformThingContract::class) 13 | class PlatformDecoderSpec { 14 | @Test 15 | fun doSomething() { 16 | // Nothing 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /integration-kmp/src/jsMain/kotlin/tech/antibytes/kmock/integration/contract/ExampleContractJs.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.contract 8 | 9 | interface ExampleContractJs { 10 | interface JsDecoder { 11 | fun createJsDecoder(): dynamic 12 | fun createJsDecoder(seed: Int): dynamic 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /integration-kmp/src/jsMain/kotlin/tech/antibytes/kmock/integration/contract/PlatformDecoder.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.contract 8 | 9 | actual typealias PlatformDecoder = Any 10 | -------------------------------------------------------------------------------- /integration-kmp/src/jsTest/kotlin/tech/antibytes/kmock/integration/contract/JsDecoderAutoSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.contract 8 | 9 | import kotlin.test.Test 10 | import tech.antibytes.kmock.Mock 11 | import tech.antibytes.util.test.fulfils 12 | 13 | @Mock(ExampleContractJs.JsDecoder::class) 14 | class JsDecoderAutoSpec { 15 | @Test 16 | @JsName("fn0") 17 | fun `It fulfils JsDecoder`() { 18 | JsDecoderMock() fulfils ExampleContractJs.JsDecoder::class 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /integration-kmp/src/jvmMain/kotlin/tech/antibytes/kmock/integration/contract/ExampleContractJvm.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.contract 8 | 9 | import java.util.Base64 10 | 11 | interface ExampleContractJvm { 12 | interface JvmDecoder { 13 | fun createJvmDecoder(): Base64 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /integration-kmp/src/jvmMain/kotlin/tech/antibytes/kmock/integration/contract/PlatformDecoder.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.contract 8 | 9 | import java.util.Base64 10 | 11 | actual typealias PlatformDecoder = Base64 12 | -------------------------------------------------------------------------------- /integration-kmp/src/jvmTest/kotlin/tech/antibytes/kmock/integration/contract/JvmDecoderAutoSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.contract 8 | 9 | import org.junit.Test 10 | import tech.antibytes.kmock.Mock 11 | import tech.antibytes.util.test.fulfils 12 | 13 | @Mock( 14 | ExampleContractJvm.JvmDecoder::class, 15 | ) 16 | class JvmDecoderAutoSpec { 17 | @Test 18 | fun `It fulfils JvmDecoder`() { 19 | JvmDecoderMock() fulfils ExampleContractJvm.JvmDecoder::class 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /integration-kmp/src/nativeMain/kotlin/tech/antibytes/kmock/integration/contract/PlatformDecoder.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.integration.contract 8 | 9 | actual typealias PlatformDecoder = Any 10 | -------------------------------------------------------------------------------- /kmock-gradle/src-processor/main/kotlin/tech/antibytes/gradle/kmock/source/Processor.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("UnusedReceiverParameter") 8 | 9 | package tech.antibytes.gradle.kmock.source 10 | 11 | import org.gradle.api.artifacts.dsl.DependencyHandler 12 | import tech.antibytes.gradle.kmock.config.MainConfig 13 | 14 | internal fun DependencyHandler.determineProcessor(): Any = MainConfig.processor 15 | -------------------------------------------------------------------------------- /kmock-gradle/src/main/kotlin/tech/antibytes/gradle/kmock/CacheController.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.gradle.kmock 8 | 9 | import org.gradle.api.Project 10 | 11 | internal object CacheController : KMockPluginContract.CacheController { 12 | private fun String.isAndroidKSPTask(): Boolean { 13 | return startsWith("ksp") && ( 14 | endsWith("UnitTestKotlinAndroid") || endsWith("AndroidTestKotlinAndroid") 15 | ) 16 | } 17 | 18 | private fun String.isKSPTask(): Boolean = startsWith("kspTestKotlin") || isAndroidKSPTask() 19 | 20 | override fun configure(project: Project) { 21 | val kspTasks = project.tasks.matching { task -> task.name.isKSPTask() } 22 | 23 | kspTasks.configureEach { 24 | outputs.cacheIf { false } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /kmock-gradle/src/main/kotlin/tech/antibytes/gradle/kmock/KMockGradleExperimental.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | package tech.antibytes.gradle.kmock 7 | 8 | @RequiresOptIn( 9 | level = RequiresOptIn.Level.WARNING, 10 | message = "This API is experimental. It may be removed or changed in future releases.", 11 | ) 12 | @Target( 13 | AnnotationTarget.CLASS, 14 | AnnotationTarget.TYPEALIAS, 15 | AnnotationTarget.FUNCTION, 16 | AnnotationTarget.PROPERTY, 17 | AnnotationTarget.FIELD, 18 | AnnotationTarget.CONSTRUCTOR, 19 | ) 20 | public annotation class KMockGradleExperimental 21 | -------------------------------------------------------------------------------- /kmock-gradle/src/main/kotlin/tech/antibytes/gradle/kmock/KMockPlugin.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.gradle.kmock 8 | 9 | import org.gradle.api.Plugin 10 | import org.gradle.api.Project 11 | import tech.antibytes.gradle.kmock.KMockPluginContract.Companion.KSP_PLUGIN 12 | import tech.antibytes.gradle.kmock.util.applyIfNotExists 13 | import tech.antibytes.gradle.kmock.util.isJs 14 | 15 | public class KMockPlugin : Plugin { 16 | override fun apply(target: Project) { 17 | if (!target.isJs()) { 18 | target.applyIfNotExists(KSP_PLUGIN) 19 | } 20 | 21 | target.extensions.create("kmock", KMockExtension::class.java) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /kmock-gradle/src/main/kotlin/tech/antibytes/gradle/kmock/util/ProjectExtensions.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.gradle.kmock.util 8 | 9 | import org.gradle.api.Project 10 | 11 | internal fun Project.applyIfNotExists(vararg pluginNames: String) { 12 | pluginNames.forEach { pluginName -> 13 | if (!this.plugins.hasPlugin(pluginName)) { 14 | this.plugins.apply(pluginName) 15 | } 16 | } 17 | } 18 | 19 | internal fun Project.isKmp(): Boolean { 20 | return this.plugins.hasPlugin("org.jetbrains.kotlin.multiplatform") 21 | } 22 | 23 | internal fun Project.isAndroid(): Boolean { 24 | return this.plugins.hasPlugin("com.android.library") || this.plugins.hasPlugin("com.android.application") 25 | } 26 | 27 | internal fun Project.isJs(): Boolean { 28 | return this.plugins.hasPlugin("org.jetbrains.kotlin.js") 29 | } 30 | -------------------------------------------------------------------------------- /kmock-gradle/src/test/kotlin/tech/antibytes/gradle/kmock/fixture/StringAlphaGenerator.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.gradle.kmock.fixture 8 | 9 | import kotlin.random.Random 10 | import tech.antibytes.kfixture.PublicApi 11 | 12 | internal class StringAlphaGenerator( 13 | private val random: Random, 14 | ) : PublicApi.Generator { 15 | override fun generate(): String { 16 | val length = random.nextInt(1, 10) 17 | val chars = ByteArray(length) 18 | 19 | for (idx in 0 until length) { 20 | val char = random.nextInt(65, 91) 21 | chars[idx] = if (random.nextBoolean()) { 22 | (char + 32).toByte() 23 | } else { 24 | char.toByte() 25 | } 26 | } 27 | 28 | return chars.decodeToString() 29 | } 30 | 31 | companion object : PublicApi.GeneratorFactory { 32 | override fun getInstance(random: Random): PublicApi.Generator { 33 | return StringAlphaGenerator(random) 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /kmock-processor/api/kmock-processor.api: -------------------------------------------------------------------------------- 1 | public final class tech/antibytes/kmock/processor/KMockProcessorProvider : com/google/devtools/ksp/processing/SymbolProcessorProvider { 2 | public fun ()V 3 | public fun create (Lcom/google/devtools/ksp/processing/SymbolProcessorEnvironment;)Lcom/google/devtools/ksp/processing/SymbolProcessor; 4 | } 5 | 6 | -------------------------------------------------------------------------------- /kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/kotlinpoet/TypeNameMapping.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.processor.kotlinpoet 10 | 11 | import com.google.devtools.ksp.symbol.KSTypeReference 12 | import com.squareup.kotlinpoet.TypeName 13 | import com.squareup.kotlinpoet.ksp.TypeParameterResolver 14 | 15 | internal fun KSTypeReference.toTypeName( 16 | typeParameterResolver: TypeParameterResolver, 17 | ): TypeName = mapArgumentType( 18 | typeParameterResolver = typeParameterResolver, 19 | mapping = emptyMap(), 20 | ) 21 | -------------------------------------------------------------------------------- /kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/mock/FunSpecExtensions.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.processor.mock 10 | 11 | import com.squareup.kotlinpoet.FunSpec 12 | import com.squareup.kotlinpoet.KModifier 13 | import tech.antibytes.kmock.processor.ProcessorContract.MemberArgumentTypeInfo 14 | 15 | private val varargs = arrayOf(KModifier.VARARG) 16 | private val noVarargs = arrayOf() 17 | 18 | internal fun FunSpec.Builder.addArguments( 19 | arguments: Array, 20 | ): FunSpec.Builder { 21 | arguments.forEach { argument -> 22 | val vararged = if (argument.isVarArg) { 23 | varargs 24 | } else { 25 | noVarargs 26 | } 27 | 28 | this.addParameter( 29 | argument.argumentName, 30 | argument.methodTypeName, 31 | *vararged, 32 | ) 33 | } 34 | 35 | return this 36 | } 37 | -------------------------------------------------------------------------------- /kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/mock/GenericDeclarationExtension.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.processor.mock 10 | 11 | import com.squareup.kotlinpoet.TypeName 12 | import tech.antibytes.kmock.processor.ProcessorContract.Companion.NULLABLE_ANY 13 | import tech.antibytes.kmock.processor.ProcessorContract.GenericDeclaration 14 | 15 | internal fun GenericDeclaration.resolveGeneric(): TypeName { 16 | return if (this.types.size > 1) { 17 | NULLABLE_ANY.copy(nullable = isNullable) 18 | } else { 19 | this.types.first().copy(nullable = isNullable) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/multi/KMockParentFinder.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.multi 8 | 9 | import tech.antibytes.kmock.processor.ProcessorContract.ParentFinder 10 | import tech.antibytes.kmock.processor.ProcessorContract.TemplateMultiSource 11 | import tech.antibytes.kmock.processor.ProcessorContract.TemplateSource 12 | 13 | internal object KMockParentFinder : ParentFinder { 14 | override fun find( 15 | templateSource: TemplateSource, 16 | templateMultiSources: List, 17 | ): TemplateMultiSource? { 18 | return templateMultiSources.firstOrNull { parent -> 19 | templateSource.packageName == parent.packageName && 20 | templateSource.indicator == parent.indicator && 21 | templateSource.templateName == parent.templateName 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/multi/TemplateMultiSource.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.processor.multi 10 | 11 | import tech.antibytes.kmock.processor.ProcessorContract.TemplateMultiSource 12 | 13 | internal fun TemplateMultiSource.hasGenerics(): Boolean = this.generics.any { item -> item != null } 14 | -------------------------------------------------------------------------------- /kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/utils/StringExtension.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.utils 8 | 9 | import java.util.Locale 10 | 11 | internal fun String.titleCase(): String { 12 | return this.replaceFirstChar { 13 | if (it.isLowerCase()) { 14 | it.titlecase(Locale.getDefault()) 15 | } else { 16 | it.toString() 17 | } 18 | } 19 | } 20 | 21 | internal fun ensureNotNullClassName(name: String?): String { 22 | return name ?: throw IllegalStateException("Expected non null class name!") 23 | } 24 | -------------------------------------------------------------------------------- /kmock-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | tech.antibytes.kmock.processor.KMockProcessorProvider 2 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/fixture/StringAlphaGenerator.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.fixture 8 | 9 | import kotlin.random.Random 10 | import tech.antibytes.kfixture.PublicApi 11 | 12 | internal class StringAlphaGenerator( 13 | private val random: Random, 14 | ) : PublicApi.Generator { 15 | override fun generate(): String { 16 | val length = random.nextInt(1, 10) 17 | val chars = ByteArray(length) 18 | 19 | for (idx in 0 until length) { 20 | val char = random.nextInt(65, 91) 21 | chars[idx] = if (random.nextBoolean()) { 22 | (char + 32).toByte() 23 | } else { 24 | char.toByte() 25 | } 26 | } 27 | 28 | return chars.decodeToString() 29 | } 30 | 31 | companion object : PublicApi.GeneratorFactory { 32 | override fun getInstance(random: Random): PublicApi.Generator { 33 | return StringAlphaGenerator(random) 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/factory/KMockFactoryEntryPointGeneratorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.factory 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | internal class KMockFactoryEntryPointGeneratorSpec { 15 | @Test 16 | fun `It fulfils KMockFactoryEntryPointGenerator`() { 17 | KMockFactoryEntryPointGenerator( 18 | false, 19 | "any", 20 | mockk(), 21 | false, 22 | mockk(), 23 | mockk(), 24 | mockk(), 25 | ) fulfils ProcessorContract.MockFactoryEntryPointGenerator::class 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/factory/KMockFactorySpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.factory 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class KMockFactorySpec { 15 | @Test 16 | fun `It fulfils MockFactoryGenerator`() { 17 | KMockFactoryGenerator( 18 | mockk(), 19 | "any", 20 | false, 21 | mockk(), 22 | false, 23 | mockk(), 24 | mockk(), 25 | mockk(), 26 | mockk(), 27 | mockk(), 28 | ) fulfils ProcessorContract.MockFactoryGenerator::class 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/factory/KMockFunctionUtilsSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.factory 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class KMockFunctionUtilsSpec { 15 | @Test 16 | fun `It fulfils MockFactoryGeneratorUtil`() { 17 | KMockFactoryGeneratorUtil( 18 | false, 19 | false, 20 | mockk(), 21 | ) fulfils ProcessorContract.MockFactoryGeneratorUtil::class 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/factory/MockFactoryWithGenericsSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.factory 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class MockFactoryWithGenericsSpec { 15 | @Test 16 | fun `It fulfils MockFactoryWithGenerics`() { 17 | KMockFactoryWithGenerics( 18 | true, 19 | mockk(), 20 | false, 21 | mockk(), 22 | mockk(), 23 | ) fulfils ProcessorContract.MockFactoryWithGenerics::class 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/factory/MockFactoryWithoutGenericsSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.factory 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class MockFactoryWithoutGenericsSpec { 15 | @Test 16 | fun `It fulfils MockFactoryWithoutGenerics`() { 17 | KMockFactoryWithoutGenerics( 18 | true, 19 | true, 20 | mockk(), 21 | ) fulfils ProcessorContract.MockFactoryWithoutGenerics::class 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/factory/NoopFactoryGeneratorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.factory 8 | 9 | import org.junit.jupiter.api.Test 10 | import tech.antibytes.kmock.processor.ProcessorContract 11 | import tech.antibytes.util.test.fulfils 12 | 13 | class NoopFactoryGeneratorSpec { 14 | @Test 15 | fun `It fulfils MockFactoryGenerator`() { 16 | NoopFactoryGenerator fulfils ProcessorContract.MockFactoryGenerator::class 17 | } 18 | 19 | @Test 20 | fun `It fulfils MockFactoryEntryPointGenerator`() { 21 | NoopFactoryGenerator fulfils ProcessorContract.MockFactoryEntryPointGenerator::class 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/mock/KMockBuildInFunctionGeneratorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.mock 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class KMockBuildInFunctionGeneratorSpec { 15 | @Test 16 | fun `It fulfils BuildInFunctionGenerator`() { 17 | KMockBuildInMethodGenerator(mockk(), mockk()) fulfils ProcessorContract.BuildInMethodGenerator::class 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/mock/KMockGeneratorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.mock 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class KMockGeneratorSpec { 15 | @Test 16 | fun `It fulfils MockGenerator`() { 17 | KMockGenerator( 18 | mockk(), 19 | false, 20 | false, 21 | mockk(), 22 | mockk(), 23 | mockk(), 24 | mockk(), 25 | mockk(), 26 | mockk(), 27 | mockk(), 28 | mockk(), 29 | mockk(), 30 | mockk(), 31 | mockk(), 32 | mockk(), 33 | ) fulfils ProcessorContract.MockGenerator::class 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/mock/KMockGenericsSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.mock 8 | 9 | import org.junit.jupiter.api.Test 10 | import tech.antibytes.kmock.processor.KMockGenerics 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class KMockGenericsSpec { 15 | @Test 16 | fun `It fulfils FunctionUtils`() { 17 | KMockGenerics fulfils ProcessorContract.GenericResolver::class 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/mock/KMockMethodGeneratorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.mock 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class KMockMethodGeneratorSpec { 15 | @Test 16 | fun `It fulfils MethodGenerator`() { 17 | KMockMethodGenerator( 18 | mockk(), 19 | mockk(), 20 | mockk(), 21 | mockk(), 22 | mockk(), 23 | ) fulfils ProcessorContract.MethodGenerator::class 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/mock/KMockNonIntrusiveInvocationGeneratorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.mock 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract.NonIntrusiveInvocationGenerator 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class KMockNonIntrusiveInvocationGeneratorSpec { 15 | @Test 16 | fun `It fulfils NonIntrusiveInvocationGenerator`() { 17 | KMockNonIntrusiveInvocationGenerator(mockk(), mockk()) fulfils NonIntrusiveInvocationGenerator::class 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/mock/KMockPropertyGeneratorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.mock 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class KMockPropertyGeneratorSpec { 15 | @Test 16 | fun `It fulfils PropertyGenerator`() { 17 | KMockPropertyGenerator(mockk(), mockk()) fulfils ProcessorContract.PropertyGenerator::class 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/mock/KMockProxyNameSelectorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.mock 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class KMockProxyNameSelectorSpec { 15 | @Test 16 | fun `It fulfils ProxyNameCollector`() { 17 | KMockProxyNameSelector(false, mockk(), mockk()) fulfils ProcessorContract.ProxyNameCollector::class 18 | } 19 | 20 | @Test 21 | fun `It fulfils ProxyNameSelector`() { 22 | KMockProxyNameSelector(false, mockk(), mockk()) fulfils ProcessorContract.ProxyNameSelector::class 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/mock/KMockReceiverGeneratorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.mock 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class KMockReceiverGeneratorSpec { 15 | @Test 16 | fun `It fulfils ReceiverGenerator`() { 17 | KMockReceiverGenerator( 18 | mockk(), 19 | mockk(), 20 | mockk(), 21 | mockk(), 22 | ) fulfils ProcessorContract.ReceiverGenerator::class 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/mock/KMockRelaxerGeneratorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.mock 8 | 9 | import org.junit.jupiter.api.Test 10 | import tech.antibytes.kmock.processor.ProcessorContract 11 | import tech.antibytes.util.test.fulfils 12 | 13 | class KMockRelaxerGeneratorSpec { 14 | @Test 15 | fun `It fulfils RelaxerGenerator`() { 16 | KMockRelaxerGenerator() fulfils ProcessorContract.RelaxerGenerator::class 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/mock/KMockSpyGeneratorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.mock 8 | 9 | import org.junit.jupiter.api.Test 10 | import tech.antibytes.kmock.processor.ProcessorContract 11 | import tech.antibytes.util.test.fulfils 12 | 13 | class KMockSpyGeneratorSpec { 14 | @Test 15 | fun `It fulfils SpyGenerator`() { 16 | KMockSpyGenerator fulfils ProcessorContract.SpyGenerator::class 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/mock/MethodGeneratorHelperSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.mock 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class MethodGeneratorHelperSpec { 15 | @Test 16 | fun `It fulfils MethodeGeneratorHelper`() { 17 | MethodGeneratorHelper(mockk()) fulfils ProcessorContract.MethodGeneratorHelper::class 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/mock/ProxyAccessMethodGeneratorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.mock 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract.ProxyAccessMethodGenerator 12 | import tech.antibytes.kmock.processor.ProcessorContract.ProxyAccessMethodGeneratorFactory 13 | import tech.antibytes.util.test.fulfils 14 | 15 | class ProxyAccessMethodGeneratorSpec { 16 | @Test 17 | fun `It fulfils ProxyAccessMethodGeneratorFactory`() { 18 | KMockProxyAccessMethodGenerator fulfils ProxyAccessMethodGeneratorFactory::class 19 | } 20 | 21 | @Test 22 | fun `Given getInstance is called with a Boolean it creates a ProxyAccessMethodGenerator`() { 23 | KMockProxyAccessMethodGenerator.getInstance( 24 | false, 25 | mockk(), 26 | mockk(), 27 | mockk(), 28 | ) fulfils ProxyAccessMethodGenerator::class 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/multi/MultiInterfaceBinderSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.processor.multi 8 | 9 | import io.mockk.mockk 10 | import org.junit.jupiter.api.Test 11 | import tech.antibytes.kmock.processor.ProcessorContract 12 | import tech.antibytes.util.test.fulfils 13 | 14 | class MultiInterfaceBinderSpec { 15 | @Test 16 | fun `It fulfils MultiInterfaceBinder`() { 17 | KMockMultiInterfaceBinder( 18 | mockk(), 19 | mockk(), 20 | "any", 21 | mockk(), 22 | ) fulfils ProcessorContract.MultiInterfaceBinder::class 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/alias/CommonActual.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | 9 | private inline fun getMockInstance( 10 | spyOn: SpyOn?, 11 | collector: KMockContract.Collector, 12 | relaxed: Boolean, 13 | relaxUnitFun: Boolean, 14 | freeze: Boolean, 15 | ): Mock = when (Mock::class) { 16 | factory.template.alias.AliasCommonMock::class -> factory.template.alias.AliasCommonMock(collector 17 | = collector, relaxUnitFun = relaxUnitFun, freeze = freeze, spyOn = spyOn as 18 | factory.template.alias.Common?) as Mock 19 | else -> throw RuntimeException("Unknown Interface ${Mock::class.simpleName}.") 20 | } 21 | 22 | internal actual inline fun kmock( 23 | collector: KMockContract.Collector, 24 | relaxed: Boolean, 25 | relaxUnitFun: Boolean, 26 | freeze: Boolean, 27 | ): Mock = getMockInstance( 28 | spyOn = null, 29 | collector = collector, 30 | relaxed = relaxed, 31 | relaxUnitFun = relaxUnitFun, 32 | freeze = freeze, 33 | ) 34 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/alias/CommonExpect.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | import tech.antibytes.kmock.proxy.NoopCollector 9 | 10 | internal expect inline fun kmock( 11 | collector: KMockContract.Collector = NoopCollector, 12 | relaxed: Boolean = false, 13 | relaxUnitFun: Boolean = false, 14 | freeze: Boolean = false, 15 | ): Mock 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/customshared/SharedExpect.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import factory.template.customshared.Shared1 6 | import kotlin.Any 7 | import kotlin.Boolean 8 | import kotlin.Comparable 9 | import kotlin.Suppress 10 | import kotlin.reflect.KClass 11 | import tech.antibytes.kmock.KMockContract 12 | import tech.antibytes.kmock.proxy.NoopCollector 13 | 14 | internal expect inline fun , K : Any, L> kmock( 15 | collector: KMockContract.Collector = NoopCollector, 16 | relaxed: Boolean = false, 17 | relaxUnitFun: Boolean = false, 18 | freeze: Boolean = false, 19 | templateType: KClass>, 20 | ): Mock where L : Any, L : Comparable 21 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/freeze/CommonExpect.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | import tech.antibytes.kmock.proxy.NoopCollector 9 | 10 | internal expect inline fun kmock( 11 | collector: KMockContract.Collector = NoopCollector, 12 | relaxed: Boolean = false, 13 | relaxUnitFun: Boolean = false, 14 | freeze: Boolean = false, 15 | ): Mock 16 | 17 | internal expect inline fun kspy( 18 | spyOn: SpyOn, 19 | collector: KMockContract.Collector = NoopCollector, 20 | freeze: Boolean = false, 21 | ): Mock 22 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/generic/CommonExpect.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import factory.template.generic.Common 6 | import kotlin.Any 7 | import kotlin.Boolean 8 | import kotlin.Comparable 9 | import kotlin.Suppress 10 | import kotlin.reflect.KClass 11 | import tech.antibytes.kmock.KMockContract 12 | import tech.antibytes.kmock.proxy.NoopCollector 13 | 14 | internal expect inline fun kmock( 15 | collector: KMockContract.Collector = NoopCollector, 16 | relaxed: Boolean = false, 17 | relaxUnitFun: Boolean = false, 18 | freeze: Boolean = false, 19 | ): Mock 20 | 21 | internal expect inline fun , K : Any, L> kmock( 22 | collector: KMockContract.Collector = NoopCollector, 23 | relaxed: Boolean = false, 24 | relaxUnitFun: Boolean = false, 25 | freeze: Boolean = false, 26 | templateType: KClass>, 27 | ): Mock where L : Any, L : Comparable 28 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/generic/Shared1Expect.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import factory.template.generic.Shared1 6 | import factory.template.generic.Shared2 7 | import kotlin.Any 8 | import kotlin.Boolean 9 | import kotlin.Comparable 10 | import kotlin.Suppress 11 | import kotlin.reflect.KClass 12 | import tech.antibytes.kmock.KMockContract 13 | import tech.antibytes.kmock.proxy.NoopCollector 14 | 15 | internal expect inline fun , K : Any, L> kmock( 16 | collector: KMockContract.Collector = NoopCollector, 17 | relaxed: Boolean = false, 18 | relaxUnitFun: Boolean = false, 19 | freeze: Boolean = false, 20 | templateType: KClass>, 21 | ): Mock where L : Any, L : Comparable 22 | 23 | internal expect inline fun , K : Any, L> kmock( 24 | collector: KMockContract.Collector = NoopCollector, 25 | relaxed: Boolean = false, 26 | relaxUnitFun: Boolean = false, 27 | freeze: Boolean = false, 28 | templateType: KClass>, 29 | ): Mock where L : Any, L : Comparable 30 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/generic/Shared2Expect.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import factory.template.generic.Shared3 6 | import kotlin.Any 7 | import kotlin.Boolean 8 | import kotlin.Comparable 9 | import kotlin.Suppress 10 | import kotlin.reflect.KClass 11 | import tech.antibytes.kmock.KMockContract 12 | import tech.antibytes.kmock.proxy.NoopCollector 13 | 14 | internal expect inline fun , K : Any, L> kmock( 15 | collector: KMockContract.Collector = NoopCollector, 16 | relaxed: Boolean = false, 17 | relaxUnitFun: Boolean = false, 18 | freeze: Boolean = false, 19 | templateType: KClass>, 20 | ): Mock where L : Any, L : Comparable 21 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/nocommon/CommonExpect.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | import tech.antibytes.kmock.proxy.NoopCollector 9 | 10 | internal expect inline fun kmock( 11 | collector: KMockContract.Collector = NoopCollector, 12 | relaxed: Boolean = false, 13 | relaxUnitFun: Boolean = false, 14 | freeze: Boolean = false, 15 | ): Mock 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/regular/CommonActual.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | 9 | private inline fun getMockInstance( 10 | spyOn: SpyOn?, 11 | collector: KMockContract.Collector, 12 | relaxed: Boolean, 13 | relaxUnitFun: Boolean, 14 | freeze: Boolean, 15 | ): Mock = when (Mock::class) { 16 | factory.template.regular.CommonMock::class -> factory.template.regular.CommonMock(collector = 17 | collector, relaxUnitFun = relaxUnitFun, freeze = freeze, spyOn = spyOn as 18 | factory.template.regular.Common?) as Mock 19 | else -> throw RuntimeException("Unknown Interface ${Mock::class.simpleName}.") 20 | } 21 | 22 | internal actual inline fun kmock( 23 | collector: KMockContract.Collector, 24 | relaxed: Boolean, 25 | relaxUnitFun: Boolean, 26 | freeze: Boolean, 27 | ): Mock = getMockInstance( 28 | spyOn = null, 29 | collector = collector, 30 | relaxed = relaxed, 31 | relaxUnitFun = relaxUnitFun, 32 | freeze = freeze, 33 | ) 34 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/regular/CommonExpect.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | import tech.antibytes.kmock.proxy.NoopCollector 9 | 10 | internal expect inline fun kmock( 11 | collector: KMockContract.Collector = NoopCollector, 12 | relaxed: Boolean = false, 13 | relaxUnitFun: Boolean = false, 14 | freeze: Boolean = false, 15 | ): Mock 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/relaxed/CommonActual.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | 9 | private inline fun getMockInstance( 10 | spyOn: SpyOn?, 11 | collector: KMockContract.Collector, 12 | relaxed: Boolean, 13 | relaxUnitFun: Boolean, 14 | freeze: Boolean, 15 | ): Mock = when (Mock::class) { 16 | factory.template.relaxed.CommonMock::class -> factory.template.relaxed.CommonMock(collector = 17 | collector, relaxed = relaxed, relaxUnitFun = relaxUnitFun, freeze = freeze, spyOn = spyOn as 18 | factory.template.relaxed.Common?) as Mock 19 | else -> throw RuntimeException("Unknown Interface ${Mock::class.simpleName}.") 20 | } 21 | 22 | internal actual inline fun kmock( 23 | collector: KMockContract.Collector, 24 | relaxed: Boolean, 25 | relaxUnitFun: Boolean, 26 | freeze: Boolean, 27 | ): Mock = getMockInstance( 28 | spyOn = null, 29 | collector = collector, 30 | relaxed = relaxed, 31 | relaxUnitFun = relaxUnitFun, 32 | freeze = freeze, 33 | ) 34 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/relaxed/CommonExpect.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | import tech.antibytes.kmock.proxy.NoopCollector 9 | 10 | internal expect inline fun kmock( 11 | collector: KMockContract.Collector = NoopCollector, 12 | relaxed: Boolean = false, 13 | relaxUnitFun: Boolean = false, 14 | freeze: Boolean = false, 15 | ): Mock 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/spiesonly/CommonExpect.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import factory.template.spiesonly.Common1 6 | import kotlin.Any 7 | import kotlin.Boolean 8 | import kotlin.Comparable 9 | import kotlin.Suppress 10 | import kotlin.reflect.KClass 11 | import tech.antibytes.kmock.KMockContract 12 | import tech.antibytes.kmock.proxy.NoopCollector 13 | 14 | internal expect inline fun kspy( 15 | spyOn: SpyOn, 16 | collector: KMockContract.Collector = NoopCollector, 17 | freeze: Boolean = false, 18 | ): Mock 19 | 20 | internal expect inline fun , K : Any, L> kspy( 21 | spyOn: SpyOn, 22 | collector: KMockContract.Collector = NoopCollector, 23 | freeze: Boolean = false, 24 | templateType: KClass>, 25 | ): Mock where L : Any, L : Comparable 26 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/spiesonly/SharedExpect.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import factory.template.spiesonly.Shared1 6 | import kotlin.Any 7 | import kotlin.Boolean 8 | import kotlin.Comparable 9 | import kotlin.Suppress 10 | import kotlin.reflect.KClass 11 | import tech.antibytes.kmock.KMockContract 12 | import tech.antibytes.kmock.proxy.NoopCollector 13 | 14 | internal expect inline fun , K : Any, L> kspy( 15 | spyOn: SpyOn, 16 | collector: KMockContract.Collector = NoopCollector, 17 | freeze: Boolean = false, 18 | templateType: KClass>, 19 | ): Mock where L : Any, L : Comparable 20 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/expected/spy/SharedExpect.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package generatorTest 4 | 5 | import factory.template.spy.Shared1 6 | import kotlin.Any 7 | import kotlin.Boolean 8 | import kotlin.Comparable 9 | import kotlin.Suppress 10 | import kotlin.reflect.KClass 11 | import tech.antibytes.kmock.KMockContract 12 | import tech.antibytes.kmock.proxy.NoopCollector 13 | 14 | internal expect inline fun , K : Any, L> kmock( 15 | collector: KMockContract.Collector = NoopCollector, 16 | relaxed: Boolean = false, 17 | relaxUnitFun: Boolean = false, 18 | freeze: Boolean = false, 19 | templateType: KClass>, 20 | ): Mock where L : Any, L : Comparable 21 | 22 | internal expect inline fun , K : Any, L> kspy( 23 | spyOn: SpyOn, 24 | collector: KMockContract.Collector = NoopCollector, 25 | freeze: Boolean = false, 26 | templateType: KClass>, 27 | ): Mock where L : Any, L : Comparable 28 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/alias/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.alias 8 | 9 | import tech.antibytes.kmock.MockCommon 10 | 11 | @MockCommon(Common::class) 12 | interface Common { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | var buzz: Any 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/alias/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.alias 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(Platform::class) 12 | interface Platform { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | var buzz: Any 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/freeze/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.freeze 8 | 9 | import tech.antibytes.kmock.MockCommon 10 | 11 | @MockCommon(Common::class) 12 | interface Common { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | var buzz: Any 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/freeze/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.freeze 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(Platform::class) 12 | interface Platform { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | var buzz: Any 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/mixed/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.mixed 8 | 9 | interface Common where L: Comparable, L: CharSequence { 10 | val bar: L 11 | } 12 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/mixed/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.mixed 8 | 9 | import tech.antibytes.kmock.Mock 10 | import tech.antibytes.kmock.MockCommon 11 | import tech.antibytes.kmock.MockShared 12 | 13 | @MockCommon(Common::class) 14 | @MockShared( 15 | "sharedTest", 16 | Shared::class 17 | ) 18 | @Mock(Platform::class) 19 | interface Platform { 20 | val foo: P 21 | } 22 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/mixed/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.mixed 8 | 9 | interface Shared { 10 | var buzz: K 11 | } 12 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/nocommon/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.nocommon 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(Platform::class) 12 | interface Platform { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | var buzz: Any 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/nocommon/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.nocommon 8 | 9 | import tech.antibytes.kmock.MockShared 10 | 11 | @MockShared("sharedTest", Shared::class) 12 | interface Shared { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | var buzz: Any 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/nofactory/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.nofactory 8 | 9 | import tech.antibytes.kmock.MockCommon 10 | 11 | @MockCommon(Common::class) 12 | interface Common { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | var buzz: Any 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/nofactory/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.nofactory 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(Platform::class) 12 | interface Platform { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | var buzz: Any 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/regular/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.regular 8 | 9 | import tech.antibytes.kmock.MockCommon 10 | 11 | @MockCommon(Common::class) 12 | interface Common { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | var buzz: Any 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/regular/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.regular 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(Platform::class) 12 | interface Platform { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | var buzz: Any 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/relaxed/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.relaxed 8 | 9 | import tech.antibytes.kmock.MockCommon 10 | import tech.antibytes.kmock.Relaxer 11 | 12 | @Relaxer 13 | internal inline fun relaxed(id: String): T { 14 | return id as T 15 | } 16 | 17 | @MockCommon(Common::class) 18 | interface Common { 19 | val buzz: String 20 | 21 | fun foo(payload: Any): String 22 | suspend fun bar(payload: Any): String 23 | fun buzz() 24 | } 25 | 26 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/factory/template/relaxed/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package factory.template.relaxed 8 | 9 | import tech.antibytes.kmock.Mock 10 | import tech.antibytes.kmock.Relaxer 11 | 12 | @Relaxer 13 | internal inline fun relaxed(id: String): T { 14 | return id as T 15 | } 16 | 17 | @Mock(Platform::class) 18 | interface Platform { 19 | val buzz: String 20 | 21 | fun foo(payload: Any): String 22 | suspend fun bar(payload: Any): String 23 | fun buzz() 24 | } 25 | 26 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/expected/mixedannotation/Common.kt: -------------------------------------------------------------------------------- 1 | package mock.template.mixedannotation 2 | 3 | import kotlin.Boolean 4 | import kotlin.Suppress 5 | import kotlin.Unit 6 | import tech.antibytes.kmock.KMockContract 7 | import tech.antibytes.kmock.proxy.NoopCollector 8 | import tech.antibytes.kmock.proxy.ProxyFactory 9 | 10 | internal class CommonMock( 11 | collector: KMockContract.Collector = NoopCollector, 12 | @Suppress("UNUSED_PARAMETER") 13 | spyOn: Common? = null, 14 | freeze: Boolean = false, 15 | @Suppress("unused") 16 | private val relaxUnitFun: Boolean = false, 17 | @Suppress("unused") 18 | private val relaxed: Boolean = false, 19 | ) : Common { 20 | public val _doSomething: KMockContract.SyncFunProxy Unit> = 21 | ProxyFactory.createSyncFunProxy("mock.template.mixedannotation.CommonMock#_doSomething", 22 | collector = collector, freeze = freeze) 23 | 24 | public override fun doSomething(): Unit = _doSomething.invoke() { 25 | useUnitFunRelaxerIf(relaxUnitFun || relaxed) 26 | } 27 | 28 | public fun _clearMock() { 29 | _doSomething.clear() 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/expected/mixedannotation/Platform.kt: -------------------------------------------------------------------------------- 1 | package mock.template.mixedannotation 2 | 3 | import kotlin.Boolean 4 | import kotlin.Suppress 5 | import kotlin.Unit 6 | import tech.antibytes.kmock.KMockContract 7 | import tech.antibytes.kmock.proxy.NoopCollector 8 | import tech.antibytes.kmock.proxy.ProxyFactory 9 | 10 | internal class PlatformMock( 11 | collector: KMockContract.Collector = NoopCollector, 12 | @Suppress("UNUSED_PARAMETER") 13 | spyOn: Platform? = null, 14 | freeze: Boolean = false, 15 | @Suppress("unused") 16 | private val relaxUnitFun: Boolean = false, 17 | @Suppress("unused") 18 | private val relaxed: Boolean = false, 19 | ) : Platform { 20 | public val _doSomething: KMockContract.SyncFunProxy Unit> = 21 | ProxyFactory.createSyncFunProxy("mock.template.mixedannotation.PlatformMock#_doSomething", 22 | collector = collector, freeze = freeze) 23 | 24 | public override fun doSomething(): Unit = _doSomething.invoke() { 25 | useUnitFunRelaxerIf(relaxUnitFun || relaxed) 26 | } 27 | 28 | public fun _clearMock() { 29 | _doSomething.clear() 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/expected/mixedannotation/Shared.kt: -------------------------------------------------------------------------------- 1 | package mock.template.mixedannotation 2 | 3 | import kotlin.Boolean 4 | import kotlin.Suppress 5 | import kotlin.Unit 6 | import tech.antibytes.kmock.KMockContract 7 | import tech.antibytes.kmock.proxy.NoopCollector 8 | import tech.antibytes.kmock.proxy.ProxyFactory 9 | 10 | internal class SharedMock( 11 | collector: KMockContract.Collector = NoopCollector, 12 | @Suppress("UNUSED_PARAMETER") 13 | spyOn: Shared? = null, 14 | freeze: Boolean = false, 15 | @Suppress("unused") 16 | private val relaxUnitFun: Boolean = false, 17 | @Suppress("unused") 18 | private val relaxed: Boolean = false, 19 | ) : Shared { 20 | public val _doSomething: KMockContract.SyncFunProxy Unit> = 21 | ProxyFactory.createSyncFunProxy("mock.template.mixedannotation.SharedMock#_doSomething", 22 | collector = collector, freeze = freeze) 23 | 24 | public override fun doSomething(): Unit = _doSomething.invoke() { 25 | useUnitFunRelaxerIf(relaxUnitFun || relaxed) 26 | } 27 | 28 | public fun _clearMock() { 29 | _doSomething.clear() 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/expected/typealiaz/Common.kt: -------------------------------------------------------------------------------- 1 | package mock.template.typealiaz 2 | 3 | import kotlin.Any 4 | import kotlin.Boolean 5 | import kotlin.Suppress 6 | import tech.antibytes.kmock.KMockContract 7 | import tech.antibytes.kmock.proxy.NoopCollector 8 | import tech.antibytes.kmock.proxy.ProxyFactory 9 | 10 | internal class CommonMock( 11 | collector: KMockContract.Collector = NoopCollector, 12 | @Suppress("UNUSED_PARAMETER") 13 | spyOn: Common? = null, 14 | freeze: Boolean = false, 15 | @Suppress("unused") 16 | private val relaxUnitFun: Boolean = false, 17 | @Suppress("unused") 18 | private val relaxed: Boolean = false, 19 | ) : Common { 20 | public val _doSomething: KMockContract.SyncFunProxy Any> = ProxyFactory.createSyncFunProxy("mock.template.typealiaz.CommonMock#_doSomething", 25 | collector = collector, freeze = freeze) 26 | 27 | public override fun doSomething( 28 | arg0: Any, 29 | arg1: Alias0, 30 | arg2: Alias1, 31 | ): Any = _doSomething.invoke(arg0, arg1, arg2) 32 | 33 | public fun _clearMock() { 34 | _doSomething.clear() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/expected/typealiaz/Shared.kt: -------------------------------------------------------------------------------- 1 | package mock.template.typealiaz 2 | 3 | import kotlin.Any 4 | import kotlin.Boolean 5 | import kotlin.Suppress 6 | import tech.antibytes.kmock.KMockContract 7 | import tech.antibytes.kmock.proxy.NoopCollector 8 | import tech.antibytes.kmock.proxy.ProxyFactory 9 | 10 | internal class SharedMock( 11 | collector: KMockContract.Collector = NoopCollector, 12 | @Suppress("UNUSED_PARAMETER") 13 | spyOn: Shared? = null, 14 | freeze: Boolean = false, 15 | @Suppress("unused") 16 | private val relaxUnitFun: Boolean = false, 17 | @Suppress("unused") 18 | private val relaxed: Boolean = false, 19 | ) : Shared { 20 | public val _doSomething: KMockContract.SyncFunProxy Any> = ProxyFactory.createSyncFunProxy("mock.template.typealiaz.SharedMock#_doSomething", 25 | collector = collector, freeze = freeze) 26 | 27 | public override fun doSomething( 28 | arg0: Any, 29 | arg1: Alias00, 30 | arg2: Alias01, 31 | ): Any = _doSomething.invoke(arg0, arg1, arg2) 32 | 33 | public fun _clearMock() { 34 | _doSomething.clear() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/access/AsyncFun.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.access 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(AsyncFun::class) 12 | interface AsyncFun where T : CharSequence, T : Comparable { 13 | suspend fun foo(fuzz: Int, ozz: Any): dynamic 14 | 15 | suspend fun bar(buzz: Int, bozz: Any): Any = bozz 16 | 17 | suspend fun ozz(vararg buzz: Int): Any 18 | 19 | suspend fun izz(vararg buzz: L): Any 20 | 21 | suspend fun uzz() 22 | 23 | suspend fun tuz(): Int 24 | 25 | suspend fun uz(): L 26 | 27 | suspend fun tzz(): T 28 | 29 | suspend fun lol(arg: T): T 30 | suspend fun fol(): T 31 | 32 | suspend fun veryLongMethodNameWithABunchOfVariables( 33 | arg0: Int, 34 | arg1: Int, 35 | arg2: Int, 36 | arg3: Int, 37 | arg4: Int, 38 | arg5: Int, 39 | arg6: Int, 40 | arg7: L, 41 | arg8: Int, 42 | arg9: T 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/access/BuildIn.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.access 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(BuildIn::class) 12 | interface BuildIn { 13 | fun foo(fuzz: Int, ozz: Any): Any 14 | } 15 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/access/Property.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.access 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(Property::class) 12 | interface Property where T : CharSequence, T : Comparable { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | val uzz: String 18 | val izz: L 19 | 20 | val tuz: T 21 | 22 | 23 | var buzz: Any 24 | } 25 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/access/SyncFun.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.access 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(SyncFun::class) 12 | interface SyncFun where T : CharSequence, T : Comparable { 13 | fun foo(fuzz: Int, ozz: Any): dynamic 14 | 15 | fun bar(buzz: Int, bozz: Any): Any = bozz 16 | 17 | fun ozz(vararg buzz: Int): Any 18 | 19 | fun izz(vararg buzz: Any): Any 20 | 21 | fun uzz() 22 | 23 | fun tuz(): Int 24 | 25 | fun uz(): L 26 | 27 | fun tzz(): T 28 | 29 | fun lol(arg: T): T 30 | fun fol(): T 31 | 32 | fun veryLongMethodNameWithABunchOfVariables( 33 | arg0: Int, 34 | arg1: Int, 35 | arg2: Int, 36 | arg3: Int, 37 | arg4: Int, 38 | arg5: Int, 39 | arg6: Int, 40 | arg7: Int, 41 | arg8: Int, 42 | arg9: Int 43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/alias/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.alias 8 | 9 | import mock.template.generic.Common 10 | import tech.antibytes.kmock.MockCommon 11 | 12 | @MockCommon(Common::class) 13 | interface Common { 14 | suspend fun foo(fuzz: Int, ozz: Any): Any 15 | 16 | fun bar(buzz: Int, bozz: Any): Any = bozz 17 | } 18 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/alias/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.alias 8 | 9 | import mock.template.generic.Platform 10 | import tech.antibytes.kmock.Mock 11 | 12 | @Mock(Platform::class) 13 | interface Platform { 14 | suspend fun foo(fuzz: Int, ozz: Any): dynamic 15 | 16 | fun bar(buzz: Int, bozz: Any): Any = bozz 17 | } 18 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/alias/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.alias 8 | 9 | import mock.template.generic.Shared 10 | import tech.antibytes.kmock.MockShared 11 | 12 | @MockShared("shared", Shared::class) 13 | interface Shared { 14 | suspend fun foo(fuzz: Int, ozz: Any): Any 15 | 16 | fun bar(buzz: Int, bozz: Any): Any = bozz 17 | } 18 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/async/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.async 8 | 9 | import mock.template.generic.Common 10 | import tech.antibytes.kmock.MockCommon 11 | 12 | @MockCommon(Common::class) 13 | interface Common { 14 | suspend fun foo(fuzz: Int, ozz: Any): Any 15 | 16 | suspend fun bar(buzz: Int, bozz: Any): Any = bozz 17 | 18 | suspend fun ozz(vararg buzz: Int): Any 19 | 20 | suspend fun izz(vararg buzz: Any): Any 21 | } 22 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/async/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.async 8 | 9 | import mock.template.generic.Platform 10 | import tech.antibytes.kmock.Mock 11 | 12 | @Mock(Platform::class) 13 | interface Platform { 14 | suspend fun foo(fuzz: Int, ozz: Any): dynamic 15 | 16 | suspend fun bar(buzz: Int, bozz: Any): Any = bozz 17 | 18 | suspend fun ozz(vararg buzz: Int): Any 19 | 20 | suspend fun izz(vararg buzz: Any): Any 21 | } 22 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/async/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.async 8 | 9 | import mock.template.generic.Shared 10 | import tech.antibytes.kmock.MockShared 11 | 12 | @MockShared("shared", Shared::class) 13 | interface Shared { 14 | suspend fun foo(fuzz: Int, ozz: Any): Any 15 | 16 | suspend fun bar(buzz: Int, bozz: Any): Any = bozz 17 | } 18 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/buildIn/Collision.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.buildIn 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(Collision::class) 12 | interface Collision { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | val hashCode: String 18 | 19 | var buzz: Any 20 | } 21 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/buildIn/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.buildIn 8 | 9 | import tech.antibytes.kmock.MockCommon 10 | 11 | @MockCommon(Common::class) 12 | interface Common { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | var buzz: Any 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/buildIn/NoBuildIns.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.buildIn 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(NoBuildIns::class) 12 | interface NoBuildIns { 13 | fun equals(other: Int) 14 | fun toString(radix: Int): String 15 | fun hashCode(base: Any): Int 16 | } 17 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/buildIn/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.buildIn 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(Platform::class) 12 | interface Platform { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | var buzz: Any 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/buildIn/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.buildIn 8 | 9 | import tech.antibytes.kmock.MockShared 10 | 11 | @MockShared("sharedTest", Shared::class) 12 | interface Shared { 13 | val foo: String 14 | val bar: Int 15 | get() = foo.length 16 | 17 | var buzz: Any 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/customshared/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.customshared 8 | 9 | import mock.template.async.Shared 10 | import tech.antibytes.kmock.MockShared 11 | import kotlin.reflect.KClass 12 | 13 | annotation class CustomShared(vararg val interfaces: KClass<*>) 14 | 15 | @CustomShared(Shared::class) 16 | interface Shared { 17 | fun foo(fuzz: Int, ozz: Any): Any 18 | 19 | fun bar(buzz: Int, bozz: Any): Any = bozz 20 | } 21 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/kmock/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.kmock 8 | 9 | import tech.antibytes.kmock.KMock 10 | import tech.antibytes.kmock.KMockExperimental 11 | 12 | @OptIn(KMockExperimental::class) 13 | @KMock(Common::class) 14 | interface Common { 15 | suspend fun foo(fuzz: Int, ozz: Any): Any 16 | 17 | suspend fun bar(buzz: Int, bozz: Any): Any = bozz 18 | 19 | suspend fun ozz(vararg buzz: Int): Any 20 | 21 | suspend fun izz(vararg buzz: Any): Any 22 | } 23 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/kmock/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.kmock 8 | 9 | import tech.antibytes.kmock.KMock 10 | import tech.antibytes.kmock.KMockExperimental 11 | 12 | @OptIn(KMockExperimental::class) 13 | @KMock(Platform::class) 14 | interface Platform { 15 | val foo: String 16 | val bar: Int 17 | get() = foo.length 18 | 19 | var buzz: Any 20 | } 21 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/kmock/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.kmock 8 | 9 | import tech.antibytes.kmock.KMock 10 | import tech.antibytes.kmock.KMockExperimental 11 | 12 | @OptIn(KMockExperimental::class) 13 | @KMock(Shared::class) 14 | interface Shared { 15 | fun foo(fuzz: Int, ozz: Any): Any 16 | 17 | fun bar(buzz: Int, bozz: Any): Any = bozz 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/methodreceiver/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.methodreceiver 8 | 9 | import tech.antibytes.kmock.MockCommon 10 | 11 | interface Something 12 | 13 | interface SomethingElse 14 | 15 | interface AnythingElse { 16 | interface SomethingInside 17 | } 18 | 19 | @MockCommon(Common::class) 20 | interface Common { 21 | fun Something.equals(): Int 22 | fun Something.doSomething(): Int 23 | fun SomethingElse.doSomethingElse(): List 24 | fun Common<*>.mutabor(): Int 25 | fun T.doNothing(): Unit where T : Something, T : Comparable 26 | fun T.doNothing(): Unit where T : Any 27 | fun > T.doNothingElse(a: R, b: X): Unit where T : Something, T : Comparable 28 | fun AnythingElse.SomethingInside.doInside(): Int 29 | 30 | fun iDo() 31 | fun mutabor(x: Common<*>) 32 | fun doNothingElse(a: Any): Any 33 | fun doSomethingElse(x: SomethingElse) 34 | } 35 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/methodreceiver/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.methodreceiver 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | interface Something 12 | 13 | interface SomethingElse 14 | 15 | interface AnythingElse { 16 | interface SomethingInside 17 | } 18 | 19 | @Mock(Platform::class) 20 | interface Platform { 21 | fun Something.equals(): Int 22 | fun Something.doSomething(): Int 23 | fun SomethingElse.doSomethingElse(): List 24 | fun Platform<*>.mutabor(): Int 25 | suspend fun T.doNothing(): Unit where T : Something, T : Comparable 26 | suspend fun T.doNothing(): Unit where T : Any 27 | fun T.doSomethingElse(): L 28 | fun T.doNothingElse(a: R): Unit where T : Something, T : Comparable 29 | fun AnythingElse.SomethingInside.doInside(): Int 30 | 31 | fun iDo() 32 | fun mutabor(x: Platform<*>) 33 | fun doNothingElse(a: Any): Any 34 | fun doSomethingElse(x: SomethingElse) 35 | } 36 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/methodreceiver/Spied.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.methodreceiver 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | interface Something 12 | 13 | interface SomethingElse 14 | 15 | interface AnythingElse { 16 | interface SomethingInside 17 | } 18 | 19 | @Mock(Spied::class) 20 | interface Spied { 21 | fun Something.equals(): Int 22 | fun Something.doSomething(): Int 23 | fun SomethingElse.doSomethingElse(): List 24 | fun Spied<*>.mutabor(): Int 25 | fun T.doNothing(): Unit where T : Something, T : Comparable 26 | fun T.doNothing(): Unit where T : Any 27 | fun T.doSomethingElse(): L 28 | fun T.doNothingElse(a: R): Unit where T : Something, T : Comparable 29 | fun AnythingElse.SomethingInside.doInside(): Int 30 | 31 | fun iDo() 32 | fun mutabor(x: Spied<*>) 33 | fun doNothingElse(a: Any): Any 34 | fun doSomethingElse(x: SomethingElse) 35 | } 36 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/methodreceiver/SuperType.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.methodreceiver 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | interface Something 12 | 13 | interface SomethingElse 14 | 15 | interface AnythingElse { 16 | interface SomethingInside 17 | } 18 | 19 | typealias Arg = (Any) -> Unit 20 | 21 | @Mock(Inherited::class) 22 | interface Inherited

: Platform

23 | 24 | interface Platform { 25 | fun Something.equals(): Int 26 | fun Something.doSomething(): Int 27 | fun SomethingElse.doSomethingElse(): List 28 | fun Platform<*>.mutabor(): Int 29 | suspend fun T.doNothing(): Unit where T : Something, T : Comparable 30 | suspend fun T.doNothing(): Unit where T : Any 31 | fun T.doSomethingElse(): L 32 | fun T.doNothingElse(a: R): Unit where T : Something, T : Comparable 33 | fun AnythingElse.SomethingInside.doInside(): Int 34 | 35 | fun iDo() 36 | fun mutabor(x: Platform<*>) 37 | fun doNothingElse(a: Any): Any 38 | fun doSomethingElse(x: SomethingElse) 39 | } 40 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/mixedannotation/Sample.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.mixedannotation 8 | 9 | import tech.antibytes.kmock.Mock 10 | import tech.antibytes.kmock.MockShared 11 | import tech.antibytes.kmock.MockCommon 12 | 13 | @MockCommon(Common::class) 14 | @MockShared( 15 | "sharedTest", 16 | Shared::class 17 | ) 18 | @Mock(Platform::class) 19 | interface Platform { 20 | fun doSomething() 21 | } 22 | 23 | interface Shared { 24 | fun doSomething() 25 | } 26 | 27 | interface Common { 28 | fun doSomething() 29 | } 30 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/overloaded/Collision.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.overloaded 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(Collision::class) 12 | interface Collision { 13 | val foo: Any 14 | var hashCode: Int 15 | fun foo(fuzz: Int, ozz: dynamic): Any 16 | fun foo(fuzz: Any, ozz: Int): Any 17 | fun foo(fuzz: Any, ozz: String): Any 18 | fun foo(fuzz: String, ozz: Any): Any 19 | fun foo(fuzz: String, ozz: Abc): Any 20 | fun foo(fuzz: String, ozz: Scope.Abc): Any 21 | fun foo(fuzz: (Any) -> Unit): Any 22 | fun foo(fuzz: T) 23 | fun foo(fuzz: T) 24 | fun foo(fuzz: T) 25 | fun foo(vararg fuzz: Any): Any 26 | } 27 | 28 | data class Abc( 29 | val value: String 30 | ) 31 | 32 | interface Scope { 33 | data class Abc( 34 | val value: String 35 | ) 36 | } 37 | 38 | interface LPG 39 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/overloaded/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.overloaded 8 | 9 | import tech.antibytes.kmock.MockCommon 10 | 11 | @MockCommon(Common::class) 12 | interface Common { 13 | val foo: Any 14 | var hashCode: Int 15 | fun foo(fuzz: Int, ozz: dynamic): Any 16 | fun foo(fuzz: Any, ozz: Int): Any 17 | fun foo(fuzz: Any, ozz: String): Any 18 | fun foo(fuzz: String, ozz: Any): Any 19 | fun foo(fuzz: String, ozz: Abc): Any 20 | fun foo(fuzz: (Any) -> Unit): Any 21 | fun foo(fuzz: T) 22 | fun foo(fuzz: T) 23 | fun foo(fuzz: T) 24 | fun foo(vararg fuzz: Any): Any 25 | } 26 | 27 | data class Abc( 28 | val value: String 29 | ) 30 | 31 | interface LPG 32 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/overloaded/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.overloaded 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(Platform::class) 12 | interface Platform> { 13 | val foo: Any 14 | var hashCode: Int 15 | fun foo(fuzz: Int, ozz: Any): Any 16 | fun foo(fuzz: Any?, ozz: Int): Any 17 | fun foo(fuzz: Any, ozz: String): Any 18 | fun foo(fuzz: String, ozz: Any): Any 19 | fun foo(fuzz: String, ozz: Abc): Any 20 | fun foo(fuzz: (Any) -> Unit): Any 21 | fun foo(fuzz: T) 22 | fun > foo(fuzz: T) 23 | fun foo(fuzz: T) 24 | fun foo(fuzz: T?): Any where T : CharSequence?, T : Comparable 25 | fun foo(vararg fuzz: Any): Any 26 | fun foo(arg: Q) 27 | fun foo(arg0: T, arg1: String) 28 | fun foo(arg0: T, arg1: Q) where Q : CharSequence, Q : Comparable? 29 | } 30 | 31 | data class Abc( 32 | val value: String 33 | ) 34 | 35 | interface LPG 36 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/overloaded/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.overloaded 8 | 9 | import tech.antibytes.kmock.MockShared 10 | 11 | @MockShared( 12 | "sharedTest", 13 | Shared::class 14 | ) 15 | interface Shared { 16 | val foo: Any 17 | var hashCode: Int 18 | fun foo(fuzz: Int, ozz: Any): Any 19 | fun foo(fuzz: Any, ozz: Int): Any 20 | fun foo(fuzz: Any, ozz: String): Any 21 | fun foo(fuzz: String, ozz: Any): Any 22 | fun foo(fuzz: String, ozz: Abc): Any 23 | fun foo(fuzz: (Any) -> Unit): Any 24 | fun foo(fuzz: T) 25 | fun foo(fuzz: T) 26 | fun foo(fuzz: T) 27 | fun foo(fuzz: T) 28 | fun foo(fuzz: Array) 29 | } 30 | 31 | data class Abc( 32 | val value: String 33 | ) 34 | 35 | interface LPG 36 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/property/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.property 8 | 9 | import mock.template.async.Common 10 | import tech.antibytes.kmock.MockCommon 11 | 12 | @MockCommon(Common::class) 13 | interface Common { 14 | val foo: String 15 | val bar: Int 16 | get() = foo.length 17 | 18 | var buzz: Any 19 | } 20 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/property/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.property 8 | 9 | import mock.template.async.Platform 10 | import tech.antibytes.kmock.Mock 11 | 12 | @Mock(Platform::class) 13 | interface Platform { 14 | val foo: String 15 | val bar: Int 16 | get() = foo.length 17 | 18 | var buzz: Any 19 | val boo: Enum<*> 20 | } 21 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/property/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.property 8 | 9 | import mock.template.async.Shared 10 | import tech.antibytes.kmock.MockShared 11 | 12 | @MockShared("sharedTest", Shared::class) 13 | interface Shared { 14 | val foo: String 15 | val bar: Int 16 | get() = foo.length 17 | 18 | val enum: Enum<*> 19 | var buzz: Any 20 | } 21 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/propertyreceiver/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.propertyreceiver 8 | 9 | import tech.antibytes.kmock.MockCommon 10 | 11 | interface Something 12 | 13 | interface SomethingElse 14 | 15 | interface AnythingElse { 16 | interface SomethingInside 17 | } 18 | 19 | @MockCommon(Common::class) 20 | interface Common { 21 | var Something.thing: Int 22 | val SomethingElse.things: List 23 | var Common<*>.extension: Int 24 | var T.nothing: T where T : Something, T : Comparable 25 | var L.otherThing: String 26 | var T.nothing: L 27 | val myThing: String 28 | val AnythingElse.SomethingInside.inside: Int 29 | 30 | fun getOtherThing() 31 | } 32 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/propertyreceiver/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.propertyreceiver 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | interface Something 12 | 13 | interface SomethingElse 14 | 15 | interface AnythingElse { 16 | interface SomethingInside 17 | } 18 | 19 | @Mock(Platform::class) 20 | interface Platform { 21 | var Something.thing: Int 22 | val SomethingElse.things: List 23 | var Platform<*>.extension: Int 24 | var T.nothing: T where T : Something, T : Comparable 25 | var L.otherThing: String 26 | var T.nothing: L 27 | var T.othing: L? 28 | val myThing: String 29 | val AnythingElse.SomethingInside.inside: Int 30 | 31 | fun getOtherThing() 32 | } 33 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/propertyreceiver/Relaxed.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.propertyreceiver 8 | 9 | import tech.antibytes.kmock.Mock 10 | import tech.antibytes.kmock.Relaxer 11 | 12 | interface Something 13 | 14 | interface SomethingElse 15 | 16 | interface AnythingElse { 17 | interface SomethingInside 18 | } 19 | 20 | @Relaxer 21 | internal inline fun relaxed(id: String): T { 22 | return id as T 23 | } 24 | 25 | @Mock(Relaxed::class) 26 | interface Relaxed { 27 | var Something.thing: Int 28 | val SomethingElse.things: List 29 | var Relaxed<*>.extension: Int 30 | var T.nothing: T where T : Something, T : Comparable 31 | var L.otherThing: String 32 | var L.nextThing: L 33 | var T.nothing: L 34 | var T.otherThing: T 35 | val myThing: String 36 | val AnythingElse.SomethingInside.inside: Int 37 | 38 | fun getOtherThing() 39 | } 40 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/propertyreceiver/Spied.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.propertyreceiver 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | interface Something 12 | 13 | interface SomethingElse 14 | 15 | interface AnythingElse { 16 | interface SomethingInside 17 | } 18 | 19 | @Mock(Spied::class) 20 | interface Spied { 21 | var Something.thing: Int 22 | val SomethingElse.things: List 23 | var Spied<*>.extension: Int 24 | var T.nothing: T where T : Something, T : Comparable 25 | var L.otherThing: String 26 | var T.nothing: L 27 | val myThing: String 28 | val AnythingElse.SomethingInside.inside: Int 29 | 30 | fun getOtherThing() 31 | } 32 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/propertyreceiver/SuperType.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.propertyreceiver 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | interface Something 12 | 13 | interface SomethingElse 14 | 15 | interface AnythingElse { 16 | interface SomethingInside 17 | } 18 | 19 | @Mock(Inherited::class) 20 | interface Inherited : Platform 21 | 22 | interface Platform { 23 | var Something.thing: Int 24 | val SomethingElse.things: List 25 | var Platform<*>.extension: Int 26 | var T.nothing: T where T : Something, T : Comparable 27 | var L.otherThing: String 28 | var T.nothing: L 29 | val myThing: String 30 | val AnythingElse.SomethingInside.inside: Int 31 | 32 | fun getOtherThing() 33 | } 34 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/relaxed/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.relaxed 8 | 9 | import tech.antibytes.kmock.MockCommon 10 | import tech.antibytes.kmock.Relaxer 11 | 12 | @Relaxer 13 | internal inline fun relaxed(id: String): T { 14 | return id as T 15 | } 16 | 17 | @MockCommon(Common::class) 18 | interface Common where L : Any, L : Comparable, K : Any { 19 | var template: L 20 | val buzz: String 21 | 22 | fun foo(payload: Any): String 23 | fun foo(): T 24 | fun foo(payload: String): L 25 | fun fooBar(payload: T) 26 | fun fooBar(): T where T : K? 27 | fun oo(vararg payload: Any): String 28 | suspend fun bar(payload: Any): String 29 | suspend fun ar(vararg payload: Any): String 30 | fun buzz() 31 | } 32 | 33 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/relaxed/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.relaxed 8 | 9 | import tech.antibytes.kmock.Mock 10 | import tech.antibytes.kmock.Relaxer 11 | 12 | @Relaxer 13 | internal inline fun relaxed(id: String): T { 14 | return id as T 15 | } 16 | 17 | @Mock(Platform::class) 18 | interface Platform { 19 | val buzz: String 20 | 21 | fun foo(payload: Any): String 22 | fun oo(vararg payload: Any): String 23 | suspend fun bar(payload: Any): String 24 | suspend fun ar(vararg payload: Any): String 25 | fun buzz() 26 | } 27 | 28 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/relaxed/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.relaxed 8 | 9 | import tech.antibytes.kmock.MockShared 10 | import tech.antibytes.kmock.Relaxer 11 | 12 | @Relaxer 13 | internal inline fun relaxed(id: String): T { 14 | return id as T 15 | } 16 | 17 | @MockShared( 18 | "sharedTest", 19 | Shared::class 20 | ) 21 | interface Shared { 22 | val buzz: String 23 | val uzz: T 24 | 25 | fun foo(payload: Any): String 26 | suspend fun bar(payload: Any): String 27 | fun buzz() 28 | } 29 | 30 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/renamed/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.renamed 8 | 9 | import tech.antibytes.kmock.MockCommon 10 | 11 | @MockCommon(Common::class) 12 | interface Common where L : Any, L : Comparable, K : Any { 13 | var template: L 14 | val ozz: Int 15 | 16 | fun bar(arg0: Int): Any 17 | suspend fun buzz(arg0: String): L 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/renamed/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.renamed 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(Platform::class) 12 | interface Platform where L : Any, L : Comparable, K : Any { 13 | var template: L 14 | val ozz: Int 15 | 16 | fun bar(arg0: Int): Any 17 | suspend fun buzz(arg0: String): L 18 | } 19 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/renamed/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.renamed 8 | 9 | import tech.antibytes.kmock.MockShared 10 | 11 | @MockShared( 12 | "sharedTest", 13 | Shared::class 14 | ) 15 | interface Shared where L : Any, L : Comparable, K : Any { 16 | var template: L 17 | val ozz: Int 18 | 19 | fun bar(arg0: Int): Any 20 | suspend fun buzz(arg0: String): L 21 | } 22 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/spy/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.spy 8 | 9 | import tech.antibytes.kmock.MockCommon 10 | 11 | @MockCommon(Common::class) 12 | interface Common where L : Any, L : Comparable, K : Any { 13 | var template: L 14 | val ozz: Int 15 | 16 | fun foo(payload: T) 17 | fun oo(vararg payload: T) 18 | fun bar(arg0: Int): Any 19 | fun ar(vararg arg0: Int): Any 20 | suspend fun buzz(arg0: String): L 21 | suspend fun uzz(vararg arg0: String): L 22 | fun izz(): T where T : CharSequence, T : Comparable>> 23 | } 24 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/spy/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.spy 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | @Mock(Platform::class) 12 | interface Platform where L : Any, L : Comparable, K : Any { 13 | var template: L 14 | val ozz: Int 15 | 16 | fun foo(payload: T) 17 | fun foo(vararg payload: T) 18 | fun bar(arg0: Int): Any 19 | fun bar(vararg arg0: Int): Any 20 | suspend fun buzz(arg0: String): L 21 | suspend fun buzz(vararg arg0: String): L 22 | fun izz(): T where T : CharSequence, T : Comparable>> 23 | } 24 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/spy/Relaxed.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.spy 8 | 9 | import tech.antibytes.kmock.Mock 10 | import tech.antibytes.kmock.Relaxer 11 | 12 | @Relaxer 13 | internal inline fun relaxed(id: String): T { 14 | return Any() as T 15 | } 16 | 17 | @Mock(Relaxed::class) 18 | interface Relaxed where L : Any, L : Comparable, K : Any { 19 | var template: L 20 | val ozz: Int 21 | 22 | fun foo(payload: T) 23 | fun bar(arg0: Int): Any 24 | suspend fun buzz(arg0: String): L 25 | fun izz(): T where T : CharSequence, T : Comparable>> 26 | } 27 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/spy/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.spy 8 | 9 | import tech.antibytes.kmock.MockShared 10 | 11 | @MockShared( 12 | "sharedTest", 13 | Shared::class 14 | ) 15 | interface Shared where L : Any, L : Comparable, K : Any { 16 | var template: L 17 | val ozz: Int 18 | 19 | fun foo(payload: T) 20 | fun bar(arg0: Int): Any 21 | suspend fun buzz(arg0: String): L 22 | } 23 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/sync/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.sync 8 | 9 | import mock.template.async.Common 10 | import tech.antibytes.kmock.MockCommon 11 | 12 | @MockCommon(Common::class) 13 | interface Common { 14 | fun foo(fuzz: Int, ozz: Any): Any 15 | 16 | fun bar(buzz: Int, bozz: Any): Any = bozz 17 | 18 | fun ozz(vararg buzz: Int): Any 19 | 20 | fun izz(vararg buzz: Any): Any 21 | } 22 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/sync/Platform.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.sync 8 | 9 | import mock.template.async.Platform 10 | import tech.antibytes.kmock.Mock 11 | 12 | @Mock(Platform::class) 13 | interface Platform { 14 | fun foo(fuzz: Int, ozz: Any): dynamic 15 | 16 | fun bar(buzz: Int, bozz: Any): Any = bozz 17 | 18 | fun ozz(vararg buzz: Int): Any 19 | 20 | fun izz(vararg buzz: Any): Any 21 | } 22 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/sync/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.sync 8 | 9 | import mock.template.async.Shared 10 | import tech.antibytes.kmock.MockShared 11 | 12 | @MockShared("shared", Shared::class) 13 | interface Shared { 14 | fun foo(fuzz: Int, ozz: Any): Any 15 | 16 | fun bar(buzz: Int, bozz: Any): Any = bozz 17 | 18 | fun nol(buzz: Enum<*>): Any = buzz 19 | } 20 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/typealiaz/Common.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.typealiaz 8 | 9 | import tech.antibytes.kmock.MockCommon 10 | 11 | typealias Alias0 = (Any) -> Unit 12 | typealias Alias1 = (Any) -> Any 13 | 14 | @MockCommon(Common::class) 15 | interface Common { 16 | fun doSomething( 17 | arg0: Any, 18 | arg1: Alias0, 19 | arg2: Alias1 20 | ): Any 21 | } 22 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/typealiaz/Receiver.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.typealiaz 8 | 9 | import tech.antibytes.kmock.Mock 10 | 11 | interface GenericReceiver 12 | 13 | typealias Alias11 = (Any) -> Unit 14 | typealias Alias2 = (Any) -> Any 15 | typealias Alias3 = GenericReceiver 16 | 17 | @Mock(Receiver::class) 18 | interface Receiver { 19 | val List>.any: Int 20 | var > T.member: T 21 | 22 | fun Alias11.doSomething( 23 | arg0: Alias3, 24 | arg1: Alias2, 25 | arg2: Alias11 26 | ): Any 27 | 28 | fun > Alias3.doAnythingElse( 29 | arg1: Alias11, 30 | arg2: Alias2 31 | ) 32 | 33 | fun doAnythingElse(arg1: Alias3>) 34 | 35 | fun , X : Comparable> T.doOtherThing(arg1: Alias3, arg0: X) 36 | 37 | fun L.doSomethingElse( 38 | arg1: T, 39 | arg2: L 40 | ) 41 | 42 | fun , K> T.doSomethingElse(arg1: T) 43 | 44 | fun run(arg: L): Alias11 45 | } 46 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/mock/template/typealiaz/Shared.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package mock.template.typealiaz 8 | 9 | import tech.antibytes.kmock.MockShared 10 | 11 | typealias Alias00 = (Any) -> Unit 12 | typealias Alias01 = (Any) -> Any 13 | 14 | @MockShared("sharedTest", Shared::class) 15 | interface Shared { 16 | fun doSomething( 17 | arg0: Any, 18 | arg1: Alias00, 19 | arg2: Alias01 20 | ): Any 21 | } 22 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/common/RegularActualFactory.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package multi 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | 9 | private inline fun getMockInstance( 10 | spyOn: SpyOn?, 11 | collector: KMockContract.Collector, 12 | relaxed: Boolean, 13 | relaxUnitFun: Boolean, 14 | freeze: Boolean, 15 | ): Mock = when (Mock::class) { 16 | multi.CommonMultiMock::class -> multi.CommonMultiMock>(collector = 17 | collector, relaxUnitFun = relaxUnitFun, freeze = freeze) as Mock 18 | else -> throw RuntimeException("Unknown Interface ${Mock::class.simpleName}.") 19 | } 20 | 21 | internal actual inline fun kmock( 22 | collector: KMockContract.Collector, 23 | relaxed: Boolean, 24 | relaxUnitFun: Boolean, 25 | freeze: Boolean, 26 | ): Mock = getMockInstance( 27 | spyOn = null, 28 | collector = collector, 29 | relaxed = relaxed, 30 | relaxUnitFun = relaxUnitFun, 31 | freeze = freeze, 32 | ) 33 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/common/RegularExpectFactory.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package multi 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | import tech.antibytes.kmock.proxy.NoopCollector 9 | 10 | internal expect inline fun kmock( 11 | collector: KMockContract.Collector = NoopCollector, 12 | relaxed: Boolean = false, 13 | relaxUnitFun: Boolean = false, 14 | freeze: Boolean = false, 15 | ): Mock 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/common/RegularInterface.kt: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | import multi.template.common.CommonContractRegular 4 | import multi.template.common.Regular1 5 | import multi.template.common.nested.Regular3 6 | import tech.antibytes.kmock.MockCommon 7 | 8 | @MockCommon(CommonMulti::class) 9 | private interface CommonMulti : Regular1, CommonContractRegular.Regular2, Regular3 10 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/common/SpiedRegularExpectFactory.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package multi 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import kotlin.reflect.KClass 8 | import multi.template.common.CommonContractRegular 9 | import multi.template.common.Regular1 10 | import multi.template.common.nested.Regular3 11 | import tech.antibytes.kmock.KMockContract 12 | import tech.antibytes.kmock.proxy.NoopCollector 13 | 14 | internal expect inline fun kmock( 15 | collector: KMockContract.Collector = NoopCollector, 16 | relaxed: Boolean = false, 17 | relaxUnitFun: Boolean = false, 18 | freeze: Boolean = false, 19 | ): Mock 20 | 21 | internal expect inline fun kspy( 22 | spyOn: SpyOn, 23 | collector: KMockContract.Collector = NoopCollector, 24 | freeze: Boolean = false, 25 | templateType0: KClass, 26 | templateType1: KClass, 27 | templateType2: KClass, 28 | ): Mock where SpyOn : Regular1, SpyOn : CommonContractRegular.Regular2, SpyOn : Regular3 29 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/commonGeneric/GenericInterface.kt: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | import kotlin.Any 4 | import kotlin.Comparable 5 | import multi.template.commonGeneric.Generic1 6 | import multi.template.commonGeneric.GenericCommonContract 7 | import multi.template.commonGeneric.nested.Generic2 8 | import tech.antibytes.kmock.MockCommon 9 | 10 | @MockCommon(CommonGenericMulti::class) 11 | private interface CommonGenericMulti : 13 | Generic1, 14 | Generic2, 15 | GenericCommonContract.Generic3 where 16 | KMockTypeParameter1 : Any, KMockTypeParameter1 : Comparable, 17 | KMockTypeParameter3 : Any, KMockTypeParameter3 : Comparable 18 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/commonGeneric/SpiedGenericInterface.kt: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | import kotlin.Any 4 | import kotlin.Comparable 5 | import multi.template.commonGeneric.Generic1 6 | import multi.template.commonGeneric.GenericCommonContract 7 | import multi.template.commonGeneric.nested.Generic2 8 | import tech.antibytes.kmock.MockCommon 9 | 10 | @MockCommon(CommonGenericMulti::class) 11 | private interface CommonGenericMulti : 13 | Generic1, 14 | Generic2, 15 | GenericCommonContract.Generic3 where 16 | KMockTypeParameter1 : Any, KMockTypeParameter1 : Comparable, 17 | KMockTypeParameter3 : Any, KMockTypeParameter3 : Comparable 18 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/custom/RegularActualFactory.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package multi 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | 9 | private inline fun getMockInstance( 10 | spyOn: SpyOn?, 11 | collector: KMockContract.Collector, 12 | relaxed: Boolean, 13 | relaxUnitFun: Boolean, 14 | freeze: Boolean, 15 | ): Mock = when (Mock::class) { 16 | multi.SharedMultiMock::class -> multi.SharedMultiMock>(collector = 17 | collector, relaxUnitFun = relaxUnitFun, freeze = freeze) as Mock 18 | else -> throw RuntimeException("Unknown Interface ${Mock::class.simpleName}.") 19 | } 20 | 21 | internal actual inline fun kmock( 22 | collector: KMockContract.Collector, 23 | relaxed: Boolean, 24 | relaxUnitFun: Boolean, 25 | freeze: Boolean, 26 | ): Mock = getMockInstance( 27 | spyOn = null, 28 | collector = collector, 29 | relaxed = relaxed, 30 | relaxUnitFun = relaxUnitFun, 31 | freeze = freeze, 32 | ) 33 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/custom/RegularInterface.kt: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | import multi.template.custom.Regular1 4 | import multi.template.custom.SharedContractRegular 5 | import multi.template.custom.nested.Regular3 6 | import tech.antibytes.kmock.MockShared 7 | 8 | @MockShared( 9 | "sharedTest", 10 | SharedMulti::class, 11 | ) 12 | private interface SharedMulti : Regular1, SharedContractRegular.Regular2, Regular3 13 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/custom/SpiedRegularExpectFactory.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package multi 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import kotlin.reflect.KClass 8 | import multi.template.custom.Regular1 9 | import multi.template.custom.SharedContractRegular 10 | import multi.template.custom.nested.Regular3 11 | import tech.antibytes.kmock.KMockContract 12 | import tech.antibytes.kmock.proxy.NoopCollector 13 | 14 | internal expect inline fun kspy( 15 | spyOn: SpyOn, 16 | collector: KMockContract.Collector = NoopCollector, 17 | freeze: Boolean = false, 18 | templateType0: KClass, 19 | templateType1: KClass, 20 | templateType2: KClass, 21 | ): Mock where SpyOn : Regular1, SpyOn : SharedContractRegular.Regular2, SpyOn : Regular3 22 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/kmock/CommonInterface.kt: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | import multi.template.kmock.common.CommonContractRegular 4 | import multi.template.kmock.common.Regular1 5 | import multi.template.kmock.common.nested.Regular3 6 | import tech.antibytes.kmock.MockCommon 7 | 8 | @MockCommon(CommonMulti::class) 9 | private interface CommonMulti : Regular1, CommonContractRegular.Regular2, Regular3 10 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/kmock/PlatformInterface.kt: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | import multi.template.kmock.platform.PlatformContractRegular 4 | import multi.template.kmock.platform.Regular1 5 | import multi.template.kmock.platform.nested.Regular3 6 | import tech.antibytes.kmock.Mock 7 | 8 | @Mock(PlatformMulti::class) 9 | private interface PlatformMulti : Regular1, PlatformContractRegular.Regular2, Regular3 10 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/kmock/SharedInterface.kt: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | import multi.template.kmock.shared.Regular1 4 | import multi.template.kmock.shared.SharedContractRegular 5 | import multi.template.kmock.shared.nested.Regular3 6 | import tech.antibytes.kmock.MockShared 7 | 8 | @MockShared( 9 | "sharedTest", 10 | SharedMulti::class, 11 | ) 12 | private interface SharedMulti : Regular1, SharedContractRegular.Regular2, Regular3 13 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/mixed/ExpectedFactory.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package multi 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | import tech.antibytes.kmock.proxy.NoopCollector 9 | 10 | internal expect inline fun kmock( 11 | collector: KMockContract.Collector = NoopCollector, 12 | relaxed: Boolean = false, 13 | relaxUnitFun: Boolean = false, 14 | freeze: Boolean = false, 15 | ): Mock 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/platform/RegularActualFactory.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package multi 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | import tech.antibytes.kmock.proxy.NoopCollector 9 | 10 | private inline fun getMockInstance( 11 | spyOn: SpyOn?, 12 | collector: KMockContract.Collector, 13 | relaxed: Boolean, 14 | relaxUnitFun: Boolean, 15 | freeze: Boolean, 16 | ): Mock = when (Mock::class) { 17 | multi.PlatformMultiMock::class -> multi.PlatformMultiMock>(collector = 18 | collector, relaxUnitFun = relaxUnitFun, freeze = freeze) as Mock 19 | else -> throw RuntimeException("Unknown Interface ${Mock::class.simpleName}.") 20 | } 21 | 22 | internal inline fun kmock( 23 | collector: KMockContract.Collector = NoopCollector, 24 | relaxed: Boolean = false, 25 | relaxUnitFun: Boolean = false, 26 | freeze: Boolean = false, 27 | ): Mock = getMockInstance( 28 | spyOn = null, 29 | collector = collector, 30 | relaxed = relaxed, 31 | relaxUnitFun = relaxUnitFun, 32 | freeze = freeze, 33 | ) 34 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/platform/RegularInterface.kt: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | import multi.template.platform.PlatformContractRegular 4 | import multi.template.platform.Regular1 5 | import multi.template.platform.nested.Regular3 6 | import tech.antibytes.kmock.Mock 7 | 8 | @Mock(PlatformMulti::class) 9 | private interface PlatformMulti : Regular1, PlatformContractRegular.Regular2, Regular3 10 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/platformGeneric/GenericInterface.kt: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | import kotlin.Any 4 | import kotlin.Comparable 5 | import multi.template.platformGeneric.Generic1 6 | import multi.template.platformGeneric.GenericPlatformContract 7 | import multi.template.platformGeneric.nested.Generic2 8 | import tech.antibytes.kmock.Mock 9 | 10 | @Mock(PlatformGenericMulti::class) 11 | private interface PlatformGenericMulti : 13 | Generic1, 14 | Generic2, 15 | GenericPlatformContract.Generic3 where 16 | KMockTypeParameter1 : Any, KMockTypeParameter1 : Comparable, 17 | KMockTypeParameter3 : Any, KMockTypeParameter3 : Comparable 18 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/platformGeneric/SpiedGenericInterface.kt: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | import kotlin.Any 4 | import kotlin.Comparable 5 | import multi.template.platformGeneric.Generic1 6 | import multi.template.platformGeneric.GenericPlatformContract 7 | import multi.template.platformGeneric.nested.Generic2 8 | import tech.antibytes.kmock.Mock 9 | 10 | @Mock(PlatformGenericMulti::class) 11 | private interface PlatformGenericMulti : 13 | Generic1, 14 | Generic2, 15 | GenericPlatformContract.Generic3 where 16 | KMockTypeParameter1 : Any, KMockTypeParameter1 : Comparable, 17 | KMockTypeParameter3 : Any, KMockTypeParameter3 : Comparable 18 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/shared/RegularActualFactory.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package multi 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import tech.antibytes.kmock.KMockContract 8 | 9 | private inline fun getMockInstance( 10 | spyOn: SpyOn?, 11 | collector: KMockContract.Collector, 12 | relaxed: Boolean, 13 | relaxUnitFun: Boolean, 14 | freeze: Boolean, 15 | ): Mock = when (Mock::class) { 16 | multi.SharedMultiMock::class -> multi.SharedMultiMock>(collector = 17 | collector, relaxUnitFun = relaxUnitFun, freeze = freeze) as Mock 18 | else -> throw RuntimeException("Unknown Interface ${Mock::class.simpleName}.") 19 | } 20 | 21 | internal actual inline fun kmock( 22 | collector: KMockContract.Collector, 23 | relaxed: Boolean, 24 | relaxUnitFun: Boolean, 25 | freeze: Boolean, 26 | ): Mock = getMockInstance( 27 | spyOn = null, 28 | collector = collector, 29 | relaxed = relaxed, 30 | relaxUnitFun = relaxUnitFun, 31 | freeze = freeze, 32 | ) 33 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/shared/RegularInterface.kt: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | import multi.template.shared.Regular1 4 | import multi.template.shared.SharedContractRegular 5 | import multi.template.shared.nested.Regular3 6 | import tech.antibytes.kmock.MockShared 7 | 8 | @MockShared( 9 | "sharedTest", 10 | SharedMulti::class, 11 | ) 12 | private interface SharedMulti : Regular1, SharedContractRegular.Regular2, Regular3 13 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/shared/SpiedRegularExpectFactory.kt: -------------------------------------------------------------------------------- 1 | @file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION") 2 | 3 | package multi 4 | 5 | import kotlin.Boolean 6 | import kotlin.Suppress 7 | import kotlin.reflect.KClass 8 | import multi.template.shared.Regular1 9 | import multi.template.shared.SharedContractRegular 10 | import multi.template.shared.nested.Regular3 11 | import tech.antibytes.kmock.KMockContract 12 | import tech.antibytes.kmock.proxy.NoopCollector 13 | 14 | internal expect inline fun kspy( 15 | spyOn: SpyOn, 16 | collector: KMockContract.Collector = NoopCollector, 17 | freeze: Boolean = false, 18 | templateType0: KClass, 19 | templateType1: KClass, 20 | templateType2: KClass, 21 | ): Mock where SpyOn : Regular1, SpyOn : SharedContractRegular.Regular2, SpyOn : Regular3 22 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/sharedGeneric/GenericInterface.kt: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | import kotlin.Any 4 | import kotlin.Comparable 5 | import multi.template.sharedGeneric.Generic1 6 | import multi.template.sharedGeneric.GenericSharedContract 7 | import multi.template.sharedGeneric.nested.Generic2 8 | import tech.antibytes.kmock.MockShared 9 | 10 | @MockShared( 11 | "sharedTest", 12 | SharedGenericMulti::class, 13 | ) 14 | private interface SharedGenericMulti : 16 | Generic1, 17 | Generic2, 18 | GenericSharedContract.Generic3 where 19 | KMockTypeParameter1 : Any, KMockTypeParameter1 : Comparable, 20 | KMockTypeParameter3 : Any, KMockTypeParameter3 : Comparable 21 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/expected/sharedGeneric/SpiedGenericInterface.kt: -------------------------------------------------------------------------------- 1 | package multi 2 | 3 | import kotlin.Any 4 | import kotlin.Comparable 5 | import multi.template.sharedGeneric.Generic1 6 | import multi.template.sharedGeneric.GenericSharedContract 7 | import multi.template.sharedGeneric.nested.Generic2 8 | import tech.antibytes.kmock.MockShared 9 | 10 | @MockShared( 11 | "sharedTest", 12 | SharedGenericMulti::class, 13 | ) 14 | private interface SharedGenericMulti : 16 | Generic1, 17 | Generic2, 18 | GenericSharedContract.Generic3 where 19 | KMockTypeParameter1 : Any, KMockTypeParameter1 : Comparable, 20 | KMockTypeParameter3 : Any, KMockTypeParameter3 : Comparable 21 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/common/Regular1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.common 8 | 9 | import multi.template.common.nested.Regular3 10 | import tech.antibytes.kmock.MultiMockCommon 11 | 12 | @MultiMockCommon( 13 | "CommonMulti", 14 | Regular1::class, 15 | CommonContractRegular.Regular2::class, 16 | Regular3::class, 17 | ) 18 | interface Regular1 { 19 | val something: Int 20 | 21 | fun doSomething(): Int 22 | } 23 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/common/Regular2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.common 8 | 9 | interface CommonContractRegular { 10 | interface Regular2 { 11 | val anything: Any 12 | 13 | fun doAnything(): Any 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/common/nested/Regular3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.common.nested 8 | 9 | import tech.antibytes.kmock.MultiMockCommon 10 | 11 | interface Regular3 { 12 | val somethingElse: String 13 | 14 | fun doSomethingElse(): String 15 | } 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/commonGeneric/Generic3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.commonGeneric 8 | 9 | interface GenericCommonContract { 10 | interface Generic3 : Comparable> { 11 | fun doSomething(arg: K): L 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/custom/Regular1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.custom 8 | 9 | import multi.template.custom.nested.Regular3 10 | import kotlin.reflect.KClass 11 | 12 | annotation class CustomShared( 13 | val mockName: String, 14 | vararg val interfaces: KClass<*> 15 | ) 16 | 17 | @CustomShared( 18 | mockName = "SharedMulti", 19 | Regular1::class, 20 | SharedContractRegular.Regular2::class, 21 | Regular3::class, 22 | ) 23 | interface Regular1 { 24 | val something: Int 25 | 26 | fun doSomething(): Int 27 | } 28 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/custom/Regular2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.custom 8 | 9 | interface SharedContractRegular { 10 | interface Regular2 { 11 | val anything: Any 12 | 13 | fun doAnything(): Any 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/custom/nested/Regular3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.custom.nested 8 | 9 | interface Regular3 { 10 | val somethingElse: String 11 | 12 | fun doSomethingElse(): String 13 | } 14 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/kmock/common/Regular1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.kmock.common 8 | 9 | import multi.template.kmock.common.nested.Regular3 10 | import tech.antibytes.kmock.KMockExperimental 11 | import tech.antibytes.kmock.KMockMulti 12 | 13 | @OptIn(KMockExperimental::class) 14 | @KMockMulti( 15 | "CommonMulti", 16 | Regular1::class, 17 | CommonContractRegular.Regular2::class, 18 | Regular3::class, 19 | ) 20 | interface Regular1 { 21 | val something: Int 22 | 23 | fun doSomething(): Int 24 | } 25 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/kmock/common/Regular2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.kmock.common 8 | 9 | interface CommonContractRegular { 10 | interface Regular2 { 11 | val anything: Any 12 | 13 | fun doAnything(): Any 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/kmock/common/nested/Regular3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.kmock.common.nested 8 | 9 | interface Regular3 { 10 | val somethingElse: String 11 | 12 | fun doSomethingElse(): String 13 | } 14 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/kmock/platform/Regular1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.kmock.platform 8 | 9 | import multi.template.kmock.platform.nested.Regular3 10 | import tech.antibytes.kmock.KMockExperimental 11 | import tech.antibytes.kmock.KMockMulti 12 | 13 | @OptIn(KMockExperimental::class) 14 | @KMockMulti( 15 | "PlatformMulti", 16 | Regular1::class, 17 | PlatformContractRegular.Regular2::class, 18 | Regular3::class, 19 | ) 20 | interface Regular1 { 21 | val something: Int 22 | 23 | fun doSomething(): Int 24 | } 25 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/kmock/platform/Regular2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.kmock.platform 8 | 9 | interface PlatformContractRegular { 10 | interface Regular2 { 11 | val anything: Any 12 | 13 | fun doAnything(): Any 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/kmock/platform/nested/Regular3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.kmock.platform.nested 8 | 9 | interface Regular3 { 10 | val somethingElse: String 11 | 12 | fun doSomethingElse(): String 13 | } 14 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/kmock/shared/Regular1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.kmock.shared 8 | 9 | import multi.template.kmock.common.Regular1 10 | import multi.template.kmock.shared.nested.Regular3 11 | import tech.antibytes.kmock.KMockExperimental 12 | import tech.antibytes.kmock.KMockMulti 13 | 14 | @OptIn(KMockExperimental::class) 15 | @KMockMulti( 16 | "SharedMulti", 17 | Regular1::class, 18 | SharedContractRegular.Regular2::class, 19 | Regular3::class, 20 | ) 21 | interface Regular1 { 22 | val something: Int 23 | 24 | fun doSomething(): Int 25 | } 26 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/kmock/shared/Regular2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.kmock.shared 8 | 9 | interface SharedContractRegular { 10 | interface Regular2 { 11 | val anything: Any 12 | 13 | fun doAnything(): Any 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/kmock/shared/nested/Regular3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.kmock.shared.nested 8 | 9 | interface Regular3 { 10 | val somethingElse: String 11 | 12 | fun doSomethingElse(): String 13 | } 14 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/mixed/Generic3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.mixed 8 | 9 | interface GenericPlatformContract { 10 | interface Generic3 : Comparable> { 11 | fun doSomething(arg: K): L 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/mixed/Regular1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.mixed 8 | 9 | import multi.template.mixed.PlatformContractRegular 10 | import multi.template.mixed.nested.Regular3 11 | import multi.template.mixed.nested.Generic2 12 | import tech.antibytes.kmock.MultiMock 13 | import tech.antibytes.kmock.MultiMockCommon 14 | 15 | @MultiMockCommon( 16 | "CommonMulti", 17 | Regular1::class, 18 | PlatformContractRegular.Regular2::class, 19 | Regular3::class, 20 | ) 21 | @MultiMock( 22 | "PlatformMulti", 23 | Generic1::class, 24 | GenericPlatformContract.Generic3::class, 25 | Generic2::class, 26 | ) 27 | interface Regular1 { 28 | val something: Int 29 | 30 | fun doSomething(): Int 31 | } 32 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/mixed/Regular2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.mixed 8 | 9 | interface PlatformContractRegular { 10 | interface Regular2 { 11 | val anything: Any 12 | 13 | fun doAnything(): Any 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/mixed/nested/Regular3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.mixed.nested 8 | 9 | interface Regular3 { 10 | val somethingElse: String 11 | 12 | fun doSomethingElse(): String 13 | } 14 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/platform/Regular1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.platform 8 | 9 | import multi.template.platform.nested.Regular3 10 | import tech.antibytes.kmock.MultiMock 11 | 12 | @MultiMock( 13 | "PlatformMulti", 14 | Regular1::class, 15 | PlatformContractRegular.Regular2::class, 16 | Regular3::class, 17 | ) 18 | interface Regular1 { 19 | val something: Int 20 | 21 | fun doSomething(): Int 22 | } 23 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/platform/Regular2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.platform 8 | 9 | interface PlatformContractRegular { 10 | interface Regular2 { 11 | val anything: Any 12 | 13 | fun doAnything(): Any 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/platform/nested/Regular3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.platform.nested 8 | 9 | interface Regular3 { 10 | val somethingElse: String 11 | 12 | fun doSomethingElse(): String 13 | } 14 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/platformGeneric/Generic3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.platformGeneric 8 | 9 | interface GenericPlatformContract { 10 | interface Generic3 : Comparable> { 11 | fun doSomething(arg: K): L 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/receiver/Methods.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.receiver 8 | 9 | interface Methods { 10 | fun Something.equals(): Int 11 | fun Something.doSomething(): Int 12 | fun SomethingElse.doSomethingElse(): List 13 | fun Methods<*>.mutabor(): Int 14 | fun T.doNothing(): Unit where T : Something, T : Comparable 15 | fun T.doNothing(): Unit where T : Any 16 | fun T.doSomethingElse(): L 17 | fun T.doNothingElse(a: R): Unit where T : Something, T : Comparable 18 | fun AnythingElse.SomethingInside.doInside(): Int 19 | 20 | fun iDo() 21 | fun mutabor(x: Methods<*>) 22 | fun doNothingElse(a: Any): Any 23 | fun doSomethingElse(x: SomethingElse) 24 | } 25 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/receiver/Properties.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.receiver 8 | 9 | import tech.antibytes.kmock.MultiMock 10 | 11 | interface Something 12 | 13 | interface SomethingElse 14 | 15 | interface AnythingElse { 16 | interface SomethingInside 17 | } 18 | 19 | @MultiMock( 20 | "ReceiverMulti", 21 | Properties::class, 22 | Methods::class 23 | ) 24 | interface Properties { 25 | var Something.thing: Int 26 | val SomethingElse.things: List 27 | var Properties<*>.extension: Int 28 | var T.nothing: T where T : Something, T : Comparable 29 | var L.otherThing: String 30 | var T.nothing: L 31 | val myThing: String 32 | val AnythingElse.SomethingInside.inside: Int 33 | 34 | fun getOtherThing() 35 | } 36 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/shared/Regular1.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.shared 8 | 9 | import multi.template.shared.nested.Regular3 10 | import tech.antibytes.kmock.MultiMockShared 11 | 12 | @MultiMockShared( 13 | "sharedTest", 14 | "SharedMulti", 15 | Regular1::class, 16 | SharedContractRegular.Regular2::class, 17 | Regular3::class, 18 | ) 19 | interface Regular1 { 20 | val something: Int 21 | 22 | fun doSomething(): Int 23 | } 24 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/shared/Regular2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.shared 8 | 9 | interface SharedContractRegular { 10 | interface Regular2 { 11 | val anything: Any 12 | 13 | fun doAnything(): Any 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/shared/nested/Regular3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.shared.nested 8 | 9 | import tech.antibytes.kmock.MultiMockCommon 10 | 11 | interface Regular3 { 12 | val somethingElse: String 13 | 14 | fun doSomethingElse(): String 15 | } 16 | -------------------------------------------------------------------------------- /kmock-processor/src/test/resources/multi/template/sharedGeneric/Generic3.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package multi.template.sharedGeneric 8 | 9 | interface GenericSharedContract { 10 | interface Generic3 : Comparable> { 11 | fun doSomething(arg: K): L 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /kmock-test-plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | import tech.antibytes.gradle.dependency.helper.addCustomRepositories 7 | import tech.antibytes.gradle.dependency.helper.ensureKotlinVersion 8 | import tech.antibytes.gradle.kmock.config.repositories.Repositories.kmockRepositories 9 | 10 | plugins { 11 | id("tech.antibytes.gradle.setup") 12 | 13 | alias(antibytesCatalog.plugins.gradle.antibytes.dependencyHelper) 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | mavenCentral() 19 | google() 20 | jcenter() 21 | addCustomRepositories(kmockRepositories) 22 | } 23 | 24 | ensureKotlinVersion() 25 | } 26 | 27 | evaluationDependsOnChildren() 28 | 29 | tasks.named("wrapper") { 30 | gradleVersion = antibytesCatalog.versions.gradle.gradle.get() 31 | distributionType = Wrapper.DistributionType.ALL 32 | } 33 | -------------------------------------------------------------------------------- /kmock-test-plugin/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | # 4 | # Use of this source code is governed by Apache v2.0 5 | # 6 | 7 | # Gradle 8 | org.gradle.jvmargs=-Xmx4048m 9 | org.gradle.parallel=true 10 | org.gradle.dependency.verification.console=verbose 11 | org.gradle.caching=false 12 | org.gradle.welcome=never 13 | org.gradle.configuration-cache=false 14 | org.gradle.configuration-cache.problems=warn 15 | # Kotlin 16 | kotlin.incremental.multiplatform=true 17 | kotlin.mpp.stability.nowarn=true 18 | kotlin.code.style=official 19 | kotlin.mpp.applyDefaultHierarchyTemplate=false 20 | # Native 21 | kotlin.native.ignoreIncorrectDependencies=true 22 | kotlin.mpp.enableCInteropCommonization=true 23 | kotlin.native.cacheKind=none 24 | kotlin.native.osVersionMin.ios_x64=14.0 25 | kotlin.native.osVersionMin.ios_arm64=14.0 26 | kotlin.native.osVersionMin.ios_arm32=14.0 27 | kotlin.native.osVersionMin.ios_simulator_arm64=14.0 28 | # Android 29 | android.useAndroidX=true 30 | android.enableJetifier=false 31 | # see: https://github.com/robolectric/robolectric/issues/6521 32 | android.jetifier.ignorelist=bcprov 33 | -------------------------------------------------------------------------------- /kmock-test-plugin/kmock-gradle-shadow/src-processor/main/kotlin/tech/antibytes/gradle/kmock/source/Processor.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.gradle.kmock.source 8 | 9 | import org.gradle.api.artifacts.dsl.DependencyHandler 10 | import org.gradle.kotlin.dsl.project 11 | import tech.antibytes.gradle.kmock.config.MainConfig 12 | 13 | internal fun DependencyHandler.determineProcessor(): Any = project(MainConfig.processor) 14 | -------------------------------------------------------------------------------- /kmock-test-plugin/kmock-gradle-shadow/src/main: -------------------------------------------------------------------------------- 1 | ../../../kmock-gradle/src/main -------------------------------------------------------------------------------- /kmock-test-plugin/kmock-shadow/src/androidMain: -------------------------------------------------------------------------------- 1 | ../../../kmock/src/androidMain -------------------------------------------------------------------------------- /kmock-test-plugin/kmock-shadow/src/commonMain: -------------------------------------------------------------------------------- 1 | ../../../kmock/src/commonMain -------------------------------------------------------------------------------- /kmock-test-plugin/kmock-shadow/src/iosMain: -------------------------------------------------------------------------------- 1 | ../../../kmock/src/iosMain -------------------------------------------------------------------------------- /kmock-test-plugin/kmock-shadow/src/jsMain: -------------------------------------------------------------------------------- 1 | ../../../kmock/src/jsMain -------------------------------------------------------------------------------- /kmock-test-plugin/kmock-shadow/src/jvmMain: -------------------------------------------------------------------------------- 1 | ../../../kmock/src/jvmMain -------------------------------------------------------------------------------- /kmock-test-plugin/kmock-shadow/src/nativeMain: -------------------------------------------------------------------------------- 1 | ../../../kmock/src/nativeMain -------------------------------------------------------------------------------- /kmock/src/androidMain/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /kmock/src/androidMain/kotlin/tech/antibytes/kmock/SafeJvmName.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock 8 | 9 | public actual typealias SafeJvmName = JvmName 10 | -------------------------------------------------------------------------------- /kmock/src/androidMain/kotlin/tech/antibytes/kmock/util/ClassNameExtractor.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.util 10 | 11 | import kotlin.reflect.KClass 12 | 13 | internal actual fun extractKClassName(clazz: KClass<*>): String? = clazz.qualifiedName 14 | -------------------------------------------------------------------------------- /kmock/src/androidUnitTest/kotlin/tech/antibytes/kmock/util/ClassNameExtractorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.util 8 | 9 | import org.junit.Test 10 | import tech.antibytes.util.test.mustBe 11 | 12 | actual class ClassNameExtractorSpec { 13 | @Test 14 | actual fun `Given extractKClassName is called it returns the of the class name`() { 15 | extractKClassName(Any::class) mustBe Any::class.qualifiedName 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/SafeJvmName.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock 8 | 9 | /** 10 | * Ensures usage of JvmName in Common. 11 | */ 12 | public expect annotation class SafeJvmName(val name: String) 13 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/error/MockError.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.error 8 | 9 | /** 10 | * Base error class. 11 | * @param message the given error message. 12 | * @author Matthias Geisler 13 | */ 14 | public sealed class MockError( 15 | message: String, 16 | ) : RuntimeException(message) { 17 | /** 18 | * Indicates that a Proxy is missing a defined behaviour. 19 | * @param message the given error message. 20 | * @author Matthias Geisler 21 | */ 22 | public class MissingStub(message: String) : MockError(message) 23 | 24 | /** 25 | * Indicates that a Proxy was not called. 26 | * @param message the given error message 27 | * @author Matthias Geisler 28 | */ 29 | public class MissingCall(message: String) : MockError(message) 30 | } 31 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/proxy/NonIntrusivePropertyConfigurator.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.proxy 8 | 9 | import tech.antibytes.kmock.KMockContract 10 | import tech.antibytes.kmock.KMockContract.Relaxer 11 | 12 | internal class NonIntrusivePropertyConfigurator : 13 | KMockContract.NonIntrusivePropertyConfigurator, 14 | KMockContract.NonIntrusivePropertyTarget { 15 | private var relaxer: Relaxer? = null 16 | private var spyOn: Function0? = null 17 | 18 | override fun useRelaxerIf(condition: Boolean, relaxer: Function1) { 19 | this.relaxer = condition.guardRelaxer(relaxer) 20 | } 21 | 22 | override fun isRelaxable(): Boolean = relaxer != null 23 | 24 | override fun unwrapRelaxer(): Relaxer? = relaxer 25 | 26 | override fun useSpyIf(spyTarget: Any?, spyOn: Function0) { 27 | this.spyOn = spyTarget.guardSpy(spyOn) 28 | } 29 | 30 | override fun isSpyable(): Boolean = spyOn != null 31 | 32 | override fun unwrapSpy(): Function0? = spyOn 33 | } 34 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/proxy/NoopCollector.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.proxy 8 | 9 | import tech.antibytes.kmock.KMockContract.Collector 10 | import tech.antibytes.kmock.KMockContract.Proxy 11 | 12 | /** 13 | * Placeholder Collector for Proxies. 14 | * @see Collector 15 | * @author Matthias Geisler 16 | */ 17 | public object NoopCollector : Collector { 18 | /** 19 | * Performs a noop on invocation 20 | * @param referredProxy the proxy it is referring to. 21 | * @param referredCall the invocation index of the Proxy it refers to. 22 | */ 23 | public override fun addReference( 24 | referredProxy: Proxy<*, *>, 25 | referredCall: Int, 26 | ): Unit = Unit 27 | } 28 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/proxy/RelaxationGuard.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.proxy 10 | 11 | import tech.antibytes.kmock.KMockContract.Relaxer 12 | 13 | internal fun Boolean.guardRelaxer(relaxer: Function1): Relaxer? { 14 | return if (this) { 15 | Relaxer { mockId -> relaxer.invoke(mockId) } 16 | } else { 17 | null 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/proxy/SpyGuard.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.proxy 10 | 11 | internal fun > Any?.guardSpy(spyOn: SideEffect): SideEffect? { 12 | return if (this != null) { 13 | spyOn 14 | } else { 15 | null 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/proxy/UnitFunRelaxer.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.proxy 10 | 11 | @Suppress("UNUSED_PARAMETER") 12 | internal fun kmockUnitFunRelaxer(id: String) { 13 | /* Do nothing */ 14 | } 15 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/util/ClassNameExtractor.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.util 10 | 11 | import kotlin.reflect.KClass 12 | 13 | internal expect fun extractKClassName(clazz: KClass<*>): String? 14 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/Asserter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.verification 8 | 9 | import co.touchlab.stately.collections.IsoMutableList 10 | import co.touchlab.stately.collections.sharedMutableListOf 11 | import tech.antibytes.kmock.KMockContract.Reference 12 | 13 | /** 14 | * Container which collects and holds actual references of proxy calls in a freezing manner. 15 | * The references are ordered by their invocation. 16 | * This is intended as default mode for Verification. 17 | * @param coverAllInvocations flag to enable/disable capturing including explicit ignorable Proxies. Default is false. 18 | * @author Matthias Geisler 19 | */ 20 | public class Asserter(coverAllInvocations: Boolean = false) : AsserterBase(coverAllInvocations) { 21 | override val _references: IsoMutableList = sharedMutableListOf() 22 | } 23 | 24 | /** 25 | * Alias to Asserter. 26 | * @author Matthias Geisler 27 | */ 28 | public typealias Verifier = Asserter 29 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/Expectation.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.verification 8 | 9 | import tech.antibytes.kmock.KMockContract 10 | import tech.antibytes.kmock.KMockContract.Proxy 11 | 12 | /** 13 | * Handle with the aggregated information of a Proxy invocation. 14 | * Meant for internal usage only! 15 | * @author Matthias Geisler 16 | */ 17 | internal data class Expectation( 18 | override val proxy: Proxy<*, *>, 19 | override val callIndices: List, 20 | ) : KMockContract.Expectation 21 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/NonFreezingAsserter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.verification 8 | 9 | import tech.antibytes.kmock.KMockContract.Reference 10 | 11 | /** 12 | * Container which collects and holds actual references of proxy calls in a non freezing manner. 13 | * The references are ordered by their invocation. 14 | * @param coverAllInvocations flag to enable/disable capturing including explicit ignorable Proxies. Default is false. 15 | * @see Asserter 16 | * @author Matthias Geisler 17 | */ 18 | public class NonFreezingAsserter(coverAllInvocations: Boolean = false) : AsserterBase(coverAllInvocations) { 19 | override val _references: MutableList = mutableListOf() 20 | } 21 | 22 | /** 23 | * Alias to NonFreezingAsserter. 24 | * @author Matthias Geisler 25 | */ 26 | public typealias NonFreezingVerifier = NonFreezingAsserter 27 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/constraints/ArgumentConstraintWrapper.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.verification.constraints 8 | 9 | import tech.antibytes.kmock.KMockContract 10 | import tech.antibytes.kmock.KMockContract.ArgumentConstraint 11 | 12 | internal object ArgumentConstraintWrapper : KMockContract.ArgumentConstraintWrapper { 13 | override fun wrapValue(value: Any?): ArgumentConstraint { 14 | return if (value is ArgumentConstraint) { 15 | value 16 | } else { 17 | eq(value) 18 | } 19 | } 20 | 21 | override fun wrapNegatedValue(value: Any?): ArgumentConstraint { 22 | val wrappedValue = wrapValue(value) 23 | return not(wrappedValue) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/constraints/isNot.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ClassName", "ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.verification.constraints 10 | 11 | import tech.antibytes.kmock.KMockContract.ArgumentConstraint 12 | 13 | /** 14 | * VerificationConstraint matches if the actual and expected value are not equal. 15 | * @param illegal value which should not match. 16 | * @property illegal value which should not match. 17 | * @see ArgumentConstraint 18 | * @author Matthias Geisler 19 | */ 20 | public fun isNot(illegal: Any?): ArgumentConstraint = not(eq(illegal)) 21 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/constraints/isNotSame.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | @file:Suppress("ClassName", "ktlint:standard:filename") 7 | 8 | package tech.antibytes.kmock.verification.constraints 9 | 10 | import tech.antibytes.kmock.KMockContract.ArgumentConstraint 11 | 12 | /** 13 | * VerificationConstraint matches if the actual and expected value are not identical. 14 | * @param illegal value which should not match. 15 | * @property illegal value which should not match. 16 | * @see ArgumentConstraint 17 | * @author Matthias Geisler 18 | */ 19 | public fun isNotSame( 20 | illegal: Any?, 21 | ): ArgumentConstraint = not(isSame(illegal)) 22 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/constraints/isSame.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ClassName", "ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.verification.constraints 10 | 11 | import tech.antibytes.kmock.KMockContract.ArgumentConstraint 12 | 13 | /** 14 | * VerificationConstraint matches if the actual and expected value are identical. 15 | * @param expected the expected value which should match. 16 | * @property expected the expected value which should match. 17 | * @see ArgumentConstraint 18 | * @author Matthias Geisler 19 | */ 20 | public class isSame( 21 | private val expected: Any?, 22 | ) : ArgumentConstraint { 23 | override fun matches(actual: Any?): Boolean = expected === actual 24 | 25 | override fun toString(): String = "same($expected)" 26 | } 27 | -------------------------------------------------------------------------------- /kmock/src/commonMain/kotlin/tech/antibytes/kmock/verification/constraints/not.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ClassName", "ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.verification.constraints 10 | import tech.antibytes.kmock.KMockContract.ArgumentConstraint 11 | 12 | public class not( 13 | private val constraint: ArgumentConstraint, 14 | ) : ArgumentConstraint { 15 | override fun matches(actual: Any?): Boolean = !constraint.matches(actual) 16 | 17 | override fun toString(): String = "not($constraint)" 18 | } 19 | -------------------------------------------------------------------------------- /kmock/src/commonTest/kotlin/tech/antibytes/kmock/fixture/Proxy.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.fixture 8 | 9 | import tech.antibytes.kfixture.PublicApi 10 | import tech.antibytes.kfixture.fixture 11 | import tech.antibytes.mock.PropertyProxyStub 12 | import tech.antibytes.mock.SyncFunProxyStub 13 | 14 | internal fun PublicApi.Fixture.funProxyFixture( 15 | id: String? = null, 16 | calls: Int? = null, 17 | freeze: Boolean? = null, 18 | ): SyncFunProxyStub { 19 | return SyncFunProxyStub( 20 | id ?: this.fixture(), 21 | calls ?: this.fixture(), 22 | frozen = freeze ?: this.fixture(), 23 | ) 24 | } 25 | 26 | internal fun PublicApi.Fixture.propertyProxyFixture( 27 | id: String? = null, 28 | calls: Int? = null, 29 | freeze: Boolean? = null, 30 | ): PropertyProxyStub { 31 | return PropertyProxyStub( 32 | id ?: this.fixture(), 33 | calls ?: this.fixture(), 34 | frozen = freeze ?: this.fixture(), 35 | ) 36 | } 37 | -------------------------------------------------------------------------------- /kmock/src/commonTest/kotlin/tech/antibytes/kmock/fixture/VerificationHandle.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.fixture 10 | 11 | import tech.antibytes.kfixture.PublicApi 12 | import tech.antibytes.kfixture.listFixture 13 | import tech.antibytes.kmock.KMockContract 14 | import tech.antibytes.kmock.verification.Expectation 15 | 16 | internal fun PublicApi.Fixture.fixtureVerificationHandle( 17 | proxy: KMockContract.Proxy<*, *>? = null, 18 | calls: Int? = null, 19 | callIndices: List? = null, 20 | ): Expectation { 21 | return Expectation( 22 | proxy ?: this.funProxyFixture(), 23 | callIndices ?: this.listFixture(size = calls ?: 23), 24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /kmock/src/commonTest/kotlin/tech/antibytes/kmock/proxy/NoopCollectorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.proxy 8 | 9 | import kotlin.js.JsName 10 | import kotlin.test.Test 11 | import tech.antibytes.kmock.KMockContract 12 | import tech.antibytes.mock.SyncFunProxyStub 13 | import tech.antibytes.util.test.fulfils 14 | import tech.antibytes.util.test.mustBe 15 | 16 | class NoopCollectorSpec { 17 | @Test 18 | @JsName("fn0") 19 | fun `It fulfils Collector`() { 20 | NoopCollector fulfils KMockContract.Collector::class 21 | } 22 | 23 | @Test 24 | @JsName("fn1") 25 | fun `addReference is called with a Proxy and call index it does nothing`() { 26 | val actual = NoopCollector.addReference( 27 | SyncFunProxyStub("", -23), 28 | 23, 29 | ) 30 | 31 | actual mustBe Unit 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /kmock/src/commonTest/kotlin/tech/antibytes/kmock/proxy/UnitFunRelaxerSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.proxy 8 | 9 | import kotlin.js.JsName 10 | import kotlin.test.Test 11 | import tech.antibytes.util.test.mustBe 12 | 13 | class UnitFunRelaxerSpec { 14 | @Test 15 | @JsName("fn0") 16 | fun `Given kmockUnitFunRelaxer is called it returns Unit if the refered type is Unit`() { 17 | kmockUnitFunRelaxer("xx") mustBe Unit 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /kmock/src/commonTest/kotlin/tech/antibytes/kmock/util/ClassNameExtractorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:function-naming") 8 | 9 | package tech.antibytes.kmock.util 10 | 11 | import kotlin.js.JsName 12 | 13 | expect class ClassNameExtractorSpec { 14 | @JsName("fn0") 15 | fun `Given extractKClassName is called it returns the of the class name`() 16 | } 17 | -------------------------------------------------------------------------------- /kmock/src/commonTest/kotlin/tech/antibytes/mock/AsserterStub.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.mock 8 | 9 | import tech.antibytes.kmock.KMockContract 10 | 11 | class AsserterStub( 12 | override val references: List, 13 | ) : KMockContract.Asserter { 14 | override fun clear() { 15 | TODO("Not yet implemented") 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /kmock/src/jsMain/kotlin/tech/antibytes/kmock/SafeJvmName.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock 8 | 9 | public actual annotation class SafeJvmName(actual val name: String) // Noop 10 | -------------------------------------------------------------------------------- /kmock/src/jsMain/kotlin/tech/antibytes/kmock/util/ClassNameExtractor.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.util 10 | 11 | import kotlin.reflect.KClass 12 | 13 | internal actual fun extractKClassName(clazz: KClass<*>): String? = clazz.toString() 14 | -------------------------------------------------------------------------------- /kmock/src/jsTest/kotlin/tech/antibytes/kmock/util/ClassNameExtractorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.util 10 | 11 | import kotlin.test.Test 12 | import tech.antibytes.util.test.mustBe 13 | 14 | actual class ClassNameExtractorSpec { 15 | @Test 16 | @JsName("fn0") 17 | actual fun `Given extractKClassName is called it returns the of the class name`() { 18 | extractKClassName(Any::class) mustBe Any::class.toString() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /kmock/src/jvmMain/kotlin/tech/antibytes/kmock/SafeJvmName.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock 8 | 9 | public actual typealias SafeJvmName = JvmName 10 | -------------------------------------------------------------------------------- /kmock/src/jvmMain/kotlin/tech/antibytes/kmock/util/ClassNameExtractor.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.util 10 | 11 | import kotlin.reflect.KClass 12 | 13 | internal actual fun extractKClassName(clazz: KClass<*>): String? = clazz.qualifiedName 14 | -------------------------------------------------------------------------------- /kmock/src/jvmTest/kotlin/tech/antibytes/kmock/util/ClassNameExtractorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.util 8 | 9 | import org.junit.Test 10 | import tech.antibytes.util.test.mustBe 11 | 12 | actual class ClassNameExtractorSpec { 13 | @Test 14 | actual fun `Given extractKClassName is called it returns the of the class name`() { 15 | extractKClassName(Any::class) mustBe Any::class.qualifiedName 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /kmock/src/nativeMain/kotlin/tech/antibytes/kmock/SafeJvmName.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock 8 | 9 | public actual annotation class SafeJvmName(actual val name: String) // Noop 10 | -------------------------------------------------------------------------------- /kmock/src/nativeMain/kotlin/tech/antibytes/kmock/util/ClassNameExtractor.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.util 10 | 11 | import kotlin.reflect.KClass 12 | 13 | internal actual fun extractKClassName(clazz: KClass<*>): String? = clazz.qualifiedName 14 | -------------------------------------------------------------------------------- /kmock/src/nativeTest/kotlin/tech/antibytes/kmock/util/ClassNameExtractorSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | @file:Suppress("ktlint:standard:filename") 8 | 9 | package tech.antibytes.kmock.util 10 | 11 | import kotlin.test.Test 12 | import tech.antibytes.util.test.mustBe 13 | 14 | actual class ClassNameExtractorSpec { 15 | @Test 16 | actual fun `Given extractKClassName is called it returns the of the class name`() { 17 | extractKClassName(Any::class) mustBe Any::class.qualifiedName 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /playground/src/androidMain/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /playground/src/androidMain/kotlin/tech/antibytes/kmock/example/contract/AndroidThing.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.example.contract 8 | 9 | interface AndroidThing { 10 | fun doSomeAndroidThings() 11 | } 12 | -------------------------------------------------------------------------------- /playground/src/androidMain/kotlin/tech/antibytes/kmock/example/contract/PlatformDecoder.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.example.contract 8 | 9 | import android.util.Base64 10 | 11 | actual typealias PlatformDecoder = Base64 12 | -------------------------------------------------------------------------------- /playground/src/commonMain/kotlin/tech/antibytes/kmock/example/contract/PlatformDecoder.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.example.contract 8 | 9 | expect class PlatformDecoder 10 | -------------------------------------------------------------------------------- /playground/src/iosMain/kotlin/tech/antibytes/kmock/example/contract/PlatformThingContract.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.example.contract 8 | 9 | import platform.Foundation.NSData 10 | 11 | interface PlatformThingContract { 12 | val payload: NSData 13 | } 14 | -------------------------------------------------------------------------------- /playground/src/iosTest/kotlin/tech/antibytes/kmock/example/contract/PlatformDecoderSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.example.contract 8 | 9 | import kotlin.test.Test 10 | import tech.antibytes.kmock.Mock 11 | 12 | @Mock(PlatformThingContract::class) 13 | class PlatformDecoderSpec { 14 | @Test 15 | fun doSomething() { 16 | // Nothing 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /playground/src/jsMain/kotlin/tech/antibytes/kmock/example/contract/ExampleContractJs.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.example.contract 8 | 9 | interface ExampleContractJs { 10 | interface JsDecoder { 11 | fun createJsDecoder(): dynamic 12 | fun createJsDecoder(seed: Int): dynamic 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /playground/src/jsMain/kotlin/tech/antibytes/kmock/example/contract/PlatformDecoder.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.example.contract 8 | 9 | actual typealias PlatformDecoder = Any 10 | -------------------------------------------------------------------------------- /playground/src/jsTest/kotlin/tech/antibytes/kmock/example/contract/JsDecoderAutoSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.example.contract 8 | 9 | import kotlin.test.Test 10 | import tech.antibytes.kmock.Mock 11 | import tech.antibytes.util.test.fulfils 12 | 13 | @Mock(ExampleContractJs.JsDecoder::class) 14 | class JsDecoderAutoSpec { 15 | @Test 16 | @JsName("fn0") 17 | fun `It fulfils JsDecoder`() { 18 | JsDecoderMock() fulfils ExampleContractJs.JsDecoder::class 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /playground/src/jvmMain/kotlin/tech/antibytes/kmock/example/contract/ExampleContractJvm.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.example.contract 8 | 9 | import java.util.Base64 10 | 11 | interface ExampleContractJvm { 12 | interface JvmDecoder { 13 | fun createJvmDecoder(): Base64 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /playground/src/jvmMain/kotlin/tech/antibytes/kmock/example/contract/PlatformDecoder.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.example.contract 8 | 9 | import java.util.Base64 10 | 11 | actual typealias PlatformDecoder = Base64 12 | -------------------------------------------------------------------------------- /playground/src/jvmTest/kotlin/tech/antibytes/kmock/example/contract/JvmDecoderAutoSpec.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.example.contract 8 | 9 | import org.junit.Test 10 | import tech.antibytes.kmock.Mock 11 | import tech.antibytes.util.test.fulfils 12 | 13 | @Mock( 14 | ExampleContractJvm.JvmDecoder::class, 15 | ) 16 | class JvmDecoderAutoSpec { 17 | @Test 18 | fun `It fulfils JvmDecoder`() { 19 | JvmDecoderMock() fulfils ExampleContractJvm.JvmDecoder::class 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /playground/src/nativeMain/kotlin/tech/antibytes/kmock/example/contract/PlatformDecoder.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.kmock.example.contract 8 | 9 | actual typealias PlatformDecoder = Any 10 | -------------------------------------------------------------------------------- /setup/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | pluginManagement { 7 | repositories { 8 | val antibytesPlugins = "^tech\\.antibytes\\.[\\.a-z\\-]+" 9 | gradlePluginPortal() 10 | google() 11 | maven { 12 | setUrl("https://raw.github.com/bitPogo/maven-snapshots/main/snapshots") 13 | content { 14 | includeGroupByRegex(antibytesPlugins) 15 | } 16 | } 17 | maven { 18 | setUrl("https://raw.github.com/bitPogo/maven-rolling-releases/main/rolling") 19 | content { 20 | includeGroupByRegex(antibytesPlugins) 21 | } 22 | } 23 | mavenCentral() 24 | mavenLocal() 25 | } 26 | } 27 | 28 | plugins { 29 | id("tech.antibytes.gradle.dependency.settings") version "288f8da" 30 | } 31 | 32 | rootProject.name = "kmock-setup" 33 | -------------------------------------------------------------------------------- /setup/src/main/kotlin/tech/antibytes/gradle/kmock/config/SetupPlugin.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.gradle.kmock.config 8 | 9 | import org.gradle.api.Plugin 10 | import org.gradle.api.Project 11 | 12 | class SetupPlugin : Plugin { 13 | override fun apply(target: Project) { 14 | // nothing to do 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /setup/src/main/kotlin/tech/antibytes/gradle/kmock/config/publishing/KMockConfiguration.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.gradle.kmock.config.publishing 8 | 9 | import org.gradle.api.Project 10 | import tech.antibytes.gradle.publishing.api.PackageConfiguration 11 | import tech.antibytes.gradle.publishing.api.PomConfiguration 12 | 13 | class KMockConfiguration(project: Project) : PublishingGroup() { 14 | val publishing = Publishing(project) 15 | 16 | class Publishing(project: Project) : KMockPublishingConfiguration(project) { 17 | val packageConfiguration = PackageConfiguration( 18 | pom = PomConfiguration( 19 | name = "KMock Runtime", 20 | description = description, 21 | year = year, 22 | url = url, 23 | ), 24 | developers = listOf(developer), 25 | license = license, 26 | scm = sourceControl, 27 | ) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /setup/src/main/kotlin/tech/antibytes/gradle/kmock/config/publishing/KMockProcessorConfiguration.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.gradle.kmock.config.publishing 8 | 9 | import org.gradle.api.Project 10 | import tech.antibytes.gradle.publishing.PublishingApiContract.Type 11 | import tech.antibytes.gradle.publishing.api.PackageConfiguration 12 | import tech.antibytes.gradle.publishing.api.PomConfiguration 13 | 14 | class KMockProcessorConfiguration(project: Project) : PublishingGroup() { 15 | val publishing = Publishing(project) 16 | 17 | class Publishing(project: Project) : KMockPublishingConfiguration(project) { 18 | val packageConfiguration = PackageConfiguration( 19 | type = Type.PURE_JAVA, 20 | pom = PomConfiguration( 21 | name = "KMock Processor", 22 | description = description, 23 | year = year, 24 | url = url, 25 | ), 26 | developers = listOf(developer), 27 | license = license, 28 | scm = sourceControl, 29 | ) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /setup/src/main/kotlin/tech/antibytes/gradle/kmock/config/publishing/KMockPublishingConfiguration.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.gradle.kmock.config.publishing 8 | 9 | import org.gradle.api.Project 10 | import tech.antibytes.gradle.configuration.BasePublishingConfiguration 11 | 12 | open class KMockPublishingConfiguration( 13 | project: Project, 14 | ) : BasePublishingConfiguration(project, "kmock") { 15 | val description = "KMock - a Mock Generator for Kotlin (Multiplatform)." 16 | val url = "https://$gitHubRepositoryPath" 17 | val year = 2022 18 | } 19 | -------------------------------------------------------------------------------- /setup/src/main/kotlin/tech/antibytes/gradle/kmock/config/publishing/PublishingGroup.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.gradle.kmock.config.publishing 8 | 9 | abstract class PublishingGroup { 10 | val group = "tech.antibytes.kmock" 11 | } 12 | -------------------------------------------------------------------------------- /setup/src/main/kotlin/tech/antibytes/gradle/kmock/config/quality/Excludes.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.gradle.kmock.config.quality 8 | 9 | val excludes = setOf( 10 | "playground", 11 | "integration-kmp", 12 | "integration-android-application", 13 | "docs", 14 | ) 15 | -------------------------------------------------------------------------------- /setup/src/main/kotlin/tech/antibytes/gradle/kmock/config/quality/SonarConfiguration.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.gradle.kmock.config.quality 8 | 9 | import org.gradle.api.Project 10 | import tech.antibytes.gradle.quality.api.QualityGateConfiguration 11 | 12 | class SonarConfiguration(project: Project) { 13 | val configuration = QualityGateConfiguration( 14 | project = project, 15 | projectKey = "kmock", 16 | exclude = excludes, 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /setup/src/main/kotlin/tech/antibytes/gradle/kmock/config/quality/StableApi.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | 7 | package tech.antibytes.gradle.kmock.config.quality 8 | 9 | import tech.antibytes.gradle.quality.api.StableApiConfiguration 10 | 11 | object StableApi { 12 | val api = StableApiConfiguration( 13 | excludeProjects = excludes, 14 | ) 15 | } 16 | -------------------------------------------------------------------------------- /setup/src/main/kotlin/tech/antibytes/gradle/kmock/config/repositories/Repositories.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024 Matthias Geisler (bitPogo) / All rights reserved. 3 | * 4 | * Use of this source code is governed by Apache v2.0 5 | */ 6 | package tech.antibytes.gradle.kmock.config.repositories 7 | 8 | import tech.antibytes.gradle.dependency.helper.AntibytesRepository 9 | import tech.antibytes.gradle.dependency.helper.AntibytesUrl 10 | 11 | private val githubGroups = listOf( 12 | "tech.antibytes.gradle", 13 | "tech.antibytes.kfixture", 14 | "tech.antibytes.test-utils-kmp", 15 | ) 16 | 17 | object Repositories { 18 | val kmockRepositories = listOf( 19 | AntibytesRepository( 20 | AntibytesUrl.DEV, 21 | githubGroups, 22 | ), 23 | AntibytesRepository( 24 | AntibytesUrl.SNAPSHOT, 25 | githubGroups, 26 | ), 27 | AntibytesRepository( 28 | AntibytesUrl.ROLLING, 29 | githubGroups, 30 | ), 31 | ) 32 | } 33 | --------------------------------------------------------------------------------