Package play.test
Class WithServer
- Object
-
- play.test.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.
-
-
Field Summary
Fields Modifier and Type Field Description protected Applicationappprotected intportprotected TestServertestServer
-
Constructor Summary
Constructors Constructor Description WithServer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ApplicationprovideApplication()Override this method to setup the application to use.protected intprovidePort()Override this method to setup the port to use.voidstartServer()voidstopServer()
-
-
-
Field Detail
-
app
protected Application app
-
port
protected int port
-
testServer
protected TestServer testServer
-
-
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()
-
-