Package org.apache.wicket.util.tester

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


   * @return a {@link FormTester} instance
   */
  private FormTester causeValidationErrorAndSubmit(String formToBeSubmitted,
    String componentToGetError)
  {
    FormTester formTester;
    formTester = tester.newFormTester(formToBeSubmitted);
    formTester.setValue(componentToGetError, "");
    formTester.submit("submit");
    return formTester;
  }
View Full Code Here


    assertThat(updateTimeCalled.get(), is(true));
    assertThat(receiveMessageCalled.get(), is(false));

    tester.assertContains(updateTimeIsExecuted);

    final FormTester form = tester.newFormTester("form");

    form.setValue("input", "Atmosphere rocks!");

    form.submit("send");

    assertThat(updateTimeCalled.get(), is(true));
    assertThat(receiveMessageCalled.get(), is(true));

    // get the the collected so far content of the suspended response
View Full Code Here

        submitted.set(true);
      }
    };
    tester.startPage(page);

    FormTester ft = tester.newFormTester("f");

    ft.setFile("muf", new File("target/test-classes/org/apache/wicket/markup/html/form/upload/MultiFileUploadFieldTest0.txt"), "plain/text");
    ft.setFile("muf", new File("target/test-classes/org/apache/wicket/markup/html/form/upload/MultiFileUploadFieldTest1.txt"), "plain/text");
    ft.submit();

    assertEquals("The form is not submitted", true, submitted.get());
  }
View Full Code Here

    tester.startPage(testPage);

    String response = tester.getLastResponseAsString();
    assertTrue(response.contains("<input wicket:id=\"number\" type=\"number\" value=\"0.00\" name=\"number\" min=\"0.00\" max=\"100.00\"/>"));

    FormTester formTester = tester.newFormTester(testPage.form.getId());
    formTester.setValue(testPage.textField.getId(), "50.50");
    formTester.submit();
    assertEquals(new BigDecimal("50.50"), testPage.textField.getDefaultModelObject());
  }
View Full Code Here

    tester.startPage(testPage);

    String response = tester.getLastResponseAsString();
    assertTrue(response.contains("<input wicket:id=\"number\" type=\"number\" value=\"1000.0\" name=\"number\" min=\"0.0\" max=\"2000.0\"/>"));

    FormTester formTester = tester.newFormTester(testPage.form.getId());
    formTester.setValue(testPage.textField.getId(), "2,000.00");
    formTester.submit();
    assertEquals(new Double("2000.00"), testPage.textField.getDefaultModelObject());
  }
View Full Code Here

    tester.startPage(testPage);

    String response = tester.getLastResponseAsString();
    assertTrue(response.contains("<input wicket:id=\"number\" type=\"number\" value=\"0\" name=\"number\" min=\"0\" max=\"100\"/>"));

    FormTester formTester = tester.newFormTester(testPage.form.getId());
    formTester.setValue(testPage.textField.getId(), "50");
    formTester.submit();
    assertEquals(new Long("50"), testPage.textField.getDefaultModelObject());
  }
View Full Code Here

  {
    TestPage testPage = new TestPage();
    testPage.textField.setType(String.class);
    testPage.textField.setConvertEmptyInputStringToNull(true);
    tester.startPage(testPage);
    FormTester formTester = tester.newFormTester(testPage.form.getId());
    formTester.setValue(testPage.textField.getId(), "");
    formTester.submit();
    assertEquals(null, testPage.textField.getDefaultModelObject());
  }
View Full Code Here

    TestPage testPage = new TestPage();
    testPage.textField.setType(String.class);
    testPage.textField.setRequired(false);
    testPage.textField.add(StringValidator.minimumLength(2));
    tester.startPage(testPage);
    FormTester formTester = tester.newFormTester(testPage.form.getId());
    formTester.setValue(testPage.textField.getId(), "");
    formTester.submit();
    assertEquals(null, testPage.textField.getDefaultModelObject());
    assertTrue(testPage.textField.isValid());
  }
View Full Code Here

   */
  @Test
  public void onValidateModelObjects()
  {
    tester.startPage(OnFormValidateModelObjectsPage.class);
    FormTester formTester = tester.newFormTester("parentForm");
    formTester.submit("parentSubmitBtn");

    Page page = tester.getLastRenderedPage();
    OnFormValidateModelObjectsPage.ParentModel parentModel = (OnFormValidateModelObjectsPage.ParentModel) page.getDefaultModelObject();
    assertThat(parentModel.isParentValidated(), is(true));

View Full Code Here

  }

  @Test
  public void submitAndRedirect() {
    tester.startPage(FirstPage.class);
    FormTester failingFormTester = tester.newFormTester("form");
    failingFormTester.submit();
    tester.assertRenderedPage(SecondPage.class);
  }
View Full Code Here

TOP

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

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.