1818import com .squareup .okhttp .mockwebserver .MockResponse ;
1919import com .squareup .okhttp .mockwebserver .MockWebServer ;
2020
21- import org .junit .Ignore ;
2221import org .junit .Rule ;
2322import org .junit .Test ;
2423import org .junit .rules .ExpectedException ;
@@ -72,19 +71,18 @@ public void parsesRequestAndResponse() throws IOException, InterruptedException
7271 @ Test
7372 public void parsesErrorResponse () throws IOException , InterruptedException {
7473 thrown .expect (FeignException .class );
75- thrown .expectMessage ("status 500 reading TestInterface#post(String ); content:\n " + "ARGHH" );
74+ thrown .expectMessage ("status 500 reading TestInterface#get( ); content:\n " + "ARGHH" );
7675
7776 server .enqueue (new MockResponse ().setResponseCode (500 ).setBody ("ARGHH" ));
7877
7978 TestInterface api = Feign .builder ()
8079 .client (new OkHttpClient ())
8180 .target (TestInterface .class , "http://localhost:" + server .getPort ());
8281
83- api .post ( "foo" );
82+ api .get ( );
8483 }
8584
8685 @ Test
87- @ Ignore // TODO: Remove on OkHttp 2.5 https://github.com/square/okhttp/issues/1778
8886 public void patch () throws IOException , InterruptedException {
8987 server .enqueue (new MockResponse ().setBody ("foo" ));
9088 server .enqueue (new MockResponse ());
@@ -93,7 +91,7 @@ public void patch() throws IOException, InterruptedException {
9391 .client (new OkHttpClient ())
9492 .target (TestInterface .class , "http://localhost:" + server .getPort ());
9593
96- assertEquals ("foo" , api .patch ());
94+ assertEquals ("foo" , api .patch ("" ));
9795
9896 assertThat (server .takeRequest ())
9997 .hasHeaders ("Accept: text/plain" , "Content-Length: 0" ) // Note: OkHttp adds content length.
@@ -142,8 +140,12 @@ interface TestInterface {
142140 @ Headers ({"Foo: Bar" , "Foo: Baz" , "Qux: " , "Content-Type: text/plain" })
143141 Response post (String body );
144142
143+ @ RequestLine ("GET /" )
144+ @ Headers ("Accept: text/plain" )
145+ String get ();
146+
145147 @ RequestLine ("PATCH /" )
146148 @ Headers ("Accept: text/plain" )
147- String patch ();
149+ String patch (String body );
148150 }
149151}
0 commit comments