{"id":18340943,"url":"https://github.com/fridujo/classpath-junit-extension","last_synced_at":"2025-07-31T02:41:33.598Z","repository":{"id":36515054,"uuid":"227937621","full_name":"fridujo/classpath-junit-extension","owner":"fridujo","description":"JUnit5 extension to run tests with classpath customizations","archived":false,"fork":false,"pushed_at":"2024-07-08T04:26:57.000Z","size":195,"stargazers_count":6,"open_issues_count":13,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T06:34:36.067Z","etag":null,"topics":["classpath","hacktoberfest","junit5"],"latest_commit_sha":null,"homepage":"","language":"Java","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/fridujo.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-12-13T23:17:38.000Z","updated_at":"2024-06-04T03:46:01.000Z","dependencies_parsed_at":"2024-11-05T20:37:11.241Z","dependency_job_id":null,"html_url":"https://github.com/fridujo/classpath-junit-extension","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fridujo/classpath-junit-extension","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fridujo%2Fclasspath-junit-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fridujo%2Fclasspath-junit-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fridujo%2Fclasspath-junit-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fridujo%2Fclasspath-junit-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fridujo","download_url":"https://codeload.github.com/fridujo/classpath-junit-extension/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fridujo%2Fclasspath-junit-extension/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267978175,"owners_count":24175250,"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","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"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":["classpath","hacktoberfest","junit5"],"created_at":"2024-11-05T20:24:44.685Z","updated_at":"2025-07-31T02:41:33.033Z","avatar_url":"https://github.com/fridujo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Classpath modification extension for JUnit5\n[![Build Status](https://travis-ci.com/fridujo/classpath-junit-extension.svg?branch=master)](https://travis-ci.com/fridujo/classpath-junit-extension)\n[![Coverage Status](https://codecov.io/gh/fridujo/classpath-junit-extension/branch/master/graph/badge.svg)](https://codecov.io/gh/fridujo/classpath-junit-extension/)\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.fridujo/classpath-junit-extension.svg)](https://search.maven.org/#search|ga|1|a:\"classpath-junit-extension\")\n[![JitPack](https://jitpack.io/v/fridujo/classpath-junit-extension.svg)](https://jitpack.io/#fridujo/classpath-junit-extension)\n[![License](https://img.shields.io/github/license/fridujo/classpath-junit-extension.svg)](https://opensource.org/licenses/Apache-2.0)\n\nExtension to run tests with classpath customizations.\n\nThe main goal of this project is to allow to write tests (most probably **integration** ones) against various classpaths\nwithout the need to create complex configurations astride _build tool_ and code.\n\nFor example, testing a library behavior without an optional dependency.\n\n## Testing optional dependency\n\n```java\n@Test\nvoid junit_extension_can_be_loaded() throws ClassNotFoundException {\n    assertThat(Class.forName(\"org.junit.jupiter.api.extension.Extension\")).isExactlyInstanceOf(Class.class);\n}\n\n@Test\n@ModifiedClasspath(excludeDependencies = \"junit-jupiter-api\")\nvoid junit_extension_cannot_be_loaded() {\n    assertThatExceptionOfType(ClassNotFoundException.class)\n        .isThrownBy(() -\u003e Class.forName(\"org.junit.jupiter.api.extension.Extension\"));\n}\n```\n\n## Testing retro-compatibility\n\n```java\n@CompatibilityTestWithClasspath(dependencies = {\n    \"spring-rabbit:[1.7.7.RELEASE, 2.0.14.RELEASE, 2.2.4.RELEASE]\"\n})\nvoid amqp_basic_get() {\n    String messageBody = \"Hello world!\";\n    try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AmqpConfiguration.class)) {\n        rabbitTemplate.convertAndSend(EXCHANGE_NAME, \"test.key1\", messageBody);\n\n        Message message = rabbitTemplate.receive(QUEUE_NAME);\n\n        assertThat(message).isNotNull();\n        assertThat(message.getBody()).isEqualTo(messageBody.getBytes());\n    }\n}\n```\n\n## Alternatives\nUse the `maven-invoker-plugin` with **pom.xml** template (see an example [here](https://github.com/fridujo/rabbitmq-mock/blob/78cd20380ea46089193dfbf5e29efd55798343ee/pom.xml#L163)).\n\n## Roadmap\nCurrently this extension uses a _workaround_ to get things done, but it is waiting for [JUnit5 #201](https://github.com/junit-team/junit5/issues/201) to get a cleaner approach at this.\n\nNext things to do:\n* Replace dependencies by other ones (different versions or implementations)\n* Support other **Build Tools** (Gradle, SBT, Ivy, etc.)\n* Make the annotation\n  * available at class level\n  * work in `@Nested` tests\n  * work in conjunction with **injection** / **test-templates** (may require **the classloader extension**)\n  * repeatable, so that the same test can be expected to work against various classpath (different version of a library per se)\n\n## Contribute\nAny contribution is greatly appreciated.\n\n[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#github.com/fridujo/classpath-junit-extension.git)\n\n## Getting Started\n\n### Maven\nAdd the following dependency to your **pom.xml**\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.fridujo\u003c/groupId\u003e\n    \u003cartifactId\u003eclasspath-junit-extension\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\nAdd the following dependency to your **build.gradle**\n```groovy\nrepositories {\n\tmavenCentral()\n}\n\n// ...\n\ndependencies {\n\t// ...\n\ttestCompile('com.github.fridujo:classpath-junit-extension:1.0.0')\n\t// ...\n}\n```\n\n### Building from Source\n\nYou need [JDK-8+](http://jdk.java.net/8/) (at least) to build this extension. The project can be built with Maven using the following command.\n```\nmvn clean package\n```\n\n### Installing in the Local Maven Repository\n\nThe project can be installed in a local Maven Repository for usage in other projects via the following command.\n```\nmvn clean install\n```\n\n### Using the latest SNAPSHOT\n\nThe master of the project pushes SNAPSHOTs in Sonatype's repo.\n\nTo use the latest master build add Sonatype OSS snapshot repository, for Maven:\n```\n\u003crepositories\u003e\n    ...\n    \u003crepository\u003e\n        \u003cid\u003esonatype-oss-spanshots\u003c/id\u003e\n        \u003curl\u003ehttps://oss.sonatype.org/content/repositories/snapshots\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\nFor Gradle:\n```groovy\nrepositories {\n    // ...\n    maven {\n        url \"https://oss.sonatype.org/content/repositories/snapshots\"\n    }\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffridujo%2Fclasspath-junit-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffridujo%2Fclasspath-junit-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffridujo%2Fclasspath-junit-extension/lists"}