A tool for mocking HTTP services

Overview

WireMock - a web service test double for all occasions

Build Status Maven Central

Key Features

  • HTTP response stubbing, matchable on URL, header and body content patterns
  • Request verification
  • Runs in unit tests, as a standalone process or as a WAR app
  • Configurable via a fluent Java API, JSON files and JSON over HTTP
  • Record/playback of stubs
  • Fault injection
  • Per-request conditional proxying
  • Browser proxying for request inspection and replacement
  • Stateful behaviour simulation
  • Configurable response delays

Full documentation can be found at wiremock.org

Questions and Issues

If you have a question about WireMock, or are experiencing a problem you're not sure is a bug please post a message to the WireMock mailing list.

On the other hand if you're pretty certain you've found a bug please open an issue.

Contributing

We welcome bug fixes and new features in the form of pull requests. If you'd like to contribute, please be mindful of the following guidelines:

  • All changes should include suitable tests, whether to demonstrate the bug or exercise and document the new feature.
  • Please make one change per pull request.
  • If the new feature is significantly large/complex/breaks existing behaviour, please first post a summary of your idea on the mailing list to generate a discussion. This will avoid significant amounts of coding time spent on changes that ultimately get rejected.
  • Try to avoid reformats of files that change the indentation, tabs to spaces etc., as this makes reviewing diffs much more difficult.

Building WireMock locally

To run all of WireMock's tests:

./gradlew clean test

To build both JARs (thin and standalone):

./gradlew -c release-settings.gradle :java8:shadowJar

The built JAR will be placed under java8/build/libs.

Developing on IntelliJ IDEA

IntelliJ can't import the gradle build script correctly automatically, so run

./gradlew -c release-settings.gradle :java8:idea

Make sure you have no .idea directory, the plugin generates old style .ipr, .iml & .iws metadata files.

You may have to then set up your project SDK to point at your Java 8 installation.

Then edit the module settings. Remove the "null" Source & Test source folders from all modules. Add wiremock as a module dependency to Java 7 & Java 8.

