protected static Map<String, String> getFilterParameters(Configuration conf,
      String prefix) {
    Map<String, String> filterParams = new HashMap<String, String>();
    for (Map.Entry<String, String> entry : conf.getValByRegex(prefix)
        .entrySet()) {
      String name = entry.getKey();
      String value = entry.getValue();
      name = name.substring(prefix.length());
      filterParams.put(name, value);
    }
    return filterParams;
  }
@Test
  public void testGetFilterParameters() {

    // Initialize configuration object
    Configuration conf = new Configuration();
    conf.set(HttpCrossOriginFilterInitializer.PREFIX + "rootparam",
        "rootvalue");
    conf.set(HttpCrossOriginFilterInitializer.PREFIX + "nested.param",
        "nestedvalue");
    conf.set("outofscopeparam", "outofscopevalue");

    // call function under test
    Map<String, String> filterParameters = HttpCrossOriginFilterInitializer
        .getFilterParameters(conf, HttpCrossOriginFilterInitializer.PREFIX);

    // retrieve values
    String rootvalue = filterParameters.get("rootparam");
    String nestedvalue = filterParameters.get("nested.param");
    String outofscopeparam = filterParameters.get("outofscopeparam");

    // verify expected values are in place
    Assert.assertEquals("Could not find filter parameter", "rootvalue",
        rootvalue);
    Assert.assertEquals("Could not find filter parameter", "nestedvalue",
        nestedvalue);
    Assert.assertNull("Found unexpected value in filter parameters",
        outofscopeparam);
  }