googleapis / google-http-java-client

Google HTTP Client Library for Java
Apache License 2.0
1.39k stars 451 forks source link

Make HttpRequestFactory non final #44

Closed wonderfly closed 6 years ago

wonderfly commented 9 years ago

From siarhei....@gmail.com on October 19, 2011 15:46:45

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: http://code.google.com/p/google-http-java-client/issues/detail?id=44

wonderfly commented 9 years ago

From yan...@google.com on October 19, 2011 16:00:55

Does this solve your needs: https://code.google.com/p/google-http-java-client/wiki/FAQ#HTTP_unit_testing ?

Status: RequestedFeedback

wonderfly commented 9 years ago

From siarhei....@gmail.com on October 20, 2011 13:37:02

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!

wonderfly commented 9 years ago

From yan...@google.com on October 20, 2011 13:49:13

Status: New
Owner: rmis...@google.com

wonderfly commented 9 years ago

From siarhei....@gmail.com on October 20, 2011 14:32:50

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!

wonderfly commented 9 years ago

From rmis...@google.com on November 14, 2011 07:49:58

Status: Accepted

wonderfly commented 9 years ago

From rmis...@google.com on November 14, 2011 08:27:30

Labels: -Priority-Medium Priority-Low Milestone-Version1.7.0

wonderfly commented 9 years ago

From yan...@google.com on February 28, 2012 17:13:52

Labels: Milestone-Version1.8.0

wonderfly commented 9 years ago

From yan...@google.com on March 27, 2012 07:22:33

Labels: Milestone-Version1.9.0

wonderfly commented 9 years ago

From rmis...@google.com on May 14, 2012 07:14:07

Labels: -Milestone-Version1.9.0 Milestone-Version1.10.0

wonderfly commented 9 years ago

From rmis...@google.com on May 24, 2012 05:35:51

Labels: -Milestone-Version1.10.0 Milestone-Version1.11.0

wonderfly commented 9 years ago

From yan...@google.com on August 02, 2012 07:28:05

Labels: -Priority-Low -Milestone-Version1.11.0 Priority-Medium Component-HTTP

wonderfly commented 9 years ago

From rmis...@google.com on January 14, 2013 07:26:39

Owner: yan...@google.com
Cc: rmis...@google.com