Agent headers 140915

I can look at ways to mock HttpURLConnection in both the get and post
methods in ServerAccessorDriver. Then we can do an assertion that the
header has been set after the call. It's of limited value though - we're
not asserting expected behaviour, rather just that we have set it ... I
guess it's worthwhile enough

On Wed, Sep 17, 2014 at 11:56 AM, Andrew Mackenzie <notifications@github.com
> wrote:

> In src/test/java/threescale/v3/api/impl/ServiceAccessorDriverTest.java:
>
> > +		
> > +    @Before
> > +    public void setup() {
> > +
> > +    }
> > +
> > +    @Test
> > +    public void testClientHeader() {
> > +    	String actualClientHeader = underTest.getPluginHeaderValue();
> > +    	String expectedHedaer = ServerAccessor.X_3SCALE_USER_CLIENT_HEADER_JAVA_PLUGIN+expectedMvenVersion;
> > +    	assertEquals(actualClientHeader, expectedHedaer);
> > +    }
> > +
> > +    //@Test
> > +    public void testGet() throws ServerError {
> > +    	String testUrl = "http://requestb.in/1k27m9c1"; //inspect the headers at http://requestb.in/1k27m9c1?inspect
>
> If you want a java library for mocking server responses, you could look at
> this one.
> https://github.com/square/okhttp/tree/master/mockwebserver
> I've only used in Android, but should also be OK for plain Java I think
> (not sure how it hooks into the httpClient)...
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/3scale/3scale_ws_api_for_java/pull/22/files#r17655560>
> .
>