{"id":22303762,"url":"https://github.com/merindorium/guava","last_synced_at":"2025-07-29T04:31:15.832Z","repository":{"id":39708703,"uuid":"203651918","full_name":"merindorium/Guava","owner":"merindorium","description":"A Swift test double library. Guava - looks like an apple but it's not.","archived":false,"fork":false,"pushed_at":"2024-10-24T15:48:29.000Z","size":83,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-25T21:36:24.781Z","etag":null,"topics":["fake","library","spy","stub","swift","test-doubles","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/merindorium.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}},"created_at":"2019-08-21T19:33:24.000Z","updated_at":"2024-10-24T17:46:24.000Z","dependencies_parsed_at":"2024-10-24T19:56:44.520Z","dependency_job_id":"3a22cd02-1d30-4a3f-867f-31a6e2ff9de3","html_url":"https://github.com/merindorium/Guava","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merindorium%2FGuava","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merindorium%2FGuava/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merindorium%2FGuava/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merindorium%2FGuava/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/merindorium","download_url":"https://codeload.github.com/merindorium/Guava/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227979016,"owners_count":17850695,"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":["fake","library","spy","stub","swift","test-doubles","unit-testing"],"created_at":"2024-12-03T18:44:50.507Z","updated_at":"2024-12-03T18:44:51.193Z","avatar_url":"https://github.com/merindorium.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Guava \n\nGuava helps you to make your unit tests more flexible. It allows you to replace parts of your system under test with a test double objects.\n\n----\n\n![build](https://github.com/merindorium/Guava/workflows/build/badge.svg?branch=master)\n![Swift 5.x](https://img.shields.io/badge/Swift-5.x-orange.svg)\n![platform](https://img.shields.io/badge/platform-ios%20%7C%20osx%20%7C%20linux-lightgray.svg)\n![version](https://img.shields.io/github/v/tag/merindorium/guava?label=version)\n\nTable of Contents\n=================\n\n- [Usage](#usage)\n- [Documentation](#documentation)\n- [Installation](#installation)\n\n# Features\n\nGuava provides several types of test doubles:\n\n- Stub\n- Spy\n- Fake\n\n# Usage\n\n```swift\nimport Guava\nimport XCTest\n\nprotocol Calculator {\n\n    func multiply(_ lhs: Int, _ rhs: Int) -\u003e Int\n}\n\nfinal class CalculatorTestDouble: Calculator {\n\n    let multiplyMethod = TestDoubleFactory\u003cInt\u003e()\n\n    func multiply(_ lhs: Int, _ rhs: Int) -\u003e Int {\n        return multiplyMethod.invoke(arguments: [lhs, rhs])\n    }\n}\n\nfinal class CalculatorTestCase: XCTestCase {\n\n    func testMultiply() {\n        let stubValue = 5\n        let calculatorTestDouble = CalculatorTestDouble()\n\n        calculatorTestDouble.multiplyMethod.stub(stubValue)\n\n        let result = calculatorTestDouble.multiply(3, 3)\n        XCTAssertEqual(result, stubValue)\n    }\n}\n```\n\n# Documentation\n\nSee [Documentation](Documentation) section.\n\n# Installation\n\n## Swift Package Manager\n\nTo use `Guava` with SPM update your `Package.swift`.\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"ExampleProject\",\n    dependencies: [\n        .package(url: \"https://github.com/merindorium/Guava.git\", from: \"v1.2.0\")\n    ],\n    ...\n)\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerindorium%2Fguava","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmerindorium%2Fguava","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerindorium%2Fguava/lists"}