Package play.test
Class WithApplication
- Object
-
- play.test.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.
-
-
Field Summary
Fields Modifier and Type Field Description protected Application
app
protected Materializer
mat
The application's Pekko streams Materializer.
-
Constructor Summary
Constructors Constructor Description WithApplication()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> T
instanceOf(Class<T> clazz)
Provides an instance from the application.protected Application
provideApplication()
Override this method to setup the application to use.void
startPlay()
void
stopPlay()
-
-
-
Field Detail
-
app
protected Application app
-
mat
protected Materializer mat
The application's Pekko streams Materializer.
-
-
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()
-
-