Source:
public void testHeadersAndPostParams ( ) throws java.lang.Exception { com.android.volley.mock.MockHttpStack mockHttpStack = new com.android.volley.mock.MockHttpStack ( ) ; org.apache.http.message.BasicHttpResponse fakeResponse = new org.apache.http.message.BasicHttpResponse ( new org.apache.http.ProtocolVersion ( "HTTP" , 1 , 1 ) , 200 , "OK" ) ; fakeResponse.setEntity ( new org.apache.http.entity.StringEntity ( "foobar" ) ) ; mockHttpStack.setResponseToReturn ( fakeResponse ) ; com.android.volley.toolbox.BasicNetwork httpNetwork = new com.android.volley.toolbox.BasicNetwork ( mockHttpStack ) ; com.android.volley.Request < java.lang.String > request = new com.android.volley.Request < java.lang.String > ( "http://foo" , null ) { @ java.lang.Override protected com.android.volley.Response < java.lang.String > parseNetworkResponse ( com.android.volley.NetworkResponse response ) { return null ; } @ java.lang.Override protected void deliverResponse ( java.lang.String response ) { } @ java.lang.Override public java.util.Map < java.lang.String , java.lang.String > getHeaders ( ) { java.util.Map < java.lang.String , java.lang.String > result = new java.util.HashMap < java.lang.String , java.lang.String > ( ) ; result.put ( "requestheader" , "foo" ) ; return result ; } @ java.lang.Override public java.util.Map < java.lang.String , java.lang.String > getPostParams ( ) { java.util.Map < java.lang.String , java.lang.String > result = new java.util.HashMap < java.lang.String , java.lang.String > ( ) ; result.put ( "requestpost" , "foo" ) ; return result ; } } ; httpNetwork.performRequest ( request ) ; assertEquals ( "foo" , mockHttpStack.getLastHeaders ( ) . get ( "requestheader" ) ) ; assertEquals ( "requestpost=foo&" , new java.lang.String ( mockHttpStack.getLastPostBody ( ) ) ) ; }

Target:
public void testHeadersAndPostParams ( ) throws java.lang.Exception { com.android.volley.mock.MockHttpStack mockHttpStack = new com.android.volley.mock.MockHttpStack ( ) ; org.apache.http.message.BasicHttpResponse fakeResponse = new org.apache.http.message.BasicHttpResponse ( new org.apache.http.ProtocolVersion ( "HTTP" , 1 , 1 ) , 200 , "OK" ) ; fakeResponse.setEntity ( new org.apache.http.entity.StringEntity ( "foobar" ) ) ; mockHttpStack.setResponseToReturn ( fakeResponse ) ; com.android.volley.toolbox.BasicNetwork httpNetwork = new com.android.volley.toolbox.BasicNetwork ( mockHttpStack ) ; com.android.volley.Request < java.lang.String > request = new com.android.volley.Request < java.lang.String > ( Request.Method.GET , "http://foo" , null ) { @ java.lang.Override protected com.android.volley.Response < java.lang.String > parseNetworkResponse ( com.android.volley.NetworkResponse response ) { return null ; } @ java.lang.Override protected void deliverResponse ( java.lang.String response ) { } @ java.lang.Override public java.util.Map < java.lang.String , java.lang.String > getHeaders ( ) { java.util.Map < java.lang.String , java.lang.String > result = new java.util.HashMap < java.lang.String , java.lang.String > ( ) ; result.put ( "requestheader" , "foo" ) ; return result ; } @ java.lang.Override public java.util.Map < java.lang.String , java.lang.String > getParams ( ) { java.util.Map < java.lang.String , java.lang.String > result = new java.util.HashMap < java.lang.String , java.lang.String > ( ) ; result.put ( "requestpost" , "foo" ) ; return result ; } } ; httpNetwork.performRequest ( request ) ; assertEquals ( "foo" , mockHttpStack.getLastHeaders ( ) . get ( "requestheader" ) ) ; assertEquals ( "requestpost=foo&" , new java.lang.String ( mockHttpStack.getLastPostBody ( ) ) ) ; }