VolleyX { static <T> RequestFuture<T> getRequestFuture(Request<T> request, String listernerField) { if (request == null) throw new NullPointerException("request can not be null"); RequestFuture<T> future = RequestFuture.newFuture(); String listenerFieldName = TextUtils.isEmpty(listernerField)? DEFAULT_LISTENER_FIELD: listernerField; String errorListenerFieldName = DEFAULT_ERROR_LISTENER_FIELD; try { Hack.HackedClass hackedClass = Hack.into(request.getClass()); hackedClass.field(listenerFieldName).set(request, future); hackedClass.field(errorListenerFieldName).set(request, future); } catch (Hack.HackDeclaration.HackAssertionException e) { throw new IllegalStateException("the field name of your class is not correct: " + e.getHackedFieldName()); } sRequestQueue.add(request); return future; }  static void init(Context context); static Observable<T> from(final Request<T> request); static Observable<T> from(final Request<T> request, final String listernerField); static void setRequestQueue(RequestQueue queue); static RequestQueue DEFAULT_REQUESTQUEUE; }
@Test public void getRequestFuture_request_null() throws Exception { thrown.expect(NullPointerException.class); VolleyX.getRequestFuture(null, ""); }