public abstract class JerseyTestNg extends JerseyTest
JerseyTest
,
TestNgStrategy
Modifier and Type | Class and Description |
---|---|
static class |
JerseyTestNg.ContainerPerClassTest
Parent for TestNg tests that needs to create a test container only once per a test class.
|
static class |
JerseyTestNg.ContainerPerMethodTest
Parent for TestNg tests that needs to create a separate test container for each test in a test class.
|
Constructor and Description |
---|
JerseyTestNg()
Initialize JerseyTestNg instance.
|
JerseyTestNg(Application jaxrsApplication)
Initialize JerseyTestNg instance.
|
JerseyTestNg(TestContainerFactory testContainerFactory)
Initialize JerseyTestNg instance and specify the test container factory to be used by this test.
|
Modifier and Type | Method and Description |
---|---|
protected TestNgStrategy |
configureStrategy()
Configure
strategy for this TestNG JerseyTest. |
protected Client |
getClient()
Get the JAX-RS test client that is
pre-configured
for this test. |
protected Client |
setClient(Client client)
Get the old JAX-RS test client and set a new one.
|
client, close, closeIfNotNull, configure, configureClient, configureDeployment, disable, enable, forceDisable, forceEnable, forceSet, getAsyncTimeoutMultiplier, getBaseUri, getLastLoggedRecord, getLoggedRecords, getPort, getTestContainerFactory, isEnabled, set, set, setUp, target, target, tearDown
public JerseyTestNg() throws TestContainerException
configureStrategy()
method.
When this constructor is used, the extending concrete subclass must implement one of the
JerseyTest.configure()
or JerseyTest.configureDeployment()
methods to provide the tested application
configuration and deployment context.
TestContainerException
public JerseyTestNg(TestContainerFactory testContainerFactory)
configureStrategy()
method.
When this constructor is used, the extending concrete subclass must implement one of the
JerseyTest.configure()
or JerseyTest.configureDeployment()
methods to provide the tested application
configuration and deployment context.
testContainerFactory
- the test container factory to use for testing.public JerseyTestNg(Application jaxrsApplication) throws TestContainerException
When this constructor is used, the extending concrete subclass the JerseyTest.configure()
or JerseyTest.configureDeployment()
method are ignored. However it must implement
configureStrategy()
method.
Please note that when this constructor is used, recording of startup logs as well as configuring
other JerseyTestNg
properties and features may not work properly. While using this constructor
should generally be avoided, in certain scenarios it may be necessary to use this constructor.
jaxrsApplication
- tested application.TestContainerException
protected final Client getClient()
JerseyTest
pre-configured
for this test. This method can be overridden.getClient
in class JerseyTest
protected final Client setClient(Client client)
JerseyTest
setClient
in class JerseyTest
client
- the configured test client.protected TestNgStrategy configureStrategy()
strategy
for this TestNG JerseyTest. The strategy defines
how a test container / client is stored (per class, per thread) and is also responsible for disposing stored instances.Copyright © 2007-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.