@Test(dataProvider = "queryParamsProvider") public void testGetQueryParams(final String expected, Collection<Query> queries) { Assert.assertEquals(client.getQueryParams(queries), expected); }
protected String getQueryParams(Collection<Query> queries) { if(queries == null || queries.size() == 0) return ""; List<String> params = new LinkedList<>(); for (Query query : queries) { params.add(query.toQueryParam()); } return "?" + String.join("&", params); }
HttpObjectClient implements ObjectClient<T> { protected String getQueryParams(Collection<Query> queries) { if(queries == null || queries.size() == 0) return ""; List<String> params = new LinkedList<>(); for (Query query : queries) { params.add(query.toQueryParam()); } return "?" + String.join("&", params); } }
HttpObjectClient implements ObjectClient<T> { protected String getQueryParams(Collection<Query> queries) { if(queries == null || queries.size() == 0) return ""; List<String> params = new LinkedList<>(); for (Query query : queries) { params.add(query.toQueryParam()); } return "?" + String.join("&", params); } HttpObjectClient(String endpointURL, HttpURLConnectionFactory httpUrlConnectionFactory, Class<T> clazz); }
HttpObjectClient implements ObjectClient<T> { protected String getQueryParams(Collection<Query> queries) { if(queries == null || queries.size() == 0) return ""; List<String> params = new LinkedList<>(); for (Query query : queries) { params.add(query.toQueryParam()); } return "?" + String.join("&", params); } HttpObjectClient(String endpointURL, HttpURLConnectionFactory httpUrlConnectionFactory, Class<T> clazz); DataObjectResponse<T> getObjects(String queryParams); DataObjectResponse<T> getObjects(List<Query> queries); DataObjectResponse<T> getObject(String id); DataObjectResponse<T> persistObject(T object); DataObjectResponse<T> updateObject(T object, String id); DataObjectResponse<T> deleteObject(String id); Class<T> getObjectClass(); void setUrlRequestPerformer(URLRequestPerformer urlRequestPerformer); }
HttpObjectClient implements ObjectClient<T> { protected String getQueryParams(Collection<Query> queries) { if(queries == null || queries.size() == 0) return ""; List<String> params = new LinkedList<>(); for (Query query : queries) { params.add(query.toQueryParam()); } return "?" + String.join("&", params); } HttpObjectClient(String endpointURL, HttpURLConnectionFactory httpUrlConnectionFactory, Class<T> clazz); DataObjectResponse<T> getObjects(String queryParams); DataObjectResponse<T> getObjects(List<Query> queries); DataObjectResponse<T> getObject(String id); DataObjectResponse<T> persistObject(T object); DataObjectResponse<T> updateObject(T object, String id); DataObjectResponse<T> deleteObject(String id); Class<T> getObjectClass(); void setUrlRequestPerformer(URLRequestPerformer urlRequestPerformer); final static String DEFAULT_RESPONSE_MESSAGE; }