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?

Replay

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

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

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