Groovy easy way to mock HTTP request

July 31   groovy 0 3 Views

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?



Tags: groovy, spock
PC site About | Contact

©2016 all rights reserved

processed in 0.224 (s). 5 q(s)