Package play.test

Class WithApplication


  • public class WithApplication
    extends Object
    Provides an application for JUnit tests. Make your test class extend this class and an application will be started before each test is invoked. You can setup the application to use by overriding the provideApplication method. Within a test, the running application is available through the app field.
    • Constructor Detail

      • WithApplication

        public WithApplication()
    • Method Detail

      • provideApplication

        protected Application provideApplication()
        Override this method to setup the application to use.
        Returns:
        The application to use
      • instanceOf

        protected <T> T instanceOf​(Class<T> clazz)
        Provides an instance from the application.
        Type Parameters:
        T - the type to return, using `app.injector.instanceOf`
        Parameters:
        clazz - the type's class.
        Returns:
        an instance of type T.
      • startPlay

        public void startPlay()
      • stopPlay

        public void stopPlay()