/** custom 0 default 1 */ @Test public void testGet01() { Map<String, String> customParams = new LinkedHashMap<>(); String url = "http://www.baidu.com?user_id=123"; Map<String, String> defaultParams = UrlUtil.getParams(url); String sb = HttpCodeSnippetUtil.createGetSnippet( "testGet01", "http://www.baidu.com", customParams, defaultParams, Object.class.getName()); assertEquals( " public Observable testGet01() {\n" + " return (Observable) mHttpRequest.doGet(\"http://www.baidu.com?\"\n" + " + \"&user_id=123\" , java.lang.Object.class);\n" + " }\n\n", sb); }
/** custom 1 default 0 */ @Test public void testGet10() throws Exception { String url = "http://www.baidu.com"; Map<String, String> customParams = new LinkedHashMap<>(); putCustomParam(customParams, "user_id"); Map<String, String> defaultParams = UrlUtil.getParams(url); String sb = HttpCodeSnippetUtil.createGetSnippet( "testGet10", "http://www.baidu.com", customParams, defaultParams, Object.class.getName()); assertEquals( " public Observable testGet10(String user_id) {\n" + " return (Observable) mHttpRequest.doGet(\"http://www.baidu.com?\"\n" + " + \"&user_id=\" + user_id , java.lang.Object.class);\n" + " }\n\n", sb); }