Twitter4J

make TwitterException more easy to test with

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.1.2
  • Fix Version/s: 2.1.9
  • Component/s: Core
  • Labels:
    None

Description

To test my backoff logic I need to be able to create and throw
TwitterExceptions. However, now I can only create one that represents
a rate limit exception if I create a HttpResponse object which seems
very complicated. In 2.1.1. there was a static create with retry after
method which was perfect but that has been removed.
The simplest solution for me would be to have an interface I could
just mock out. Another option would be to allow easy creation of new
exceptions with raw values for retry after and error code or to allow
those values to be set directly via a setter.

Activity

Hide
Yusuke Yamamoto added a comment -
added:
public TwitterException(String message, int retryAfter
            , Map<String, List<String>> responseHeaderFields
            , int statusCode, RateLimitStatus rateLimitStatus
            , RateLimitStatus featureSpecificLateLimitStatus)
Show
Yusuke Yamamoto added a comment - added: public TwitterException(String message, int retryAfter             , Map<String, List<String>> responseHeaderFields             , int statusCode, RateLimitStatus rateLimitStatus             , RateLimitStatus featureSpecificLateLimitStatus)

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: