コード例 #1
0
  @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"));
  }
コード例 #2
0
  @SuppressWarnings("unchecked")
  @Test
  public void testLoadDefaultValues() {
    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(""));
    assertThat(regex.getValue(), equalTo(""));
    assertThat(kase.getValue(), equalTo("NONE"));
    assertThat(locale.getValue(), equalTo("-1"));
  }