### Question:
ApiClient { public List<Pair> parameterToPairs(String collectionFormat, String name, Collection value) { List<Pair> params = new ArrayList<Pair>(); if (name == null || name.isEmpty() || value == null) { return params; } if ("multi".equals(collectionFormat)) { for (Object item : value) { params.add(new Pair(name, escapeString(parameterToString(item)))); } return params; } String delimiter = ","; if ("ssv".equals(collectionFormat)) { delimiter = escapeString(" "); } else if ("tsv".equals(collectionFormat)) { delimiter = escapeString("\t"); } else if ("pipes".equals(collectionFormat)) { delimiter = escapeString("|"); } StringBuilder sb = new StringBuilder() ; for (Object item : value) { sb.append(delimiter); sb.append(escapeString(parameterToString(item))); } params.add(new Pair(name, sb.substring(delimiter.length()))); return params; } ApiClient(); static DateFormat buildDefaultDateFormat(); ApiClient rebuildHttpClient(); ObjectMapper getObjectMapper(); ApiClient setObjectMapper(ObjectMapper objectMapper); Client getHttpClient(); ApiClient setHttpClient(Client httpClient); String getBasePath(); ApiClient setBasePath(String basePath); List<ServerConfiguration> getServers(); ApiClient setServers(List<ServerConfiguration> servers); Integer getServerIndex(); ApiClient setServerIndex(Integer serverIndex); Map<String, String> getServerVariables(); ApiClient setServerVariables(Map<String, String> serverVariables); int getStatusCode(); Map<String, List<String>> getResponseHeaders(); Map<String, Authentication> getAuthentications(); Authentication getAuthentication(String authName); void setUsername(String username); void setPassword(String password); void setApiKey(String apiKey); void setApiKeyPrefix(String apiKeyPrefix); void setAccessToken(String accessToken); ApiClient setUserAgent(String userAgent); ApiClient addDefaultHeader(String key, String value); ApiClient addDefaultCookie(String key, String value); boolean isDebugging(); ApiClient setDebugging(boolean debugging); int getConnectTimeout(); ApiClient setConnectTimeout(int connectionTimeout); DateFormat getDateFormat(); ApiClient setDateFormat(DateFormat dateFormat); Date parseDate(String str); String formatDate(Date date); String parameterToString(Object param); List<Pair> parameterToPair(String name, Object value); List<Pair> parameterToPairs(String collectionFormat, String name, Collection value); boolean isJsonMime(String mime); String selectHeaderAccept(String[] accepts); String selectHeaderContentType(String[] contentTypes); String escapeString(String str); Object serialize(Object obj, String contentType, Map<String, Object> formParams); T invokeAPI(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType);  }### Answer:
@Test public void testParameterToPairsWhenNameIsInvalid() throws Exception { List<Integer> objects = new ArrayList<Integer>(); objects.add(new Integer(1)); List<Pair> pairs_a = apiClient.parameterToPairs("csv", null, objects); List<Pair> pairs_b = apiClient.parameterToPairs("csv", "", objects); assertTrue(pairs_a.isEmpty()); assertTrue(pairs_b.isEmpty()); }
@Test public void testParameterToPairsWhenValueIsNull() throws Exception { List<Pair> pairs = apiClient.parameterToPairs("csv", "param-a", null); assertTrue(pairs.isEmpty()); }
@Test public void testParameterToPairsWhenValueIsEmptyStrings() throws Exception { List<String> strs = new ArrayList<String>(); strs.add(" "); strs.add(" "); strs.add(" "); List<Pair> concatStrings = apiClient.parameterToPairs("csv", "param-a", strs); assertEquals(1, concatStrings.size()); assertFalse(concatStrings.get(0).getValue().isEmpty()); }