data class Contract private constructor( | |
val request: Request, | |
val response: Response | |
) { | |
class Builder { | |
var request = Request.Builder() | |
var response = Response.Builder() | |
fun build(): Contract { | |
return Contract(request.build(), response.build()) | |
} | |
} | |
} | |
class Request private constructor( | |
val path: String, | |
val method: HttpMethod, | |
val body: String?, | |
val headers: HttpHeaders | |
) { | |
class Builder { | |
var path = "" | |
var method = HttpMethod.GET | |
var body: String? = null | |
var expect = Response.Builder() | |
var headers = HttpHeaders() | |
fun build(): Request { | |
return Request(path, method, body?.trimIndent(), headers) | |
} | |
} | |
} | |
class Response private constructor( | |
val status: HttpStatus, | |
val body: String? | |
) { | |
class Builder { | |
var status = HttpStatus.OK | |
var body: String? = null | |
fun build(): Response { | |
return Response(status, body?.trimIndent()) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment