https://kotlinlang.org logo
#mockk
Title
# mockk
t

thatadamedwards

06/08/2018, 9:36 PM
I have this little snippet:
Copy code
val (_, _, result) = myUrlString.httpPost()
            .header("Content-Type" to "application/json", "Authorization" to "Bearer $authToken")
            .body(jacksonObjectMapper().writeValueAsString(message))
            .responseString()

        if (result is Result.Failure) {
            val errorMessage = result.error.response.responseMessage

            throw BadRequestException(errorMessage)
        } else {
            return true
        }
d

dave08

06/10/2018, 4:52 PM
I'd say to make an interface for the call and mock that...
t

thatadamedwards

06/11/2018, 3:47 PM
turns out I was an idiot - Fuel requires any string that you make a call on to specify what protocol it’s going to be using (IE - “http://domain.com/“) and I didn’t include it in my test (I had “domain.com/“)
added the protocol to the beginning - test ran like a charm
👍🏼 1
2 Views