{"id":37024723,"url":"https://github.com/bdmendes/smockito","last_synced_at":"2026-06-18T01:00:56.926Z","repository":{"id":301912064,"uuid":"1010627548","full_name":"bdmendes/smockito","owner":"bdmendes","description":"Tiny Scala facade for Mockito.","archived":false,"fork":false,"pushed_at":"2026-06-12T14:31:02.000Z","size":3331,"stargazers_count":31,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-06-12T16:19:47.412Z","etag":null,"topics":["facade","mocking","mockito","scala","testing","wrapper"],"latest_commit_sha":null,"homepage":"http://smockito.bdmendes.com/","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bdmendes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-29T13:30:57.000Z","updated_at":"2026-06-12T14:31:36.000Z","dependencies_parsed_at":"2025-07-19T12:33:03.408Z","dependency_job_id":"fabc2176-7dc5-4021-85fe-f62a6b01331a","html_url":"https://github.com/bdmendes/smockito","commit_stats":null,"previous_names":["bdmendes/smockito"],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/bdmendes/smockito","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdmendes%2Fsmockito","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdmendes%2Fsmockito/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdmendes%2Fsmockito/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdmendes%2Fsmockito/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bdmendes","download_url":"https://codeload.github.com/bdmendes/smockito/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdmendes%2Fsmockito/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34471639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["facade","mocking","mockito","scala","testing","wrapper"],"created_at":"2026-01-14T02:59:51.686Z","updated_at":"2026-06-18T01:00:56.921Z","avatar_url":"https://github.com/bdmendes.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smockito\n\n\u003cimg src=\"./docs/_assets/logo.svg\" width=\"125\" height=\"125\" align=\"right\"\u003e\n\n[![Build](https://img.shields.io/github/actions/workflow/status/bdmendes/smockito/ci.yml)](https://github.com/bdmendes/smockito/actions)\n[![Codecov](https://img.shields.io/codecov/c/github/bdmendes/smockito/master)](https://app.codecov.io/gh/bdmendes/smockito)\n[![Maven Central](https://img.shields.io/maven-central/v/com.bdmendes/smockito_3)](https://central.sonatype.com/artifact/com.bdmendes/smockito_3/overview)\n\nSmockito is a tiny framework-agnostic Scala 3 facade for [Mockito](https://github.com/mockito/mockito). It enables setting up unique method and value stubs for any type in a type-safe manner, while providing an expressive interface for inspecting received arguments and call counts.\n\nHead to the [microsite](https://smockito.bdmendes.com) for the full documentation and API reference.\n\n## Quick Start\n\nTo use Smockito in an existing sbt project with Scala 3, add the following dependency to your\n`build.sbt`:\n\n```scala\nlibraryDependencies += \"com.bdmendes\" %% \"smockito\" % \"\u003cversion\u003e\" % Test\n```\n\nDo not depend on Mockito directly.\n\nIf targeting Java 24+, you need to add the Smockito JAR as a Java agent to enable the runtime bytecode manipulation that Mockito depends on. If you use the [sbt-javaagent plugin](https://github.com/sbt/sbt-javaagent), you can simply add to your `build.sbt`:\n\n```scala\njavaAgents += \"com.bdmendes\" % \"smockito_3\" % \"\u003cversion\u003e\" % Test\n```\n\nIn your specification, extend `Smockito`. This will bring the `mock` method and relevant conversions to scope. To set up a mock, add stub definitions with the `on` method, which requires an [eta-expanded](https://docs.scala-lang.org/scala3/book/fun-eta-expansion.html) method reference, that you may easily express with `it`, and a [partial function](https://docs.scala-lang.org/scala3/book/fun-partial-functions.html) to handle the relevant inputs.\n\n```scala\nimport com.bdmendes.smockito.Smockito\n\nabstract class Repository[T](val name: String):\n  def getWith(startsWith: String, endsWith: String): List[T]\n\ncase class User(username: String)\n\nclass RepositorySpecification extends Smockito:\n  val repository = mock[Repository[User]]\n    .on(it.getWith):\n      case (\"john\", name) if name.nonEmpty =\u003e List(User(\"johndoe\"))\n```\n\nA `Mock[T]` is a `T` both at compile time and runtime.\n\n```scala\n  assert(repository.getWith(\"john\", \"doe\") == List(User(\"johndoe\")))\n```\n\nYou may reason about method interactions with `calls` and `times`. If arguments are not needed, `times` is more efficient.\n\n```scala\n  assert(repository.calls(it.getWith) == List((\"john\", \"doe\")))\n  assert(repository.times(it.getWith) == 1)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdmendes%2Fsmockito","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbdmendes%2Fsmockito","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdmendes%2Fsmockito/lists"}