{"id":17499448,"url":"https://github.com/toolisticon/jgiven-kotlin","last_synced_at":"2025-06-25T17:09:59.760Z","repository":{"id":36955006,"uuid":"333476571","full_name":"toolisticon/jgiven-kotlin","owner":"toolisticon","description":"Extensions to make working with jgiven.org and Kotlin even more fun","archived":false,"fork":false,"pushed_at":"2025-05-15T17:39:42.000Z","size":372,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-05-15T18:06:18.727Z","etag":null,"topics":["bdd","jgiven","kotlin","testing"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toolisticon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-27T15:42:26.000Z","updated_at":"2025-05-15T17:39:44.000Z","dependencies_parsed_at":"2023-10-17T12:16:47.764Z","dependency_job_id":"78373a5c-6b4e-4613-af20-04b9228d24b0","html_url":"https://github.com/toolisticon/jgiven-kotlin","commit_stats":{"total_commits":220,"total_committers":5,"mean_commits":44.0,"dds":0.35,"last_synced_commit":"90fb0e4f2827e2729144d4dad6e98e129620685d"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/toolisticon/jgiven-kotlin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toolisticon%2Fjgiven-kotlin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toolisticon%2Fjgiven-kotlin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toolisticon%2Fjgiven-kotlin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toolisticon%2Fjgiven-kotlin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toolisticon","download_url":"https://codeload.github.com/toolisticon/jgiven-kotlin/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toolisticon%2Fjgiven-kotlin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261917440,"owners_count":23229919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bdd","jgiven","kotlin","testing"],"created_at":"2024-10-19T17:08:01.416Z","updated_at":"2025-06-25T17:09:59.736Z","avatar_url":"https://github.com/toolisticon.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jgiven-kotlin\n\nExtensions that make working with the JVM BDD testing tool [JGiven](https://jgiven.org) and Kotlin even more fun.\n\n[![stable](https://img.shields.io/badge/lifecycle-STABLE-green.svg)](https://github.com/toolisticon#stable)\n[![Build Status](https://github.com/toolisticon/jgiven-kotlin/workflows/Development%20branches/badge.svg)](https://github.com/toolisticon/jgiven-kotlin/actions)\n[![sponsored](https://img.shields.io/badge/sponsoredBy-Holisticon-red.svg)](https://holisticon.de/)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.toolisticon.testing/jgiven-kotlin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.toolisticon.testing/jgiven-kotlin)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftoolisticon%2Fjgiven-kotlin.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftoolisticon%2Fjgiven-kotlin?ref=badge_shield)\n\n## Usage \n\n### Maven\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.toolisticon.testing\u003c/groupId\u003e\n  \u003cartifactId\u003ejgiven-kotlin\u003c/artifactId\u003e\n  \u003cversion\u003e2.0.2.0\u003c/version\u003e\n  \u003cscope\u003etest\u003c/scope\u003e  \n\u003c/dependency\u003e\n\n```\n\n## Features\n\n### GIVEN,WHEN,THEN\n\nwhen using kotlin, instead of\n\n```\ngiven()\n  .some_facts()\n\n`when`()  // when is a keyword in kotlin\n  .something_happens()\n\nthen()\n  .expect_a_result()\n\n```\n\nyou can simply use the dynamic extension properties:\n\n```kotlin\nGIVEN\n  .some_facts();\n\nWHEN\n  .something_happens()\n\nTHEN\n  .expect_a_result()\n```\n\n(written in CAPS to avoid keyword conflicts).\n\n### Implementing Stages\n\nIn jgiven-java, you have to do:\n\n```java\nclass MyStage extends Stage\u003cMyStage\u003e {\n\n  MyStage my_step() {\n    // what the step does\n    return self();\n  }\n}\n```\n\njgiven-kotlin introduces the inline extension function `step()`, so this can be simplified to:\n\n```kotlin\n@JGivenKotlinStage\nclass MyStage : Stage\u003cMyStage\u003e() {\n\n  fun `my step`() = step {\n    // what the step does\n  }\n}\n```\n\n### JGivenKotlinStage annotation\n\nSince all classes and functions are final by default in kotlin, you have to explicitly mark everything you write in a Stage to be `open`.\n\nUsing the `JGivenKotlinStage` annotation and kotlin's \"all-open\" compiler plugin, this can be avoided.\n\n#### Gradle\n\n```kotlin\nplugins {\n  id(\"org.jetbrains.kotlin.plugin.allopen\") version \"${kotlin_version}\"\n}\n\n//...\n\nallOpen {\n  annotation(\"io.toolisticon.testing.jgiven.JGivenKotlinStage\")\n}\n```\n\n#### Maven\n\n```xml\n\n\u003cplugin\u003e\n  \u003c!-- Kotlin compiler --\u003e\n  \u003cartifactId\u003ekotlin-maven-plugin\u003c/artifactId\u003e\n  \u003cgroupId\u003eorg.jetbrains.kotlin\u003c/groupId\u003e\n  \u003cconfiguration\u003e\n    \u003ccompilerPlugins\u003e\n      \u003cplugin\u003eall-open\u003c/plugin\u003e\n    \u003c/compilerPlugins\u003e\n    \u003cpluginOptions\u003e\n      \u003coption\u003eall-open:annotation=io.toolisticon.testing.jgiven.JGivenKotlinStage\u003c/option\u003e\n    \u003c/pluginOptions\u003e\n  \u003c/configuration\u003e\n  \u003c!-- ... --\u003e\n  \u003cdependencies\u003e\n    \u003cdependency\u003e\n      \u003cgroupId\u003eorg.jetbrains.kotlin\u003c/groupId\u003e\n      \u003cartifactId\u003ekotlin-maven-allopen\u003c/artifactId\u003e\n      \u003cversion\u003e${kotlin.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n  \u003c/dependencies\u003e\n\u003c/plugin\u003e\n```\n\n## Notes\n\n* These helpers where moved from [jgiven-addons](https://github.com/toolisticon/jgiven-addons) for better separation of concerns and\n  simplified publishing.\n* This extension might become obsolete once jgiven [supports this officially](https://github.com/TNG/JGiven/pull/407).\n\n\n## License\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftoolisticon%2Fjgiven-kotlin.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftoolisticon%2Fjgiven-kotlin?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoolisticon%2Fjgiven-kotlin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoolisticon%2Fjgiven-kotlin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoolisticon%2Fjgiven-kotlin/lists"}