Package org.apache.wicket.util.tester

Examples of org.apache.wicket.util.tester.WicketTester


    /**
     * Tests basic Annotations
     */
    public void testBasicAnnotations()
    {
        WicketTester tester = new WicketTester();
        tester.startPage(AnnotationTestPage.class);
        Page page = tester.getLastRenderedPage();
       
        BeanMetaData beanMetaData = new BeanMetaData(AnnotationTestBean.class, null, page, null, false);
        // Check parameters, elements, element parameters, tabs, tab elements.
        assertFalse( beanMetaData.isViewOnly() );
        assertTrue( beanMetaData.isDisplayed() );
View Full Code Here


    /**
     * Tests a context. Implicitly extends the default context.
     */
    public void testContext()
    {
        WicketTester tester = new WicketTester();
        tester.startPage(AnnotationTestPage.class);
        Page page = tester.getLastRenderedPage();
       
        // Use the "view" context
        BeanMetaData beanMetaData = new BeanMetaData(AnnotationTestBean.class, "view", page, null, false);
        // Check parameters, elements, element parameters, tabs, tab elements.
        assertTrue( beanMetaData.isViewOnly() );
View Full Code Here

    /**
     * Tests basic parsing and info.
     */
    public void testBasicParsing()
    {
        WicketTester tester = new WicketTester();
        tester.startPage(BeanMetaDataTestPage.class);
        Page page = tester.getLastRenderedPage();
       
        BeanMetaDataTestBean bean = new BeanMetaDataTestBean();
        BeanMetaData beanMetaData = new BeanMetaData(BeanMetaDataTestBean.class, null, page, null, false);
        // Check parameters, elements, element parameters, tabs, tab elements.
        assertFalse( beanMetaData.isViewOnly() );
View Full Code Here

    /**
     * Tests that defaults, with no beanprops, works.
     */
    public void testDefaults()
    {
        WicketTester tester = new WicketTester();
        tester.startPage(BeanMetaDataTestNoPropsPage.class);
        Page page = tester.getLastRenderedPage();
       
        BeanMetaDataTestBean bean = new BeanMetaDataTestBean();
        BeanMetaData beanMetaData = new BeanMetaData(BeanMetaDataTestBean.class, null, page, null, false);
        // Check parameters, elements, element parameters, tabs, tab elements.
        assertFalse( beanMetaData.isViewOnly() );
View Full Code Here

    /**
     * Tests a context, without "extends". Implicitly extends the default context.
     */
    public void testContext()
    {
        WicketTester tester = new WicketTester();
        tester.startPage(BeanMetaDataTestPage.class);
        Page page = tester.getLastRenderedPage();
       
        BeanMetaDataTestBean bean = new BeanMetaDataTestBean();
        // Use the "view" context
        BeanMetaData beanMetaData = new BeanMetaData(BeanMetaDataTestBean.class, "view", page, null, false);
        // Check parameters, elements, element parameters, tabs, tab elements.
View Full Code Here

    /**
     * Tests a context with "extends".
     */
    public void testContextWithExtends()
    {
        WicketTester tester = new WicketTester();
        tester.startPage(BeanMetaDataTestPage.class);
        Page page = tester.getLastRenderedPage();
       
        BeanMetaDataTestBean bean = new BeanMetaDataTestBean();
        // Use the "popupView" context
        BeanMetaData beanMetaData = new BeanMetaData(BeanMetaDataTestBean.class, "popupView", page, null, false);
        // Check parameters, elements, element parameters, tabs, tab elements.
View Full Code Here

    /**
     * Tests a missing context.
     */
    public void testMissingContext()
    {
        WicketTester tester = new WicketTester();
        tester.startPage(BeanMetaDataTestPage.class);
        Page page = tester.getLastRenderedPage();
       
        BeanMetaDataTestBean bean = new BeanMetaDataTestBean();
        try {
            BeanMetaData beanMetaData = new BeanMetaData(BeanMetaDataTestBean.class, "missingContext", page, null, false);
            fail("Expected exception on missing context");
View Full Code Here

      {
        super.storeData(sessionId, pageId, pageAsBytes);
        storeCount++;
      }
    };
    tester = new WicketTester(application)
    {
      @Override
      protected IPageManagerProvider newTestPageManagerProvider()
      {
        return new IPageManagerProvider()
View Full Code Here

   * Test page.
   */
  @Test
  public void testSignIn2()
  {
    WicketTester tester = new WicketTester(new SignIn2Application());
    try
    {
      tester.startPage(Home.class);

      tester.assertRenderedPage(SignIn2.class);

      FormTester formTester = tester.newFormTester("signInPanel:signInForm");
      formTester.setValue("username", "wicket");
      formTester.setValue("password", "wicket");
      formTester.setValue("rememberMeContainer:rememberMe", "true");
      formTester.submit();
      tester.assertRenderedPage(Home.class);

      // a) With wicket submitting a form will result in a temporary redirect,
      // with the redirect setting the Cookie.
      // b) jWebUnits Cookie test methods are all using the http response
      // object only
      // c) Like a browser, jwebunit will automatically handle the redirect
      // request
      // Hence dumpCookie will not print an Cookie and assertCookiePresent
      // will
      // fail.
      // The only mean available is to indirectly test the cookies. Indirectly
      // because
      // the screen flow depends on the cookies.
      // this.dumpCookies(System.err);
      // this.assertCookiePresent("signInPanel.signInForm.username");
      // this.assertCookiePresent("signInPanel.signInForm.password");

      Collection<Cookie> cookies = tester.getLastResponse().getCookies();
      for (Cookie cookie : cookies)
      {
        if ("signInPanel.signInForm.username".equals(cookie.getName()))
        {
          assertEquals("wicket", cookie.getValue());
        }
      }

      tester.startPage(SignOut.class);
      tester.assertRenderedPage(SignOut.class);

      tester.startPage(Home.class);
      tester.assertRenderedPage(SignIn2.class);
    }
    finally
    {
      tester.destroy();
    }
  }
View Full Code Here

   * @throws Exception
   */
  @Before
  public void setUp() throws Exception
  {
    tester = new WicketTester(new DummyApplication());
    settings = tester.getApplication().getResourceSettings();
    localizer = tester.getApplication().getResourceSettings().getLocalizer();
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.tester.WicketTester

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.