static String encodeElement(Object obj, URLEscaper.Escaping escaping, UriComponent.Type componentType)
  {
    StringBuilder builder = new StringBuilder();
    encodeDataObject(obj, escaping, componentType, builder);
    return builder.toString();
  }
@Test(dataProvider = "encoding")
  public void testEncoding(Object obj, String expectedNoEsc, String expectedPathSegEsc, String expectedQueryParamEsc)
  {
    String actualNoEsc = URIParamUtils.encodeElement(obj, NO_ESCAPING, null);
    Assert.assertEquals(actualNoEsc, expectedNoEsc);
    String actualPathSegEsc = URIParamUtils.encodeElement(obj, URL_ESCAPING,
                                                          UriComponent.Type.PATH_SEGMENT);
    Assert.assertEquals(actualPathSegEsc, expectedPathSegEsc);
    String actualQueryParamEsc = URIParamUtils.encodeElement(obj, URL_ESCAPING,
                                                             UriComponent.Type.QUERY_PARAM);
    Assert.assertEquals(actualQueryParamEsc, expectedQueryParamEsc);
  }