Home | History | Annotate | Download | only in toolbox
      1 /*
      2  * Copyright (C) 2015 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.volley.toolbox;
     18 
     19 import com.android.volley.*;
     20 import org.junit.Test;
     21 import org.junit.runner.RunWith;
     22 import org.robolectric.RobolectricTestRunner;
     23 
     24 import static org.junit.Assert.assertNotNull;
     25 
     26 @RunWith(RobolectricTestRunner.class)
     27 public class RequestTest {
     28 
     29     @Test
     30     public void publicMethods() throws Exception {
     31         // Catch-all test to find API-breaking changes.
     32         assertNotNull(Request.class.getConstructor(int.class, String.class,
     33                 Response.ErrorListener.class));
     34 
     35         assertNotNull(Request.class.getMethod("getMethod"));
     36         assertNotNull(Request.class.getMethod("setTag", Object.class));
     37         assertNotNull(Request.class.getMethod("getTag"));
     38         assertNotNull(Request.class.getMethod("getErrorListener"));
     39         assertNotNull(Request.class.getMethod("getTrafficStatsTag"));
     40         assertNotNull(Request.class.getMethod("setRetryPolicy", RetryPolicy.class));
     41         assertNotNull(Request.class.getMethod("addMarker", String.class));
     42         assertNotNull(Request.class.getDeclaredMethod("finish", String.class));
     43         assertNotNull(Request.class.getMethod("setRequestQueue", RequestQueue.class));
     44         assertNotNull(Request.class.getMethod("setSequence", int.class));
     45         assertNotNull(Request.class.getMethod("getSequence"));
     46         assertNotNull(Request.class.getMethod("getUrl"));
     47         assertNotNull(Request.class.getMethod("getCacheKey"));
     48         assertNotNull(Request.class.getMethod("setCacheEntry", Cache.Entry.class));
     49         assertNotNull(Request.class.getMethod("getCacheEntry"));
     50         assertNotNull(Request.class.getMethod("cancel"));
     51         assertNotNull(Request.class.getMethod("isCanceled"));
     52         assertNotNull(Request.class.getMethod("getHeaders"));
     53         assertNotNull(Request.class.getDeclaredMethod("getParams"));
     54         assertNotNull(Request.class.getDeclaredMethod("getParamsEncoding"));
     55         assertNotNull(Request.class.getMethod("getBodyContentType"));
     56         assertNotNull(Request.class.getMethod("getBody"));
     57         assertNotNull(Request.class.getMethod("setShouldCache", boolean.class));
     58         assertNotNull(Request.class.getMethod("shouldCache"));
     59         assertNotNull(Request.class.getMethod("getPriority"));
     60         assertNotNull(Request.class.getMethod("getTimeoutMs"));
     61         assertNotNull(Request.class.getMethod("getRetryPolicy"));
     62         assertNotNull(Request.class.getMethod("markDelivered"));
     63         assertNotNull(Request.class.getMethod("hasHadResponseDelivered"));
     64         assertNotNull(Request.class.getDeclaredMethod("parseNetworkResponse", NetworkResponse.class));
     65         assertNotNull(Request.class.getDeclaredMethod("parseNetworkError", VolleyError.class));
     66         assertNotNull(Request.class.getDeclaredMethod("deliverResponse", Object.class));
     67         assertNotNull(Request.class.getMethod("deliverError", VolleyError.class));
     68     }
     69 }
     70