@SuppressWarnings("unchecked")
  @Test
  public void testLoadSpecifiedValues() {
    pf.setDefaultValue("testDefault");
    pf.setRegex("testRegex");
    pf.setNormalize(new CaseNormalizer(Case.UPPER, Locale.CANADA));
    startPage();

    AbstractTextComponent<String> defaultValue =
        (AbstractTextComponent<String>)
            tester.getComponentFromLastRenderedPage("form:panel:defaultValue");
    AbstractTextComponent<String> regex =
        (AbstractTextComponent<String>) tester.getComponentFromLastRenderedPage("form:panel:regex");
    AbstractSingleSelectChoice<Case> kase =
        (AbstractSingleSelectChoice<Case>)
            tester.getComponentFromLastRenderedPage("form:panel:normalize:case");
    AbstractSingleSelectChoice<Locale> locale =
        (AbstractSingleSelectChoice<Locale>)
            tester.getComponentFromLastRenderedPage("form:panel:normalize:locale");

    assertThat(defaultValue.getValue(), equalTo("testDefault"));
    assertThat(regex.getValue(), equalTo("testRegex"));
    assertThat(kase.getValue(), equalTo("UPPER"));
    assertThat(locale.getValue(), equalTo("en_CA"));
  }
  /**
   * Add a {@link RegexpParameterFilter} set accept anything, replacing any existing filter for the
   * same parameter.
   *
   * @param tileLayerInfo layer to update the filter on
   * @param paramKey key for the parameter
   * @param createParam create a new filter if there is none to replace for the specified key
   */
  public static void updateAcceptAllRegExParameterFilter(
      final GeoServerTileLayerInfo tileLayerInfo, final String paramKey, boolean createParam) {

    createParam |= tileLayerInfo.removeParameterFilter(paramKey);

    if (createParam) {
      RegexParameterFilter filter = new RegexParameterFilter();
      filter.setKey(paramKey);
      filter.setDefaultValue("");
      filter.setRegex(".*");
      tileLayerInfo.addParameterFilter(filter);
    }
  }
  @Test
  public void testChange() {
    startPage();

    FormTester formTester = tester.newFormTester("form");
    formTester.setValue("panel:defaultValue", "testDefault");
    formTester.setValue("panel:regex", "testRegex");
    formTester.setValue("panel:normalize:case", "UPPER");
    formTester.setValue("panel:normalize:locale", "en_CA");
    formTester.submit();

    assertThat(pf.getDefaultValue(), equalTo("testDefault"));
    assertThat(pf.getRegex(), equalTo("testRegex"));
    assertThat(
        pf.getNormalize(),
        both(hasProperty("case", is(Case.UPPER))).and(hasProperty("locale", is(Locale.CANADA))));
  }
 @Before
 public void setUpInternal() throws Exception {
   pf = new RegexParameterFilter();
   pf.setKey("TEST");
   model = Model.of(pf);
 }