Last active
December 14, 2023 10:27
-
-
Save burcuakkayaa/c8366b425a5d8b6efd8bea353ddffccb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package api.core.services.mock | |
import com.github.tomakehurst.wiremock.client.WireMock | |
import com.github.tomakehurst.wiremock.stubbing.StubMapping | |
import java.util.* | |
class UsersMockApiController { | |
companion object { | |
fun postNewUserMapping( | |
requestBody: String, | |
statusCode: Int, | |
specificStubMockId: UUID, | |
responseBody: String | |
): StubMapping { | |
return WireMock.stubFor( | |
WireMock.post(WireMock.urlEqualTo("/users")) | |
.withId(specificStubMockId) | |
.withRequestBody(WireMock.equalToJson(requestBody)) | |
.willReturn( | |
WireMock.aResponse() | |
.withStatus(statusCode) | |
.withHeader("Content-Type", "application/json; charset=UTF-8") | |
.withBody(responseBody) | |
) | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment