Package play.test
Class WithApplication
java.lang.Object
play.test.WithApplication
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
FieldsModifier and TypeFieldDescriptionprotected Applicationprotected MaterializerThe application's Pekko streams Materializer. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> TinstanceOf(Class<T> clazz) Provides an instance from the application.protected ApplicationOverride this method to setup the application to use.voidvoidstopPlay()
-
Field Details
-
app
-
mat
The application's Pekko streams Materializer.
-
-
Constructor Details
-
WithApplication
public WithApplication()
-
-
Method Details
-
provideApplication
Override this method to setup the application to use.- Returns:
- The application to use
-
instanceOf
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()
-