{"id":22462491,"url":"https://github.com/commonjava/http-testserver","last_synced_at":"2025-08-02T05:31:48.498Z","repository":{"id":39760146,"uuid":"38630965","full_name":"Commonjava/http-testserver","owner":"Commonjava","description":"Simple http server suitable for use with functional tests that shouldn't depend on external URLs ","archived":false,"fork":false,"pushed_at":"2024-06-20T16:24:29.000Z","size":150,"stargazers_count":0,"open_issues_count":2,"forks_count":4,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-07-07T00:11:31.407Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Commonjava.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2015-07-06T16:19:50.000Z","updated_at":"2024-05-06T02:46:45.000Z","dependencies_parsed_at":"2025-06-06T17:51:02.552Z","dependency_job_id":null,"html_url":"https://github.com/Commonjava/http-testserver","commit_stats":{"total_commits":37,"total_committers":4,"mean_commits":9.25,"dds":0.2702702702702703,"last_synced_commit":"7b14a2c061414ff2b6a75ee94be5bef4a36a5f7c"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/Commonjava/http-testserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commonjava%2Fhttp-testserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commonjava%2Fhttp-testserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commonjava%2Fhttp-testserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commonjava%2Fhttp-testserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Commonjava","download_url":"https://codeload.github.com/Commonjava/http-testserver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commonjava%2Fhttp-testserver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268339400,"owners_count":24234544,"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-08-02T02:00:12.353Z","response_time":74,"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":[],"created_at":"2024-12-06T09:09:53.996Z","updated_at":"2025-08-02T05:31:48.176Z","avatar_url":"https://github.com/Commonjava.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simulating remote HTTP servers for functional testing\n\nThis is a test fixture, which provides a very basic servlet that registers expected requests and logs access counts for each requested method/pathParts combination. If no expectation is registered for a particular method/pathParts, 404 is returned.\n\nUsage is pretty simple: \n\n#### For junit 4 Rule based\n\n    @Rule\n    public ExpectationServerRule serverRule = new ExpectationServerRule( \"repos\" );\n\n    @Test\n    public void run()\n        throws Exception\n    {\n        final ExpectationServer server = serverRule.getServer();\n        final String pathParts = \"/repos/pathParts/to/something.txt\";\n        final String content = \"this is the content\";\n        final String url = server.formatUrl( pathParts );\n        server.expect( url, 200, content );\n        // Do any assertions....\n        .......\n    }\n\n\n#### For junit 5 Extension Based:\n\n    @ExtendWith(ExpectationServerExtension.class)\n    public class ExpectaionTest{\n\n        @Expected(\"repos\")\n        public ExpectationServer server;\n     \n        @Test\n        public void run()\n            throws Exception\n        {\n            final String pathParts = \"/repos/pathParts/to/something.txt\";\n            final String content = \"this is the content\";\n            final String url = server.formatUrl( pathParts );\n            server.expect( url, 200, content );\n            // Do any assertions....\n            .......\n        }\n    }\nor:\n\n    public class ExpectaionTest{\n\n        @RegisterExtension\n        public ExpectationServerExtension extension = new ExpectationServerExtension(\"repos\");\n     \n        @Test\n        public void run()\n            throws Exception\n        {\n            final ExpectationServer server = extension.getServer();\n            final String pathParts = \"/repos/pathParts/to/something.txt\";\n            final String content = \"this is the content\";\n            final String url = server.formatUrl( pathParts );\n            server.expect( url, 200, content );\n            // Do any assertions....\n            .......\n        }\n    }\n\n#### Quarkus Based Test\n\nThere are some limitations to let junit5 @ExtendWith work together with @QuarkusTest, see https://github.com/quarkusio/quarkus/issues/24911#issuecomment-1098935690  \nSo to make it work, here brings the new annotation to make it work.\n\n\n    @QuarkusTest\n    public class ExpectaionTest{\n\n        @InjectExpected(\"repos\")\n        ExpectationServer server;\n     \n        @Test\n        public void run()\n            throws Exception\n        {\n            final String pathParts = \"/repos/pathParts/to/something.txt\";\n            final String content = \"this is the content\";\n            final String url = server.formatUrl( pathParts );\n            server.expect( url, 200, content );\n            // Do any assertions....\n            .......\n        }\n    }","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonjava%2Fhttp-testserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommonjava%2Fhttp-testserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonjava%2Fhttp-testserver/lists"}