3333import java .util .Arrays ;
3434import java .util .List ;
3535import java .util .Map ;
36- import java .util .concurrent .Executor ;
37- import javax .inject .Named ;
3836import javax .inject .Singleton ;
3937import javax .net .ssl .HostnameVerifier ;
4038import javax .net .ssl .SSLSession ;
@@ -63,18 +61,18 @@ interface TestInterface {
6361 @ RequestLine ("POST /" )
6462 @ Body ("%7B\" customer_name\" : \" {customer_name}\" , \" user_name\" : \" {user_name}\" , \" password\" : \" {password}\" %7D" )
6563 void login (
66- @ Named ("customer_name" ) String customer , @ Named ("user_name" ) String user , @ Named ("password" ) String password );
64+ @ Param ("customer_name" ) String customer , @ Param ("user_name" ) String user , @ Param ("password" ) String password );
6765
6866 @ RequestLine ("POST /" ) void body (List <String > contents );
6967
7068 @ RequestLine ("POST /" ) @ Headers ("Content-Encoding: gzip" ) void gzipBody (List <String > contents );
7169
7270 @ RequestLine ("POST /" ) void form (
73- @ Named ("customer_name" ) String customer , @ Named ("user_name" ) String user , @ Named ("password" ) String password );
71+ @ Param ("customer_name" ) String customer , @ Param ("user_name" ) String user , @ Param ("password" ) String password );
7472
75- @ RequestLine ("GET /{1}/{2}" ) Response uriParam (@ Named ("1" ) String one , URI endpoint , @ Named ("2" ) String two );
73+ @ RequestLine ("GET /{1}/{2}" ) Response uriParam (@ Param ("1" ) String one , URI endpoint , @ Param ("2" ) String two );
7674
77- @ RequestLine ("GET /?1={1}&2={2}" ) Response queryParams (@ Named ("1" ) String one , @ Named ("2" ) Iterable <String > twos );
75+ @ RequestLine ("GET /?1={1}&2={2}" ) Response queryParams (@ Param ("1" ) String one , @ Param ("2" ) Iterable <String > twos );
7876
7977 @ dagger .Module (injects = Feign .class , addsTo = Feign .Defaults .class )
8078 static class Module {
@@ -116,22 +114,12 @@ interface OtherTestInterface {
116114 @ RequestLine ("POST /" ) void binaryRequestBody (byte [] contents );
117115 }
118116
119- @ Module (library = true , overrides = true )
120- static class RunSynchronous {
121- @ Provides @ Singleton @ Named ("http" ) Executor httpExecutor () {
122- return new Executor () {
123- @ Override public void execute (Runnable command ) {
124- command .run ();
125- }
126- };
127- }
128- }
129-
130117 @ Test
131118 public void postTemplateParamsResolve () throws IOException , InterruptedException {
132119 server .enqueue (new MockResponse ().setBody ("foo" ));
133120
134- TestInterface api = Feign .create (TestInterface .class , "http://localhost:" + server .getPort (), new TestInterface .Module ());
121+ TestInterface api = Feign .create (TestInterface .class , "http://localhost:" + server .getPort (),
122+ new TestInterface .Module ());
135123
136124 api .login ("netflix" , "denominator" , "password" );
137125
@@ -155,7 +143,8 @@ public void responseCoercesToStringBody() throws IOException, InterruptedExcepti
155143 public void postFormParams () throws IOException , InterruptedException {
156144 server .enqueue (new MockResponse ().setBody ("foo" ));
157145
158- TestInterface api = Feign .create (TestInterface .class , "http://localhost:" + server .getPort (), new TestInterface .Module ());
146+ TestInterface api = Feign .create (TestInterface .class , "http://localhost:" + server .getPort (),
147+ new TestInterface .Module ());
159148
160149 api .form ("netflix" , "denominator" , "password" );
161150
@@ -180,7 +169,8 @@ public void postBodyParam() throws IOException, InterruptedException {
180169 public void postGZIPEncodedBodyParam () throws IOException , InterruptedException {
181170 server .enqueue (new MockResponse ().setBody ("foo" ));
182171
183- TestInterface api = Feign .create (TestInterface .class , "http://localhost:" + server .getPort (), new TestInterface .Module ());
172+ TestInterface api = Feign .create (TestInterface .class , "http://localhost:" + server .getPort (),
173+ new TestInterface .Module ());
184174
185175 api .gzipBody (Arrays .asList ("netflix" , "denominator" , "password" ));
186176
@@ -239,8 +229,8 @@ public void multipleInterceptor() throws IOException, InterruptedException {
239229
240230 @ Test public void toKeyMethodFormatsAsExpected () throws Exception {
241231 assertEquals ("TestInterface#post()" , Feign .configKey (TestInterface .class .getDeclaredMethod ("post" )));
242- assertEquals ("TestInterface#uriParam(String,URI,String)" , Feign . configKey (
243- TestInterface .class .getDeclaredMethod ("uriParam" , String .class , URI .class , String .class )));
232+ assertEquals ("TestInterface#uriParam(String,URI,String)" ,
233+ Feign . configKey ( TestInterface .class .getDeclaredMethod ("uriParam" , String .class , URI .class , String .class )));
244234 }
245235
246236 @ dagger .Module (overrides = true , library = true , includes = TestInterface .Module .class )
@@ -266,7 +256,7 @@ public void canOverrideErrorDecoder() throws IOException, InterruptedException {
266256 thrown .expectMessage ("zone not found" );
267257
268258 TestInterface api = Feign .create (TestInterface .class , "http://localhost:" + server .getPort (),
269- new IllegalArgumentExceptionOn404 ());
259+ new IllegalArgumentExceptionOn404 ());
270260
271261 api .post ();
272262 }
0 commit comments