VolleyX { public static <T> Observable<T> from(final Request<T> request) { if (!sInited) throw new IllegalStateException("call init first"); if (request == null) throw new NullPointerException("request can not be null"); return Observable.defer(new Func0<Observable<T>>() { @Override public Observable<T> call() { try { return Observable.just(generateData(request)); } catch (InterruptedException | ExecutionException e) { VolleyXLog.e(e.getMessage()); return Observable.error(e); } } }); }  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 testFrom_without_init() throws Exception { thrown.expect(IllegalStateException.class); VolleyX.sInited = false; VolleyX.from(mockRequest); }
@Test public void testFrom_nullrequest() throws Exception { thrown.expect(NullPointerException.class); VolleyX.sInited = true; VolleyX.from(null); }
@Test public void testFrom() throws Exception { VolleyX.sInited = true; assertThat(VolleyX.from(mockRequest), is(instanceOf(Observable.class))); }
@Test public void testFrom1_without_init() throws Exception { thrown.expect(IllegalStateException.class); VolleyX.sInited = false; VolleyX.from(mockRequest, ""); }
@Test public void testFrom1_nullrequest() throws Exception { thrown.expect(NullPointerException.class); VolleyX.sInited = true; VolleyX.from(null, ""); }
@Test public void testFrom1() throws Exception { VolleyX.sInited = true; assertThat(VolleyX.from(mockRequest, ""), is(instanceOf(Observable.class))); }