Class WicketTestCase


  • public abstract class WicketTestCase
    extends java.lang.Object
    Base class for tests which require comparing wicket response with a file.

    To create/replace the expected result file with the new content, define the system property like -Dwicket.replace.expected.results=true

    • Constructor Summary

      Constructors 
      Constructor Description
      WicketTestCase()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void commonAfter()  
      void commonBefore()  
      protected void compareMarkupWithFile​(IMarkupFragment markup, java.lang.String filename, java.lang.Class<?> scopeClass)
      Compare the markup provided with the file content
      protected void compareMarkupWithString​(IMarkupFragment markup, java.lang.String testMarkup)
      Compare the markup provided with the String
      protected void executeBehavior​(AbstractAjaxBehavior behavior, java.lang.String filename)  
      protected void executeListener​(Component component, java.lang.String filename)  
      protected <T extends Page>
      void
      executeTest​(java.lang.Class<T> pageClass, java.lang.String filename)
      Use -Dwicket.replace.expected.results=true to automatically replace the expected output file.
      protected <T extends Page>
      void
      executeTest​(java.lang.Class<T> pageClass, org.apache.wicket.request.mapper.parameter.PageParameters parameters, java.lang.String filename)
      Use -Dwicket.replace.expected.results=true to automatically replace the expected output file.
      protected void executeTest​(Page page, java.lang.String filename)
      Use -Dwicket.replace.expected.results=true to automatically replace the expected output file.
      java.lang.String getBasedir()
      Returns the current Maven build directory taken from the basedir system property, or null if not set
      protected WebApplication newApplication()  
      protected WicketTester newWicketTester​(WebApplication app)
      In case you need to subclass WicketTester and want to be independent on possible changes in setUp().
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WicketTestCase

        public WicketTestCase()
    • Method Detail

      • commonBefore

        @BeforeEach
        public void commonBefore()
      • newApplication

        protected WebApplication newApplication()
        Returns:
        the application that should be used for the test
      • newWicketTester

        protected WicketTester newWicketTester​(WebApplication app)
        In case you need to subclass WicketTester and want to be independent on possible changes in setUp().
        Parameters:
        app -
        Returns:
        WIcketTester
      • commonAfter

        @AfterEach
        public void commonAfter()
      • executeTest

        protected <T extends Page> void executeTest​(java.lang.Class<T> pageClass,
                                                    java.lang.String filename)
                                             throws java.lang.Exception
        Use -Dwicket.replace.expected.results=true to automatically replace the expected output file.
        Type Parameters:
        T -
        Parameters:
        pageClass -
        filename -
        Throws:
        java.lang.Exception
      • executeTest

        protected void executeTest​(Page page,
                                   java.lang.String filename)
                            throws java.lang.Exception
        Use -Dwicket.replace.expected.results=true to automatically replace the expected output file.
        Parameters:
        page -
        filename -
        Throws:
        java.lang.Exception
      • executeTest

        protected <T extends Page> void executeTest​(java.lang.Class<T> pageClass,
                                                    org.apache.wicket.request.mapper.parameter.PageParameters parameters,
                                                    java.lang.String filename)
                                             throws java.lang.Exception
        Use -Dwicket.replace.expected.results=true to automatically replace the expected output file.
        Type Parameters:
        T -
        Parameters:
        pageClass -
        parameters -
        filename -
        Throws:
        java.lang.Exception
      • executeListener

        protected void executeListener​(Component component,
                                       java.lang.String filename)
                                throws java.lang.Exception
        Parameters:
        component -
        filename -
        Throws:
        java.lang.Exception
      • executeBehavior

        protected void executeBehavior​(AbstractAjaxBehavior behavior,
                                       java.lang.String filename)
                                throws java.lang.Exception
        Parameters:
        behavior -
        filename -
        Throws:
        java.lang.Exception
      • getBasedir

        public java.lang.String getBasedir()
        Returns the current Maven build directory taken from the basedir system property, or null if not set
        Returns:
        path with a trailing slash
      • compareMarkupWithFile

        protected final void compareMarkupWithFile​(IMarkupFragment markup,
                                                   java.lang.String filename,
                                                   java.lang.Class<?> scopeClass)
                                            throws java.io.IOException
        Compare the markup provided with the file content
        Parameters:
        markup -
        filename -
        scopeClass -
        Throws:
        java.io.IOException
      • compareMarkupWithString

        protected final void compareMarkupWithString​(IMarkupFragment markup,
                                                     java.lang.String testMarkup)
        Compare the markup provided with the String
        Parameters:
        markup -
        testMarkup -