Package org.apache.wicket.util.tester

Examples of org.apache.wicket.util.tester.FormTester$ChoiceSelector


    tester.startPage(CommonModelPage.class);

    // assert rendered page class
    tester.assertRenderedPage(CommonModelPage.class);

    FormTester formTester = tester.newFormTester("border:border_body:form1");
    formTester.submit();

    CommonModelPage page = (CommonModelPage)tester.getLastRenderedPage();
    assertEquals(0, page.quantity1);
    assertEquals(0, page.quantity2);
  }
View Full Code Here


    tester.startPage(CommonModelPage.class);

    // assert rendered page class
    tester.assertRenderedPage(CommonModelPage.class);

    FormTester formTester = tester.newFormTester("border:border_body:form1");
    formTester.setValue("quantity1", "123");
    // formTester.setValue("quantity2", "44");
    formTester.submit();

    CommonModelPage page = (CommonModelPage)tester.getLastRenderedPage();
    assertEquals(123, page.quantity1);
    assertEquals(0, page.quantity2);
  }
View Full Code Here

    tester.startPage(CommonModelPage.class);

    // assert rendered page class
    tester.assertRenderedPage(CommonModelPage.class);

    FormTester formTester = tester.newFormTester("border:border_body:form2");
    // formTester.setValue("quantity1", "123");
    formTester.setValue("quantity2", "44");
    formTester.submit();

    CommonModelPage page = (CommonModelPage)tester.getLastRenderedPage();
    assertEquals(0, page.quantity1);
    assertEquals(44, page.quantity2);
  }
View Full Code Here

  @Test
  public void testSelectionWorks() throws Exception
  {
    TestPage page = tester.startPage(new TestPage());
    FormTester form = tester.newFormTester("form");
    form.select("list", 1);
    form.select("list", 3);
    form.select("list", 5);
    form.submit();
    assertEquals(3, page.selectedValues.getObject().size());
    assertTrue(page.selectedValues.getObject().contains("b"));
    assertTrue(page.selectedValues.getObject().contains("d"));
    assertTrue(page.selectedValues.getObject().contains("f"));
  }
View Full Code Here

  public void testSelectionAccumulates() throws Exception
  {
    final TestPage page = new TestPage();
    page.selectedValues.getObject().add("a");
    tester.startPage(page);
    FormTester form = tester.newFormTester("form");
    form.select("list", 1);
    form.select("list", 3);
    form.select("list", 5);
    form.submit();
    assertEquals(4, page.selectedValues.getObject().size());
    assertTrue(page.selectedValues.getObject().contains("a"));
    assertTrue(page.selectedValues.getObject().contains("b"));
    assertTrue(page.selectedValues.getObject().contains("d"));
    assertTrue(page.selectedValues.getObject().contains("f"));
View Full Code Here

  public void testSubmitLinkByUsingFormTester()
  {
    tester.startPage(HomePage.class);
    tester.assertRenderedPage(HomePage.class);
    HomePage home = (HomePage)tester.getLastRenderedPage();
    FormTester formTester = tester.newFormTester("form");
    formTester.setValue("text", "Hello");
    formTester.submit("link");
    assertEquals("Hello", home.getText());
    assertTrue("Form.onSubmit() has not been called!", home.isSubmitted());
    assertTrue("SubmitLink.onSubmit() has not been called!",
      home.isSubmittedViaLinkBefore());
    assertTrue("SubmitLink.onAfterSubmit() has not been called!",
View Full Code Here

   */
  @Test
  public void interfaceValidator()
  {
    tester.startPage(new ValidatorLoaderPage(new InterfaceValidator()));
    FormTester formTester = tester.newFormTester("form");
    formTester.setValue("passwd", "anything");
    formTester.submit();

    tester.assertErrorMessages("Interface error loaded OK");
  }
View Full Code Here

   */
  @Test
  public void classValidator()
  {
    tester.startPage(new ValidatorLoaderPage(new ClassValidator()));
    FormTester formTester = tester.newFormTester("form");
    formTester.setValue("passwd", "anything");
    formTester.submit();

    tester.assertErrorMessages("Class error loaded OK");
  }
View Full Code Here

 
  @Test
  public void formValidator()
  {
    tester.startPage(new FormValidatorPage());
    FormTester formTester = tester.newFormTester("form");
    formTester.setValue("field1", "value1");
    formTester.setValue("field2", "value2");
    formTester.submit();
    tester.assertErrorMessages("Form Validator loaded OK");
  }
View Full Code Here

    PaletteTestPage testPage = new PaletteTestPage(selected, all);

    tester.startPage(testPage);

    FormTester formTester = tester.newFormTester(testPage.form.getId());
    formTester.submit();

    Collection<String> collection = testPage.palette.getModelCollection();

    assertEquals(2, collection.size());
    Iterator<String> iterator = collection.iterator();
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.tester.FormTester$ChoiceSelector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.