Groovy easy way to mock HTTP request

I have very simple connector to connect to rest API:

class ApiConnector {    def url     ApiConnector(url) {       this.url = url   }    def get(enpointName) {     "$url/$endpointName".toUrl().text   } } 

And my problem is that I want to have unit tests for the get method with some mocked outputs. I want to do this with Spock but don't know how actually can I approach this. Any help?


Category: groovy Time: 2016-07-31 Views: 3
Tags: groovy spock

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.158 (s). 12 q(s)