Comments
  • PUT stub seems to fail if test method runs too fast

    PUT stub seems to fail if test method runs too fast

    Hi - I am using version 1.42, and am using JUnit 4 and the SpringJUnit4ClassRunner.

    I have a JUnit test case in which I have created a number of test cases that establish GET mappings, all of which work when the test class is run. However, when I add a PUT mapping (the URL is very similar but not identical to the GETs) it often fails with a read connect timeout. Although other times it succeeds quite rapidly. What I've found is that if I do a Thread.sleep(5000) at the beginning of the test method, it works consistently.

    Could the start-up of the server not be fully complete when the test method begins? Maybe the SpringJUnit4ClassRunner is not waiting for the rule to be fully initialized.

    Have you ever encountered an issue like this?

    bug 
    opened by joegluntz 135
  • WireMock with JUnit 5

    WireMock with JUnit 5

    In JUnit 5, @Rule and @ClassRule is superseded by @ExtendWith, which requires extension class. And it seems like extension for WireMock is not yet supported. Is there any alternative way to use WireMock with stubbing and verification via JUnit 5?

    enhancement 
    opened by wonha 64
  • Spring WebFlux reactive threads hanging, required Jetty 9.4.x

    Spring WebFlux reactive threads hanging, required Jetty 9.4.x

    Wiremock is using a version of Jetty 9.2.x and for the new version of Spring Boot with the WebFlux (2.0.0.RELEASE) Reactive threads sometimes the calling thread stops and hanging when calling Wiremock. This problem occurs only in version 9.2.x and not in 9.4.8.v20171121 of Jetty.

    I understand that you want the JDK 7 support, but in that case you'll lose support for newer technologies/frameworks like Spring WebFlux, HTTP2 and so on... Wiremock with version 9.2.x of Jetty is unusable with reactive threads because it randomly stops hanging.

    I saw your conversation on https://github.com/tomakehurst/wiremock/pull/887 thread and the commit https://github.com/tomakehurst/wiremock/commit/4368d316ec239bac305f1faadedab24765bbe4b6, but somehow it will be very nice if you can provide support for the new Spring 5 WebFlux (Spring Boot WebFlux 2.0.0.RELEASE).

    Add another JAR artifact to the build that's Java 8+ only and uses the latest Jetty version. This would probably involve splitting the source tree up into core and version-specific parts, which the build would include/exclude for the various output JARs.

    Add some runtime detection of the environment i.e. are we on Java 8+ and Jetty 9.4+, and load the HTTP/2 code only under these conditions, such that NoClassDefFoundErrors and the like aren't thrown when running on Java 7.

    Any of the above solution should be fine. The idea is to upgrade also the Wiremock Standalone which is used by spring-cloud-contract-wiremock.

    Please see related issues: https://github.com/spring-projects/spring-boot/issues/10569 https://github.com/reactor/reactor-netty/issues/264 https://github.com/spring-cloud/spring-cloud-contract/issues/606

    opened by ati90ati 62
  • Unexpected end of file from server exception when several test methods within one class

    Unexpected end of file from server exception when several test methods within one class

    This doesn't seem to be a problem on my own computer. However when I run the maven build on Jenkins, it always fails with the following message: Caused by: java.net.SocketException: SocketException invoking http://localhost:8098/some/useless/path: Unexpected end of file from server.

    I searched Wiremock's config, it doesn't seem that I can change the server timeout settings.

    bug 
    opened by tongguop 57
  • Request matching with dynamic dates

    Request matching with dynamic dates

    Feature request

    As discussed with Tom via the mailing list...

    We're looking to be able to request match on a dynamic date. We have a few calls which always have a date a number of days in the future from the present date. So ideally we want to be able to use the date helper in the request matching.

    e.g.

      "priority": 5,
      "request": {
        "method": "POST",
        "url": "/api/service/fetchPolicy",
        "bodyPatterns": [
          {
            "matchesXPath": "//*[local-name() = 'PolicyNumber' and @Val = 'pol123456']"
          },
          {
            "matchesXPath": "//*[local-name() = 'StartDate' and @Val = '{{now offset=\'30 days\' format=\'yyyy-MM-dd\'}}']"
          }
        ]
      }
    

    Being able to use the full range of options within the date and time response templating helper to set the time/date in different formats, offset by days, hours, minutes etc would be ideal.

    enhancement 
    opened by andy-cross 43
  • Issue #546 - New API endpoint for recording stub mappings

    Issue #546 - New API endpoint for recording stub mappings

    As promised, here's a PR that integrates my wiremock-snapshot extension. It adds a new API endpoint, /__admin/snapshot, for recording stub mappings from the request journal. The README has more details, but here's a summary of the options it accepts:

    • "filters" - Request patterns to use for determining the requests for which to create stub mappings.
      • Possible values: Identical to /__admin/requests/find
      • Default: no filtering.
    • "persist" - If set to true, persist stub mappings to disk. Otherwise, just output them.
      • Possible values: true, false
      • Default: true
    • "sortFields" - Array of fields in the request to use for sorting stub mappings, mainly for output.
      • Possible values: "url", "method", or a header name (e.g. "Accept")
      • Default: no sorting.
    • "captureHeaders" - Header matchers for including headers in the stub mapping. The request is matched against each matcher, and the associated header is added to the stub mapping if there's a match.
      • Possible values: Request matchers for headers.
      • Default: none
    • "outputFormat" - Determines response body.
      • Possible values: "ids" to return array of stub mapping IDs, "full" to return array of stub mapping objects
      • Default: "ids"

    Design issues

    Filtering

    Filtering is currently request-only. I'm not sure if response filtering is desired. If so, we'd probably want to add a new ResponsePattern class (analogous to ResponsePattern) to encapsulate matchers for the response. This would be best accompanied with some refactoring to make Response into a an interface implemented by LoggedResponse .

    Body file extraction/naming

    Currently, the API does not extract the response bodies to a separate file. While it'd be easy to add a flag to enable this, I think more granularity is needed. Body file extraction is useful for large binary responses, but generally undesirable for small JSON responses. Perhaps we can add a "bodyFileCritera" option consisting of matchers that determine whether or not to extract the body. That way, you could use "headers": { "Content-Type": { "doesNotMatch": ".*json.*" } } } to only extract non-JSON responses. Again, we'll probably want to add a ResponsePattern class for this, and a "bodySize" matcher to allow matching by the size of the body.

    Uniqueness/Deduplication

    To ensure stub mappings are unique, I have StubMappingTransformer#apply() generate a MD5 hash of the RequestPattern JSON and set that as the UUID. This is pretty hacky, but it seems to work well. I considered just using hashCode(), but that's not appropriate since it has a high collision probability and the result is not guaranteed to be consistent between executions (see the JavaDoc).

    This makes me wonder why StubMapping IDs are random instead of being a content-based hash. I see this was added in PR #306, but it doesn't seem uniqueness was considered.

    Outputting

    The options available in "outputFormat" seem sufficient to me. If we add body file extraction, we may want to add another output format to serve everything in a zip file.

    Sorting

    I implemented the ability to sort the stub mappings by the request URL, method, or a header. The main use case for this is to make it easier to manually edit the stub mappings. This is arguably better served by extension points, so it might be better to just remove this feature.

    The class used for sorting, RequestFieldsComparator, is pretty hacky and a violation of the open-closed principle, but I couldn't think of a better implementation.

    Extension points

    An extension point for modifying StubMapping objects would be easy to add. Specifically, we could have WireMockApp#buildAdminRequestHandler() pass in the stub mapping extensions along with the API extensions to AdminRoutes, which could then call

    router.add(POST, "/snapshot", new SnapshotTask(this.stubMappingTransformerExtensions));
    

    instead of

    router.add(POST, "/snapshot", SnapshotTask.class);
    

    Adding the ability to customize the file names for persisted mappings would be more complex. Perhaps we could use a wrapper class, e.g. RecordedStubMapping, that would allow extensions to set the name for the mapping file and (if applicable) the body file.

    Statefulness/Scenarios

    It'd be easy to detect duplicate requests and then set the StubMapping scenario name, but I'm not quite sure about naming. We could just use something like UniqueFilenameGenerator to auto-generate the scenario name, but we'll probably want to have some way of customizing it. Maybe a "scenarioNameTemplate" option that accepts a Handlebars template?

    edit: Minor clarifications

    opened by MasonM 34
  • Add a plugin/extension mehanism

    Add a plugin/extension mehanism

    I've previously forked (privately inside a company) to add support for things like proprietary auth mechanisms. I'd rather just take master version + add things to the class path.

    I was thinking of adding an interface something like:

    package com.github.tomakehurst.wiremock.http;
    
    public interface RequestResponseExtension {
        ResponseDefinition filter(Request request, ResponseDefinition responseDefinition);
    }
    

    Then loading all implementations off the class path using https://github.com/ronmamo/reflections (or perhaps java service loader api but this is more work for people providing extensions)

    These could then be picked up in the StubRequestHandler and each request/response passed through?

    I wasn't planning on adding a way to prime them and just have them all picked up and used by default?

    What do you think?

    opened by chbatey 30
  • proxy forwarding using SSL - feature request

    proxy forwarding using SSL - feature request

    First, i apologize if this is not the right place for a request.

    Secondly, I know that from a previous threads this is not allowed per design: https://github.com/tomakehurst/wiremock/issues/62 and https://github.com/tomakehurst/wiremock/issues/139

    Ah, no that's correct - you can't forward proxy onto SSL. This is a general limitation, as the whole point in SSL is preventing man-in-the-middle attacks.

    Is there a way to add this? maybe something like --enable-browser-proxying-with-ssl?

    It would be great to proxy everything from our IIS to it and have to forward all requests to the original endpoint, unless we post an overide for a specific url which WireMock could mock. Our endpoints are about 50% SSL and about 50% non SSL.

    enhancement 
    opened by txjohng 25
  • Create new client every time, to work around obscure and I/O-level multi-threading issues

    Create new client every time, to work around obscure and I/O-level multi-threading issues

    Yes, it's true. On OSX, I encountered an obscure bug.

    To uncover it, I added print statements that I implemented by decorating breakpoints in IDEA:

    This is all in apache's httpcore version 4.4.1. In org.apache.http.protocol.HttpRequestExecutor, I added non-suspending and logging breakpoints as follows:

    Line 122: "REQ: " + System.identityHashCode(conn) + ": " + conn + " => " + request Line 126: "OK: " + System.identityHashCode(conn) + ": " + conn + " => " + request Line 128: "FAIL: " + System.identityHashCode(conn) + ": " + conn + " => " + request + ": " + ex

    A typical output, which shows the bug at the end:

    REQ: 120493608: CPoolProxy{148.121.152.75:56553<->10.179.121.244:8084} => [URL] REQ: 1402900645: CPoolProxy{148.121.152.75:56552<->10.179.121.244:8084} => [URL] OK: 120493608: CPoolProxy{148.121.152.75:56553<->10.179.121.244:8084} => [URL] OK: 1402900645: CPoolProxy{148.121.152.75:56552<->10.179.121.244:8084} => [URL] REQ: 1848886687: CPoolProxy{148.121.152.75:56552<->10.179.121.244:8084} => [URL] FAIL: 1848886687: CPoolProxy{0:0:0:0:0:0:9479:984b:56552<->10.179.121.244:8084} => [URL]: org.apache.http.NoHttpResponseException: The target server failed to respond

    (The [URL]'s are request objects I have edited out, for clarity.)

    The System.identityHashCodes ensure I am printing the same object. We see object #1848886687 goes from one state at request time, and to a new state after. The new state is that the local address has mysteriously become 0:0:0:0:0:0:9479:984b!

    What is that, you say? It is an IPv6 address format. However, it describes the same IPv4 IP address! You can work out what 94.79.98.4b is in decimal for yourself ...

    When does this change occur? When the socket connection flushes the outgoing data. (I.e. the request.) This happens in org.apache.http.impl.io.SessionOutputBufferImpl, line 126:

       this.outstream.write(b, off, len);
    

    Don't ask me how it happens, but before we call write here, the connection is fine. And SOMETIMES, when the call returns, it is screwed, and unable to receive incoming data. (Manifesting as NoHttpResponseException: The target server failed to respond, as above, and the FAIL breakpoint hitting.) Not every time, but pretty often. This is why I suspect multi-threading issues.

    I am serious. Do NOT ask me how this happens. Could be an issue with http-core and/or my network setup. I just know the pull request makes the FAILs go away.

    PS: Sorry about the whitespace/formatting diff, that's my opinionated IDEA. The change is only creating a new client every time. I can clean that up, but it'll have to be a little later.

    PPS: This is NOT an april fool's!

    opened by kjetilv 24
  • Jetty 11 support

    Jetty 11 support

    Jetty 11 support, closes https://github.com/wiremock/wiremock/issues/1760

    • [x] Finish upload refactoring
      • [x] multipart/mixed is not handled yet (4 tests in the MultipartBodyMatchingAcceptanceTest)
    • [X] Fix logging support (slf4j 2.0.0): switched to Logback 1.4.0 since Log4j2 does not support Slf4j 2.0 APIs (yet)
    • [x] HttpServletResponse::setStatus(int sc, String sm) is deprecated and not implemented by Jetty 11 (StubbingAcceptanceTest::settingStatusMessage)
    • [x] Fix failing test cases: 1 test case is failling
      • [x] GeneralCodingRulesTest > RULE_NO_CLASSES_SHOULD_THROW_GENERIC_EXCEPTIONS FAILED
    opened by reta 23
  • GZIP compression does not work for responses to POST requests.

    GZIP compression does not work for responses to POST requests.

    Wiremock registers GzipFilter with default configuration:

    com.github.tomakehurst.wiremock.jetty9.JettyHttpServer
    
    mockServiceContext.addFilter(GzipFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD));
    

    But by default the aforementioned filter handles only GET request.

    org.eclipse.jetty.servlets.GzipFilter
    
    // public void init
    tmp=filterConfig.getInitParameter("methods");
            if (tmp!=null)
            {
                StringTokenizer tok = new StringTokenizer(tmp,",",false);
                while (tok.hasMoreTokens())
                    _methods.add(tok.nextToken().trim().toUpperCase(Locale.ENGLISH));
            }
            else
                _methods.add(HttpMethod.GET.asString());
    
    // public void doFilter()
    if (!_methods.contains(request.getMethod()) || isExcludedPath(requestURI))
            {
                super.doFilter(request,response,chain);
                return;
            }
    
    enhancement 
    opened by arokhmistrov 23
  • StubMapping Transformer are triggered twice because of log in stopRecording

    StubMapping Transformer are triggered twice because of log in stopRecording

    Hello !

    I am using wiremock to record stubs of my integration tests, and I have an issue with the StubMappingTransformer I defined in WireMockConfiguration.options().extensions(...) being triggered twice during the recording of my stubs.

    I put a breakpoint in one of my transformer (in the transform method) to check the stacktrace and here is the two of them during one record:

    The intended one, I guess:

    transform:20, JsonFormatTransformer (com.blablacar.train.common.test.wiremock.servers.record.transformers)
    apply:57, SnapshotStubMappingTransformerRunner (com.github.tomakehurst.wiremock.recording)
    apply:29, SnapshotStubMappingTransformerRunner (com.github.tomakehurst.wiremock.recording)
    transform:625, Lists$TransformingRandomAccessList$1 (wiremock.com.google.common.collect)
    next:52, TransformedIterator (wiremock.com.google.common.collect)
    takeSnapshot:114, Recorder (com.github.tomakehurst.wiremock.recording)
    stopRecording:90, Recorder (com.github.tomakehurst.wiremock.recording)
    stopRecording:508, WireMockApp (com.github.tomakehurst.wiremock.core)
    stopRecording:485, WireMockServer (com.github.tomakehurst.wiremock)
    stop:41, RecordMockServer (com.blablacar.train.common.test.wiremock.servers.record)
    

    and the other one is also in the same function but in a way I don't think this is intended:

    transform:20, JsonFormatTransformer (com.blablacar.train.common.test.wiremock.servers.record.transformers)
    apply:57, SnapshotStubMappingTransformerRunner (com.github.tomakehurst.wiremock.recording)
    apply:29, SnapshotStubMappingTransformerRunner (com.github.tomakehurst.wiremock.recording)
    get:612, Lists$TransformingRandomAccessList (wiremock.com.google.common.collect)
    serializeContents:103, IndexedListSerializer (wiremock.com.fasterxml.jackson.databind.ser.impl)
    serialize:79, IndexedListSerializer (wiremock.com.fasterxml.jackson.databind.ser.impl)
    serialize:18, IndexedListSerializer (wiremock.com.fasterxml.jackson.databind.ser.impl)
    _serialize:480, DefaultSerializerProvider (wiremock.com.fasterxml.jackson.databind.ser)
    serializeValue:319, DefaultSerializerProvider (wiremock.com.fasterxml.jackson.databind.ser)
    serialize:1518, ObjectWriter$Prefetch (wiremock.com.fasterxml.jackson.databind)
    _writeValueAndClose:1219, ObjectWriter (wiremock.com.fasterxml.jackson.databind)
    writeValueAsString:1086, ObjectWriter (wiremock.com.fasterxml.jackson.databind)
    write:88, Json (com.github.tomakehurst.wiremock.common)
    write:74, Json (com.github.tomakehurst.wiremock.common)
    stopRecording:92, Recorder (com.github.tomakehurst.wiremock.recording)
    stopRecording:508, WireMockApp (com.github.tomakehurst.wiremock.core)
    stopRecording:485, WireMockServer (com.github.tomakehurst.wiremock)
    stop:41, RecordMockServer (com.blablacar.train.common.test.wiremock.servers.record)
    

    As you can see if you see the line 92 of Recorder, transformers are getting triggered during the Json.write() only for a logging purpose:

    notifier().info("Stopped recording. Stubs captured:\n" + Json.write(result.getStubMappings()));

    Is this really intended ? Do someone know a workaround for that ?

    Wiremock version: dependency 'com.github.tomakehurst:wiremock-jre8-standalone:2.35.0'

    opened by AlEmerich 0
  • Refactoring

    Refactoring

    Minor refactoring of code smells:

    • Removing unused imports
    • Remove unnecessary method calls
    • Migrate to Java 8 methods
    • Use Java 8 type inference
    • Remove redundant throws clause
    opened by ullenius 0
  • Diff for multipart requests is incorrect

    Diff for multipart requests is incorrect

    I have found a problem with displaying diffs for multipart (form data) requests. Below are three test cases with different behavior.

    1. without_multipart_verify – the text in the diff looks doubled, but it is still OK – I can see the difference between the expected and the actual request
    2. incorrect_diff_without_withRequestBody – the verification exception is correctly thrown, but the displayed diff looks identical; it useless (and wrong)
    3. wrong_diff_with_multipart_verify – the verification exception is correctly thrown too, but the diff is completely wrong: there are data from "actual" in "expected" section.

    Please see the POM, unit tests and console output.

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>org.example</groupId>
        <artifactId>wiremock-bug-sample</artifactId>
        <version>1.0-SNAPSHOT</version>
    
        <properties>
            <maven.compiler.source>8</maven.compiler.source>
            <maven.compiler.target>8</maven.compiler.target>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>com.github.tomakehurst</groupId>
                <artifactId>wiremock-jre8-standalone</artifactId>
                <version>2.35.0</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.13.2</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    
    </project>
    
    import com.github.tomakehurst.wiremock.junit.WireMockRule;
    import org.junit.Rule;
    import org.junit.Test;
    import wiremock.org.apache.hc.client5.http.classic.HttpClient;
    import wiremock.org.apache.hc.client5.http.classic.methods.HttpPost;
    import wiremock.org.apache.hc.client5.http.entity.mime.HttpMultipartMode;
    import wiremock.org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
    import wiremock.org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
    import wiremock.org.apache.hc.core5.http.ContentType;
    
    import java.io.IOException;
    
    import static com.github.tomakehurst.wiremock.client.WireMock.aMultipart;
    import static com.github.tomakehurst.wiremock.client.WireMock.containing;
    import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
    import static com.github.tomakehurst.wiremock.client.WireMock.post;
    import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
    import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
    import static com.github.tomakehurst.wiremock.client.WireMock.verify;
    
    public class WiremockTest {
        @Rule
        public WireMockRule wireMockRule = new WireMockRule(8888);
    
        @Test
        public void without_multipart_verify() throws IOException {
            createStub();
            execute();
    
            verify(
                    postRequestedFor(urlPathEqualTo("/api/storage/file"))
                            .withHeader("content-type", containing("multipart/form-data"))
                            .withRequestBody(containing("Content-Disposition: form-data;"))
                            .withRequestBody(containing("File with different content"))
                            .withRequestBody(containing("\"id\":\"this-value-is-completely-wrong\""))
            );
        }
    
        @Test
        public void incorrect_diff_without_withRequestBody() throws IOException {
            createStub();
            execute();
    
            verify(
                    postRequestedFor(urlPathEqualTo("/api/storage/file"))
                            .withHeader("content-type", containing("multipart/form-data"))
                            .withRequestBodyPart(aMultipart()
                                    .withName("file")
                                    .withBody(containing("File with different content"))
                                    .build())
                            .withRequestBodyPart(aMultipart()
                                    .withName("properties")
                                    .withBody(containing("\"id\":\"this-value-is-completely-wrong\""))
                                    .build())
            );
        }
    
        @Test
        public void wrong_diff_with_multipart_verify() throws IOException {
            createStub();
            execute();
    
            verify(
                    postRequestedFor(urlPathEqualTo("/api/storage/file"))
                            .withHeader("content-type", containing("multipart/form-data"))
                            .withRequestBody(containing("Content-Disposition: form-data;"))
                            .withRequestBodyPart(aMultipart()
                                    .withName("file")
                                    .withBody(containing("File with different content"))
                                    .build())
                            .withRequestBodyPart(aMultipart()
                                    .withName("properties")
                                    .withBody(containing("\"id\":\"this-value-is-completely-wrong\""))
                                    .build())
            );
        }
    
        private void createStub() {
            wireMockRule.stubFor(
                    post("/api/storage/file")
                            .withMultipartRequestBody(aMultipart()
                                    .withName("file"))
                            .withMultipartRequestBody(aMultipart()
                                    .withName("properties"))
                            .willReturn(okJson("{}"))
            );
        }
    
        private void execute() throws IOException {
            byte[] bytes = "Testing file".getBytes();
            MultipartEntityBuilder builder = MultipartEntityBuilder.create();
            builder.setMode(HttpMultipartMode.STRICT);
            builder.addBinaryBody(
                    "file",
                    bytes,
                    ContentType.DEFAULT_BINARY,
                    "filename.txt"
            );
            builder.addTextBody("properties", "{\"id\":\"12345\"}", ContentType.APPLICATION_JSON);
    
            HttpPost post = new HttpPost("http://localhost:8888/api/storage/file");
            post.setEntity(builder.build());
    
            HttpClient client = HttpClientBuilder.create().build();
            client.execute(post);
        }
    }
    
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------< org.example:wiremock-bug-sample >-------------------
    [INFO] Building wiremock-bug-sample 1.0-SNAPSHOT
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ wiremock-bug-sample ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 0 resource
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ wiremock-bug-sample ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ wiremock-bug-sample ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory /home/karol/sandbox/wiremock-bug-sample/src/test/resources
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ wiremock-bug-sample ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ wiremock-bug-sample ---
    [INFO] Surefire report directory: /home/karol/sandbox/wiremock-bug-sample/target/surefire-reports
    
    -------------------------------------------------------
     T E S T S
    -------------------------------------------------------
    Running WiremockTest
    Tests run: 3, Failures: 3, Errors: 0, Skipped: 0, Time elapsed: 0.751 sec <<< FAILURE!
    without_multipart_verify(WiremockTest)  Time elapsed: 0.684 sec  <<< FAILURE!
    com.github.tomakehurst.wiremock.client.VerificationException: No requests exactly matched. Most similar request was:  expected:<
    POST
    /api/storage/file
    
    content-type: multipart/form-data; charset=ISO-8859-1; boundary=b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA
    
    --b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA
    Content-Disposition: form-data; name="file"; filename="filename.txt"
    Content-Type: application/octet-stream
    
    Testing file
    --b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA
    Content-Disposition: form-data; name="properties"
    Content-Type: application/json; charset=UTF-8
    
    {"id":"12345"}
    --b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA--
    
    File with different content
    "id":"this-value-is-completely-wrong"> but was:<
    POST
    /api/storage/file
    
    content-type: multipart/form-data; charset=ISO-8859-1; boundary=b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA
    
    --b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA
    Content-Disposition: form-data; name="file"; filename="filename.txt"
    Content-Type: application/octet-stream
    
    Testing file
    --b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA
    Content-Disposition: form-data; name="properties"
    Content-Type: application/json; charset=UTF-8
    
    {"id":"12345"}
    --b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA--
    
    --b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA
    Content-Disposition: form-data; name="file"; filename="filename.txt"
    Content-Type: application/octet-stream
    
    Testing file
    --b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA
    Content-Disposition: form-data; name="properties"
    Content-Type: application/json; charset=UTF-8
    
    {"id":"12345"}
    --b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA--
    
    --b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA
    Content-Disposition: form-data; name="file"; filename="filename.txt"
    Content-Type: application/octet-stream
    
    Testing file
    --b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA
    Content-Disposition: form-data; name="properties"
    Content-Type: application/json; charset=UTF-8
    
    {"id":"12345"}
    --b6OjUYrfqhKVjoPy6n_RcgzoHgC4Oc5r350jA--
    >
    	at com.github.tomakehurst.wiremock.client.VerificationException.forUnmatchedRequestPattern(VerificationException.java:38)
    	at com.github.tomakehurst.wiremock.client.WireMock.verificationExceptionForNearMisses(WireMock.java:680)
    	at com.github.tomakehurst.wiremock.client.WireMock.verifyThat(WireMock.java:670)
    	at com.github.tomakehurst.wiremock.client.WireMock.verifyThat(WireMock.java:646)
    	at com.github.tomakehurst.wiremock.client.WireMock.verify(WireMock.java:687)
    	at WiremockTest.without_multipart_verify(WiremockTest.java:30)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    	at com.github.tomakehurst.wiremock.junit.WireMockRule$1.evaluate(WireMockRule.java:67)
    	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
    
    incorrect_diff_without_withRequestBody(WiremockTest)  Time elapsed: 0.026 sec  <<< FAILURE!
    com.github.tomakehurst.wiremock.client.VerificationException: No requests exactly matched. Most similar request was:  expected:<
    POST
    /api/storage/file
    
    content-type: multipart/form-data; charset=ISO-8859-1; boundary=hGLFpFdtYsMeW8vzEBsq-CZkk11-yzRp2N
    
    
    > but was:<
    POST
    /api/storage/file
    
    content-type: multipart/form-data; charset=ISO-8859-1; boundary=hGLFpFdtYsMeW8vzEBsq-CZkk11-yzRp2N
    
    
    >
    	at com.github.tomakehurst.wiremock.client.VerificationException.forUnmatchedRequestPattern(VerificationException.java:38)
    	at com.github.tomakehurst.wiremock.client.WireMock.verificationExceptionForNearMisses(WireMock.java:680)
    	at com.github.tomakehurst.wiremock.client.WireMock.verifyThat(WireMock.java:670)
    	at com.github.tomakehurst.wiremock.client.WireMock.verifyThat(WireMock.java:646)
    	at com.github.tomakehurst.wiremock.client.WireMock.verify(WireMock.java:687)
    	at WiremockTest.incorrect_diff_without_withRequestBody(WiremockTest.java:44)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    	at com.github.tomakehurst.wiremock.junit.WireMockRule$1.evaluate(WireMockRule.java:67)
    	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
    
    wrong_diff_with_multipart_verify(WiremockTest)  Time elapsed: 0.021 sec  <<< FAILURE!
    com.github.tomakehurst.wiremock.client.VerificationException: No requests exactly matched. Most similar request was:  expected:<
    POST
    /api/storage/file
    
    content-type: multipart/form-data; charset=ISO-8859-1; boundary=uK-xsW7ETrKH0GDqx47JF3gV8A0bHpu
    
    --uK-xsW7ETrKH0GDqx47JF3gV8A0bHpu
    Content-Disposition: form-data; name="file"; filename="filename.txt"
    Content-Type: application/octet-stream
    
    Testing file
    --uK-xsW7ETrKH0GDqx47JF3gV8A0bHpu
    Content-Disposition: form-data; name="properties"
    Content-Type: application/json; charset=UTF-8
    
    {"id":"12345"}
    --uK-xsW7ETrKH0GDqx47JF3gV8A0bHpu--
    
    
    > but was:<
    POST
    /api/storage/file
    
    content-type: multipart/form-data; charset=ISO-8859-1; boundary=uK-xsW7ETrKH0GDqx47JF3gV8A0bHpu
    
    --uK-xsW7ETrKH0GDqx47JF3gV8A0bHpu
    Content-Disposition: form-data; name="file"; filename="filename.txt"
    Content-Type: application/octet-stream
    
    Testing file
    --uK-xsW7ETrKH0GDqx47JF3gV8A0bHpu
    Content-Disposition: form-data; name="properties"
    Content-Type: application/json; charset=UTF-8
    
    {"id":"12345"}
    --uK-xsW7ETrKH0GDqx47JF3gV8A0bHpu--
    
    
    >
    	at com.github.tomakehurst.wiremock.client.VerificationException.forUnmatchedRequestPattern(VerificationException.java:38)
    	at com.github.tomakehurst.wiremock.client.WireMock.verificationExceptionForNearMisses(WireMock.java:680)
    	at com.github.tomakehurst.wiremock.client.WireMock.verifyThat(WireMock.java:670)
    	at com.github.tomakehurst.wiremock.client.WireMock.verifyThat(WireMock.java:646)
    	at com.github.tomakehurst.wiremock.client.WireMock.verify(WireMock.java:687)
    	at WiremockTest.wrong_diff_with_multipart_verify(WiremockTest.java:63)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    	at com.github.tomakehurst.wiremock.junit.WireMockRule$1.evaluate(WireMockRule.java:67)
    	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
    
    
    Results :
    
    Failed tests:   without_multipart_verify(WiremockTest): No requests exactly matched. Most similar request was:  expected:<(..)
      incorrect_diff_without_withRequestBody(WiremockTest): No requests exactly matched. Most similar request was:  expected:<(..)
      wrong_diff_with_multipart_verify(WiremockTest): No requests exactly matched. Most similar request was:  expected:<(..)
    
    Tests run: 3, Failures: 3, Errors: 0, Skipped: 0
    
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  1.912 s
    [INFO] Finished at: 2022-12-17T02:12:57+01:00
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project wiremock-bug-sample: There are test failures.
    [ERROR]
    [ERROR] Please refer to /home/karol/sandbox/wiremock-bug-sample/target/surefire-reports for the individual test results.
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
    
    
    opened by karol-bujacek 4
  • SLF4J 1.x is not relocated in wiremock-webhook-extension fatjar

    SLF4J 1.x is not relocated in wiremock-webhook-extension fatjar

    Description

    The slf4j-api dependency is not relocated to a dedicated package, e.g. wiremock.org.slf4j. It's rather directly packaged into the fatjar of the wiremock-webhook-extension.

    This results in shadowing of the SLF4j classes in the classpath and logging framework setup issues, when SLF4J 2.x is used in the application project, as now duplicate SLF4J classes are in the classpath.

    In the main Wiremock artifact the slf4j dependency seems to be relocated correctly: https://github.com/wiremock/wiremock/blob/6cfd74d681705407be850762090ae9a195462837/build.gradle#L301

    Environment

    Wiremock / Wiremock Extension Version: 2.35.0

    The Wiremock Webhook Extension is used in a Gradle / Java project to register mappings in a standalone wiremock instance running in a cluster.

    Related Issues

    • https://github.com/wiremock/wiremock/issues/1964
    opened by mixomat 0
  • Bump slf4j-api from 1.7.36 to 2.0.6

    Bump slf4j-api from 1.7.36 to 2.0.6

    Bumps slf4j-api from 1.7.36 to 2.0.6.

    Commits
    • 5ff6f2c prepare for release 2.0.6
    • 2f4aa75 fix SLF4J-575
    • 363f0a5 remove unused parts
    • 171679b SLF4J-574: Add full OSGi headers, especially "uses" clauses
    • 921b5b3 fix FUNDING file
    • e02244c fix FUNDING file
    • 441d458 fix FUNDING file
    • f5e741b add FUNDING file
    • 2e71327 remove unused log4j dependency in the version definition section of pom.xml
    • 3ff2a30 start work on 2.0.6-SNAPSHOT
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies java 
    opened by dependabot[bot] 0
  • Bump slf4j-nop from 1.7.36 to 2.0.6

    Bump slf4j-nop from 1.7.36 to 2.0.6

    Bumps slf4j-nop from 1.7.36 to 2.0.6.

    Commits
    • 5ff6f2c prepare for release 2.0.6
    • 2f4aa75 fix SLF4J-575
    • 363f0a5 remove unused parts
    • 171679b SLF4J-574: Add full OSGi headers, especially "uses" clauses
    • 921b5b3 fix FUNDING file
    • e02244c fix FUNDING file
    • 441d458 fix FUNDING file
    • f5e741b add FUNDING file
    • 2e71327 remove unused log4j dependency in the version definition section of pom.xml
    • 3ff2a30 start work on 2.0.6-SNAPSHOT
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies java 
    opened by dependabot[bot] 0
