artiya4u / google-http-java-client

Automatically exported from code.google.com/p/google-http-java-client
0 stars 0 forks source link

Make HttpRequestFactory non final #44

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
External references, such as a standards document, or specification?
-

Java environments (e.g. Java 6, Android 2.3, App Engine, or All)?
Android 2.3 with Google API

Please describe the feature requested.

Make the HttpRequestFactory non-final class to allow extensibility and mocking 
with unit test frameworks such as Mockito.

Original issue reported on code.google.com by siarhei....@gmail.com on 19 Oct 2011 at 10:46

GoogleCodeExporter commented 9 years ago
Does this solve your needs:
http://code.google.com/p/google-http-java-client/wiki/FAQ#HTTP_unit_testing
?

Original comment by yan...@google.com on 19 Oct 2011 at 11:00

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
It is a *workaround* for my needs but it leads, in my humble opinion, to code 
clutter.

If there were not so many final classes in the lib I would be able to do 
something like the following in one line (with Mockito) in my unit tests:

when(factoryMock.buildGetRequest(anyObject())).thenReturn(httpRequestMock);

My feature request still stands although it is not blocking. And thanks for the 
link!

Original comment by siarhei....@gmail.com on 20 Oct 2011 at 8:37

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 20 Oct 2011 at 8:49

GoogleCodeExporter commented 9 years ago
Btw, mocking the mock classes with Mockito also works in some cases because 
they are non final :S. Still would be nice to achieve easy testing with less 
overhead!

Original comment by siarhei....@gmail.com on 20 Oct 2011 at 9:32

GoogleCodeExporter commented 9 years ago

Original comment by rmis...@google.com on 14 Nov 2011 at 3:49

GoogleCodeExporter commented 9 years ago

Original comment by rmis...@google.com on 14 Nov 2011 at 4:27

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 29 Feb 2012 at 1:13

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 27 Mar 2012 at 2:22

GoogleCodeExporter commented 9 years ago

Original comment by rmis...@google.com on 14 May 2012 at 2:14

GoogleCodeExporter commented 9 years ago

Original comment by rmis...@google.com on 24 May 2012 at 12:35

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 2 Aug 2012 at 2:28

GoogleCodeExporter commented 9 years ago

Original comment by rmis...@google.com on 14 Jan 2013 at 3:26