Skip to content

Instantly share code, notes, and snippets.

View burcuakkayaa's full-sized avatar

Burcu Akkaya burcuakkayaa

View GitHub Profile
package api.endpoints.products
class PostNewProductTests : ApiBaseTest() {
private var stubPostProduct: ThreadLocal<StubMapping>? = null
@BeforeMethod(alwaysRun = true)
fun beforeMethod() {
stubPostProduct = ThreadLocal<StubMapping>()
}
{
"request": {
"method": "POST",
"url": "/products"
},
"response": {
"status": 201,
"body": "{\n \"id\": 31,\n \"title\": \"test product\",\n \"price\": 13.5,\n \"description\": \"lorem ipsum set\",\n \"image\": \"https://i.pravatar.cc\",\n \"category\": \"electronic\"\n}\n",
"headers": {
"Content-Type": "application/json; charset=UTF-8"
package api.endpoints.users
class PostNewUserTests : ApiBaseTest() {
private var stubPostUser: StubMapping? = null
@BeforeMethod(alwaysRun = true)
fun beforeMethod() {
stubPostUser = StubMapping()
}
package api.endpoints.users
import api.ApiBaseTest
import api.controller.model.Sample
import api.core.services.mock.UsersMockApiController
import api.core.utilitys.SampleReaderUtils
import com.github.tomakehurst.wiremock.client.WireMock
import com.github.tomakehurst.wiremock.client.WireMock.*
import com.github.tomakehurst.wiremock.stubbing.StubMapping
import io.restassured.RestAssured.given
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 {
package api
import api.core.constant.Keywords.*
import api.core.utilitys.LogUtils.Companion.logInfo
import com.github.tomakehurst.wiremock.client.WireMock
import org.testng.annotations.BeforeSuite
import java.time.ZoneId
import java.util.*
open class ApiBaseTest {
version: "3"
services:
wiremock:
image: "holomekc/wiremock-gui:latest"
container_name: my_wiremock
ports:
# This is just an example of a port mapping
- "8089:8089"
- "8080:8080"
command:
package api
import com.github.tomakehurst.wiremock.WireMockServer
import com.github.tomakehurst.wiremock.client.WireMock
import com.github.tomakehurst.wiremock.client.WireMock.*
import com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig
import com.github.tomakehurst.wiremock.junit.WireMockRule
import kotlinx.serialization.builtins.serializer
import org.testng.annotations.Test
version: "3"
services:
wiremock:
image: "wiremock/wiremock:3.3.1"
container_name: my_wiremock
ports:
- "8080:8080"
volumes:
- ./__files:/home/wiremock/__files
- ./mappings:/home/wiremock/mappings
<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
<version>3.3.1</version>
</dependency>