{"id":19175344,"url":"https://github.com/mockito/mockito-testng","last_synced_at":"2025-05-07T19:09:44.102Z","repository":{"id":38018236,"uuid":"143094882","full_name":"mockito/mockito-testng","owner":"mockito","description":"Mockito TestNG support","archived":false,"fork":false,"pushed_at":"2025-03-20T05:50:30.000Z","size":271,"stargazers_count":16,"open_issues_count":11,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T19:09:24.314Z","etag":null,"topics":["mocking","mockito","testng"],"latest_commit_sha":null,"homepage":"","language":"Java","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/mockito.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":"2018-08-01T02:42:16.000Z","updated_at":"2025-04-24T09:08:07.000Z","dependencies_parsed_at":"2024-11-09T10:23:04.253Z","dependency_job_id":"c166e5f0-cbfb-407e-ba83-ebe7f77aa78c","html_url":"https://github.com/mockito/mockito-testng","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockito%2Fmockito-testng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockito%2Fmockito-testng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockito%2Fmockito-testng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mockito%2Fmockito-testng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mockito","download_url":"https://codeload.github.com/mockito/mockito-testng/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252940934,"owners_count":21828769,"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":["mocking","mockito","testng"],"created_at":"2024-11-09T10:22:49.106Z","updated_at":"2025-05-07T19:09:43.996Z","avatar_url":"https://github.com/mockito.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mockito for TestNG\n\nMockito utility classes for easy integration with TestNG\n\n[![CI](https://github.com/mockito/mockito-testng/workflows/CI/badge.svg)](https://github.com/mockito/mockito-testng/actions?query=workflow%3ACI)\n\n[![Maven Central](https://img.shields.io/maven-central/v/org.mockito/mockito-testng.svg)](https://search.maven.org/artifact/org.mockito/mockito-testng/)\n\n## Installation\n\n### Gradle\n```Gradle\ndependencies {\n  testCompile \"org.mockito:mockito-testng:VERSION\"\n}\n```\n\n### Maven\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.mockito\u003c/groupId\u003e\n  \u003cartifactId\u003emockito-testng\u003c/artifactId\u003e\n  \u003cversion\u003eVERSION\u003c/version\u003e\n  \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\nFor latest version, see the [releases](https://github.com/mockito/mockito-testng/releases).\n\n## Usage\n\nSimply add `@Listeners` annotation on your test class\n\n```java\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.testng.MockitoTestNGListener;\nimport org.testng.annotations.Listeners;\nimport org.testng.annotations.Test;\n\nimport java.util.Map;\n\n@Listeners(MockitoTestNGListener.class)\npublic class MyTest {\n\n    @Mock\n    Map map;\n\n    @InjectMocks\n    SomeType someType;\n\n    @Test\n    void test() {\n        // ...\n    }\n}\n```\n\n`MockitoTestNGListener` will do job for you and initialize all fields annotated with mockito annotations.\n\nBy default `MockitoSession` is started with `STRICT_STUBS`.  \nYou can change this behavior by adding `@MockitoSettings` to your test class.\n\n```java\nimport org.mockito.quality.Strictness;\nimport org.mockito.testng.MockitoTestNGListener;\nimport org.mockito.testng.MockitoSettings;\nimport org.testng.annotations.Listeners;\n\n@Listeners(MockitoTestNGListener.class)\n@MockitoSettings(strictness = Strictness.WARN)\npublic class MyTest {\n // ...\n}\n```\n\n## Notices\n\n - `MockitoSession` is started before each `test method` or before method annotated with `@BeforeMethod`,\n   another annotations `@BeforeXXX` aren't supported #40\n   \n## Developing\n\n- open in IDEA to develop or run ```./gradlew idea``` and then open in IDEA\n- ```./gradlew build``` - tests code and assembles artifacts\n- ```./gradlew publishToMavenLocal``` - publishes to local Maven repo, useful for local testing\n\n## Releasing\n\nEvery merged pull request is published to Maven Central.\nActually, any change on master that happily builds on CI is published.\nThe release automation uses Shipkit framework (http://shipkit.org).\n\n## History\n\nThe original TestNGListener was a part of the core Mockito repository. However, the jar was never released. Core Mockito team does not work with TestNG so it was hard for us to maintain TestNG integration. In Summer 2018 we moved the TestNG integration to a separate repository under \"Mockito\" organization.\n\n## Help\n\nWe are looking for maintainers of TestNG integration! Let us know if you want to join. Mockito core team has limited capacity and focuses on the core library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmockito%2Fmockito-testng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmockito%2Fmockito-testng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmockito%2Fmockito-testng/lists"}