Releases(3.0.0-beta-2)
  • 3.0.0-beta-2(Dec 30, 2022)

    This is the start of a series of beta releases of WireMock that will add some major new features and introduce some breaking changes, although we'll try to make these as painless as possible.

    Changes in this release:

    • Minimum Java version is now 11
    • Jetty 11 upgrade (also considered beta as performance seems to have regressed a little vs. 9.x)
    • Introduction of a stores abstraction (with default implementations that maintain current behaviour) so that persistent storage backends can be plugged in. API may be subject to change during the beta period.
    Source code(tar.gz)
    Source code(zip)
  • 2.35.0(Nov 2, 2022)

    Enhancements

    • Add a negative contains matcher - thanks Damian Orzepowski
    • Expose a Java API method for removing stubs by ID - thanks Patryk Fraczek
    • Document the import API in the OpenAPI doc - thanks to user i-whammy
    • Added the ability to restrict the addresses WireMock can proxy/record to, as a security measure.

    Fixes

    • Strip Maven directories from the standalone JAR as some were appearing that weren't related to dependencies actually present, confusing scanning tools - thanks to user krageon
    • Dropped back to slf4j 1.7.36 and relocate it in the standalone JAR (ensuring 2.x users won't experience conflicts).
    Source code(tar.gz)
    Source code(zip)
  • 2.34.0(Sep 15, 2022)

    This will be the final 2.x.x release and also the last to support Java 8.

    Fixes

    • Fixed #1689 - incorrect HTTP version header - thanks to user Poojitha
    • Fixed #1882 - bug preventing matching of date/time query params/headers with custom format - thanks Klaas Dellschaft
    • #1930 - Fixed a partial path traversal vulnerability in the file source code - thanks Jonathan Leitschuh
    • Fixed #1783 - proxyUrlPrefixToRemove ignored when using a response definition transformer - thanks to user Ross-H-Projects
    • Fixed #1872 - create a request entity for POST, PUT etc. proxied requests when a content-length header is present, regardless of whether the size is 0.
    • Fixed #1946 - maths helper now supports epoch dates as inputs.

    Enhancements

    • Added a public, non-static getScenarios() method allowing access to all scenarios.

    All dependencies brought up to date including Jetty to 9.4.48.v20220622.

    Source code(tar.gz)
    Source code(zip)
  • 2.33.2(Apr 29, 2022)

    WireMock 2.33.1 was accidentally released using Java 11 rather than 8, resulting in class incompatibilities in places.

    This release is functionally identical but built using Java 8.

    Source code(tar.gz)
    Source code(zip)
  • 2.33.1(Apr 9, 2022)

    Fixes

    • Put name field back on scenario API object having accidentally removed it.
    • Improved validation of scenario set and reset so that reasonable errors are returned when attempting to use non-existent scenario names or states.
    Source code(tar.gz)
    Source code(zip)
  • 2.33.0(Apr 8, 2022)

    This is primarily a maintenance release that brings all dependency versions up to date including a version of Jackson containing the fix for CVE-2020-36518.

    Enhancements

    • Added the ability to set and reset a single scenario's state
    • Proxy will now send a request body for any request method.
    • CORS response headers are now passed back from proxy responses when stub CORS is disabled.

    Performance

    • Improved performance of Request.getHeaders() - thanks Doug Roper.
    • Improved performance of response body JSON parsing - thanks also Doug Roper.
    Source code(tar.gz)
    Source code(zip)
  • 2.32.0(Dec 2, 2021)

    Enhancements

    • Closes #1614 - proper support for subclassing of the JUnit5 WireMockExtension
    • Add support for put/delete file to/from a subfolder (#1087)
    • Closes #956 - added the ability to fetch serve events for a specific stub ID
    • Added ability to query unmatched serve events
    • Added ability to verify requests using a custom matcher
    • Upgraded to Apache HTTP Client 5.x
    • Added WireMock.jsonResponse factory methods (#1428)
    • #745 Need proxyUrlPrefixToRemove for proxy context url mapping (#1556)
    • Removed dependence on Conscrypt for ALPN and HTTP/2
    • Recognize multipart/related and multipart/mixed (#1415)
    • Allow running Wiremock without HTTP Server (#1572)
    • Allow standalone runner to fetch mappings from classpath (#1592)
    • Added new command line parameters "--jetty-header-request-size" and "--jetty-header-response-size" for set a custom size of headers in Jetty. "--jetty-header-buffer-size" is deprecated.

    Fixes

    • Closes #1688 - fall back to HTTPS 1.1 only when no ALPN provider can be loaded
    • Fixed #1643 - regression in date parsing preventing year and year/month only dates
    • #1612 prevent applying scientific notation and rounding to big numbers by ObjectMapper (#1613)
    • Fixed #1608 and #1585 - incorrect zoning of date/times in response templating when truncating

    Code quality

    • Enforce license headers with Spotless
    • Enforce consistent code style with Spotless
    • Upgrade to Gradle 7 + some Gradle config cleanup (#1639)
    • Convert AcceptanceTestBase to JUnit Jupiter to limit future violations (#1669)
    • Enable WireMock to be built on Java 11 and 17
    • Drop JMock in favour of Mockito (#1630)
    Source code(tar.gz)
    Source code(zip)
Owner
Tom Akehurst
Tom Akehurst
MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Rub

MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).

Mock-Server 4k Jan 4, 2023
Most popular Mocking framework for unit tests written in Java

Most popular mocking framework for Java Current version is 3.x Still on Mockito 1.x? See what's new in Mockito 2! Mockito 3 does not introduce any bre

mockito 13.6k Jan 9, 2023
Advanced Java library for integration testing, mocking, faking, and code coverage

Codebase for JMockit 1.x releases - Documentation - Release notes How to build the project: use JDK 1.8 or newer use Maven 3.6.0 or newer; the followi

The JMockit Testing Toolkit 439 Dec 9, 2022
Gatling is a load test tool. It officially supports HTTP, WebSocket, Server-Sent-Events and JMS.

Gatling What is Gatling ? Gatling is a load test tool. It officially supports HTTP, WebSocket, Server-Sent-Events and JMS. Motivation Finding fancy GU

Gatling 5.8k Dec 27, 2022
Java DSL for easy testing of REST services

Testing and validation of REST services in Java is harder than in dynamic languages such as Ruby and Groovy. REST Assured brings the simplicity of usi

REST Assured 6.2k Dec 31, 2022
Cucumber DSL for testing RESTful Web Services

cukes-rest takes simplicity of Cucumber and provides bindings for HTTP specification. As a sugar on top, cukes-rest adds steps for storing and using r

C.T.Co 100 Oct 18, 2022
Java DSL for easy testing of REST services

Testing and validation of REST services in Java is harder than in dynamic languages such as Ruby and Groovy. REST Assured brings the simplicity of usi

REST Assured 6.2k Dec 25, 2022
Sikuli's official repository on github. Ask questions or report bugs at http://launchpad.net/sikuli.

!!!This Sikuli X-1.0rc3 IS NO LONGER SUPPORTED !!! A new version of Sikuli(X) is available since 2013 as a follow up development GitHub repo: RaiMan/S

Sikuli Lab 1.7k Jan 3, 2023
🔌 Simple library to manipulate HTTP requests/responses and capture network logs made by the browser using selenium tests without using any proxies

Simple library to manipulate HTTP requests and responses, capture the network logs made by the browser using selenium tests without using any proxies

Sudharsan Selvaraj 29 Oct 23, 2022
🟪 DeepfakeHTTP is a web server that uses HTTP dumps as a source for responses.

DeepfakeHTTP – Your 100% static dynamic backend DeepfakeHTTP is a web server that uses HTTP dumps as a source for responses. What are people using it

null 445 Dec 30, 2022
Lightweight analysis tool for detecting mutability in Java classes

What is Mutability Detector? Mutability Detector is designed to analyse Java classes and report on whether instances of a given class are immutable. I

Mutability Detector 234 Dec 29, 2022
ShotDroid is a pentesting tool for android.

ShotDroid is a pentesting tool for android. There are 3 tools that have their respective functions, Get files from Android directory, internal and external storage, Android Keylogger + Reverse Shell and Take a webcam shot of the face from the front camera of the phone and PC.

null 179 Jan 8, 2023
simple web3j Demo to be continue,use web3j Brainless Trading,tool for arbitrage automatic trading, copying other transfer,tracking agency addresses, setting profit points, setting prices, grabbing blocks

simple web3j Demo to be continue,use web3j Brainless Trading,tool for arbitrage automatic trading, copying other transfer,tracking agency addresses, setting profit points, setting prices, grabbing blocks

Nate River 262 Jan 7, 2023
High-level contextual steps in your tests for any reporting tool

Xteps High-level contextual steps in your tests for any reporting tool. License Maven Central Javadoc Xteps Xteps Allure Xteps ReportPortal How to use

Evgenii Plugatar 8 Dec 11, 2022
WireMock - A tool for mocking HTTP services

WireMock only uses log4j in its test dependencies. Neither the thin nor standalone JAR depends on or embeds log4j, so you can continue to use WireMock 2.32.0 without any risk of exposue to the recently discovered vulnerability.

null 5.3k Dec 31, 2022
MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Rub

MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).

Mock-Server 4k Jan 4, 2023
httpx - CLI to test HTTP/gRPC/RSocket/Kafka... services by HTTP DSL

httpx: CLI for run http file httpx is a CLI to execute requests from JetBrains Http File. Request types supported by httpx HTTP REST PUB/SUB - Apache

servicex-sh 105 Dec 15, 2022
Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more

Eclipse Jetty Canonical Repository This is the canonical repository for the Jetty project, feel free to fork and contribute now! Submitting a patch or

Eclipse Foundation 3.5k Dec 28, 2022
Most popular Mocking framework for unit tests written in Java

Most popular mocking framework for Java Current version is 3.x Still on Mockito 1.x? See what's new in Mockito 2! Mockito 3 does not introduce any bre

mockito 13.6k Jan 9, 2023
Advanced Java library for integration testing, mocking, faking, and code coverage

Codebase for JMockit 1.x releases - Documentation - Release notes How to build the project: use JDK 1.8 or newer use Maven 3.6.0 or newer; the followi

The JMockit Testing Toolkit 439 Dec 9, 2022