### Question:
GoogleAnalyticsDataPublisher { public static String buildPayloadString(Object o) { String queryString = ""; Class<?> clazz = o.getClass(); Field[] fields = clazz.getDeclaredFields(); for(int i=0; i<fields.length; i++) { fields[i].setAccessible(true); String fieldValue = getFieldValue(fields[i], o); fields[i].setAccessible(false); if(fieldValue == null) { continue; } queryString = queryString + encodeString(GoogleAnalyticsConstants.METHOD_TO_PARAM_MAP.get(fields[i].getName())) + "=" + encodeString(fieldValue) + "&"; } queryString = queryString.substring(0, queryString.length()-1); return queryString; }  static boolean publishPOST(List<NameValuePair> payload, String userAgent, boolean useSSL); static boolean publishGET(String payload, String userAgent, boolean useSSL); static String buildPayloadString(Object o); static List<NameValuePair> buildPayload(Object o);  }### Answer:
@Test public void testQueryParamBuilderPageView() throws Exception { GoogleAnalyticsData data = new GoogleAnalyticsData .DataBuilder("trackingId", "1", "clientId", GoogleAnalyticsConstants.HIT_TYPE_PAGEVIEW) .setDocumentPath("/") .setDocumentHostName("localhost.com") .setDocumentTitle("Home Page") .build(); Assert.assertEquals("v=1&tid=trackingId&cid=clientId&t=pageview&dh=localhost.com&dp=%2F&dt=Home+Page", GoogleAnalyticsDataPublisher.buildPayloadString(data)); }