JunitServerRunner instead.@Deprecated public class JunitServerRunner extends JunitServerRunner
JunitServerRunner class with the JUnit RunWith annotation:
@RunWith(JunitServerRunner.class)
public class MyTest {
// Get the server
@TestHttpServer
private static EmbeddedServer server;
// Get a client to query embedded server
@TestHttpServer
private HttpClient client;
@Test
public void testGET() {
HttpResponse rsp = client.prepareGet("/path")
.acceptJson()
.execute();
Assert.assertTrue(rsp.status() == 200);
}
}
ServerRule or the runner?ServerRule| Modifier | Constructor and Description |
|---|---|
|
JunitServerRunner(Class<?> klass)
Deprecated.
Create runner starting an embedded server.
|
protected |
JunitServerRunner(Class<?> klass,
EmbeddedServer<?> server)
Deprecated.
Create runner with given embedded server.
|
classRules, getTestRulescollectInitializationErrors, computeTestMethods, createTest, describeChild, getChildren, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, runChild, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeoutpublic JunitServerRunner(Class<?> klass) throws org.junit.runners.model.InitializationError
junit-servers-jetty or junit-servers-tomcat dependency must
be added to the classpath. In case of a conflict (i.e if both dependency are available in the
classpath), junit-servers-jetty will be used.klass - Running class.org.junit.runners.model.InitializationError - If an error occurred while starting embedded server.protected JunitServerRunner(Class<?> klass, EmbeddedServer<?> server) throws org.junit.runners.model.InitializationError
klass - Running class.server - The embedded server to use.org.junit.runners.model.InitializationError - If an error occurred while starting embedded server.Copyright © 2018. All rights reserved.