@Test
  public void testEncodingDecoding() throws UnsupportedEncodingException {
    HiveConf conf = new HiveConf();
    String query = "select blah, '\u0001' from random_table";
    conf.setQueryString(query);
    Assert.assertEquals(URLEncoder.encode(query, "UTF-8"), conf.get(ConfVars.HIVE_QUERY_STRING.varname));
    Assert.assertEquals(query, conf.getQueryString());
  }
TestHiveConf

Test cases for HiveConf. Loads configuration files located
in common/src/test/resources.
common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java