Package play.test

Class WithServer

  • Direct Known Subclasses:
    WithBrowser

    public class WithServer
    extends Object
    Provides a server to JUnit tests. Make your test class extend this class and an HTTP server will be started before each test is invoked. You can setup the application and port to use by overriding the provideApplication and providePort methods. Within a test, the running application and the TCP port are available through the app and port fields, respectively.
    • Constructor Detail

      • WithServer

        public WithServer()
    • Method Detail

      • provideApplication

        protected Application provideApplication()
        Override this method to setup the application to use.
        Returns:
        The application used by the server
      • providePort

        protected int providePort()
        Override this method to setup the port to use.
        Returns:
        The TCP port used by the server
      • startServer

        public void startServer()
      • stopServer

        public void stopServer()