### Question:
HawkularMetricsClient { protected static String encodeTags(Map<String, String> tags) { if (tags == null) { return null; } try { StringBuilder builder = new StringBuilder(); boolean first = true; for (Entry<String, String> entry : tags.entrySet()) { if (!first) { builder.append(','); } builder.append(URLEncoder.encode(entry.getKey(), "UTF-8")); builder.append(':'); builder.append(URLEncoder.encode(entry.getValue(), "UTF-8")); first = false; } return builder.toString(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return ""; } } HawkularMetricsClient(String metricsServer);  HawkularMetricsClient(String metricsServer, HttpConnectorOptions options);  HawkularMetricsClient(URL metricsServer);  HawkularMetricsClient(URL metricsServer, HttpConnectorOptions options); void createTenant(String tenantId); List<MetricBean> listCounterMetrics(String tenantId); DataPointLongBean addCounterDataPoint(String tenantId, String counterId, Date timestamp, long value); DataPointLongBean addCounterDataPoint(String tenantId, String counterId, Date timestamp, long value, Map<String, String> tags); void addCounterDataPoints(String tenantId, String counterId, List<DataPointLongBean> dataPoints); void addMultipleCounterDataPoints(String tenantId, List<MetricLongBean> data); @SuppressWarnings("nls") List<BucketDataPointBean> getCounterData(String tenantId, String counterId, Date from, Date to,
            BucketSizeType bucketSize); @SuppressWarnings("nls") List<BucketDataPointBean> getCounterData(String tenantId, String counterId, Date from, Date to,
            int numBuckets); @SuppressWarnings("nls") Map<String, BucketDataPointBean> getCounterData(String tenantId, String counterId, Date from, Date to,
            Map<String, String> tags); static Map<String, String> tags(String ... strings); @SuppressWarnings("nls") static void main(String[] args); static final MediaType JSON; }### Answer:
@SuppressWarnings("nls") @Test public void testEncodeTags() { String actual = HawkularMetricsClient.encodeTags(null); Assert.assertEquals(null, actual); Map<String, String> tags = new LinkedHashMap<>(); actual = HawkularMetricsClient.encodeTags(tags); Assert.assertEquals("", actual); tags.put("foo", "bar"); actual = HawkularMetricsClient.encodeTags(tags); Assert.assertEquals("foo:bar", actual); tags.put("hello", "world"); actual = HawkularMetricsClient.encodeTags(tags); Assert.assertEquals("foo:bar,hello:world", actual); tags.put("prop1", "hello world"); actual = HawkularMetricsClient.encodeTags(tags); Assert.assertEquals("foo:bar,hello:world,prop1:hello+world", actual); }