AbstractServiceClient implements ServiceClient { protected <T> String getMultiValueParamURI(String paramName, List<T> paramValues) { StringBuilder queryURI = new StringBuilder(); if (paramValues != null && !paramValues.isEmpty()) { boolean first = true; for (T paramValue: paramValues) { if (paramValue == null) { continue; } if (first) { first = false; } else { queryURI.append("&"); } queryURI.append(paramName).append("="); if (paramValue instanceof String) { queryURI.append(encodeUrl((String) paramValue)); } else { queryURI.append(paramValue); } } } return queryURI.toString(); }  JavaType getJavaType(TypeReference typeReference); JavaType getErrorType(TypeReference typeReference); JavaType getJavaType(Class<T> clazz); JavaType getErrorType(Class<T> clazz); JavaType constructJavaType(VariableModel variableModel); @Override void init(); @Override void shutDown();  }
@Test public void testMultiValueParamURI() { AbstractServiceClient serviceClient = new TestAbstractServiceClient(); assertEquals("", serviceClient.getMultiValueParamURI("key", null)); assertEquals("", serviceClient.getMultiValueParamURI("key", Arrays.asList())); assertEquals("key=", serviceClient.getMultiValueParamURI("key", Arrays.asList(""))); assertEquals("key=a", serviceClient.getMultiValueParamURI("key", Arrays.asList("a"))); assertEquals("key=a", serviceClient.getMultiValueParamURI("key", Arrays.asList("a", null))); assertEquals("key=a&key=b&key=c", serviceClient.getMultiValueParamURI("key", Arrays.asList("a", "b", "c"))); assertEquals("key=a&key=&key=c", serviceClient.getMultiValueParamURI("key", Arrays.asList("a", "", "c"))); assertEquals("key=a&key=b%26c&key=c", serviceClient.getMultiValueParamURI("key", Arrays.asList("a", "b&c", "c"))); assertEquals("key=10&key=20&key=30", serviceClient.getMultiValueParamURI("key", Arrays.asList(10, 20, 30))); }