Created
February 25, 2020 12:45
-
-
Save harikrishnan83/2f9c4cda61e7eadef1bf89b785251f47 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
class HttpRequest(private val url: String, private val method: HttpMethod, private val body: String) { | |
fun matches(anotherRequest: HttpRequest): Result { | |
if (this.url != anotherRequest.url) | |
return Failure("URL did not match. ${this.url} not equal to ${anotherRequest.url}") | |
if (this.method != anotherRequest.method) | |
return Failure("Method did not match. ${this.method} not equal to ${anotherRequest.method}") | |
if (this.body != anotherRequest.body) | |
return Failure("Body did not match. ${this.body} not equal to ${anotherRequest.body}") | |
return Success("everything matches") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment