Package org.glassfish.jersey.test
Class JerseyTestNg.ContainerPerMethodTest
- java.lang.Object
-
- org.glassfish.jersey.test.JerseyTest
-
- org.glassfish.jersey.test.JerseyTestNg
-
- org.glassfish.jersey.test.JerseyTestNg.ContainerPerMethodTest
-
- Enclosing class:
- JerseyTestNg
public abstract static class JerseyTestNg.ContainerPerMethodTest extends JerseyTestNg
Parent for TestNg tests that needs to create a separate test container for each test in a test class. The creation and disposal of the test container (or client) are managed bysetUp()
/tearDown()
methods annotated by TestNG annotationsBeforeMethod
/AfterMethod
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.glassfish.jersey.test.JerseyTestNg
JerseyTestNg.ContainerPerClassTest, JerseyTestNg.ContainerPerMethodTest
-
-
Constructor Summary
Constructors Constructor Description ContainerPerMethodTest()
ContainerPerMethodTest(Application jaxrsApplication)
ContainerPerMethodTest(TestContainerFactory testContainerFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TestNgStrategy
configureStrategy()
Configurestrategy
for this TestNG JerseyTest.void
setUp()
Set up the test by creating a test container instance,starting
it and by creating a newpre-configured
test client.void
tearDown()
Tear down the test bystopping
the test container obtained from thetest container factory
and byclosing
and discarding thepre-configured
test client that wasset up
for the test.-
Methods inherited from class org.glassfish.jersey.test.JerseyTestNg
getClient, setClient
-
Methods inherited from class org.glassfish.jersey.test.JerseyTest
client, close, closeIfNotNull, configure, configureClient, configureDeployment, disable, enable, forceDisable, forceEnable, forceSet, getAsyncTimeoutMultiplier, getBaseUri, getLastLoggedRecord, getLoggedRecords, getPort, getSslContext, getSslParameters, getTestContainerFactory, isEnabled, set, set, target, target
-
-
-
-
Constructor Detail
-
ContainerPerMethodTest
public ContainerPerMethodTest() throws TestContainerException
- Throws:
TestContainerException
-
ContainerPerMethodTest
public ContainerPerMethodTest(TestContainerFactory testContainerFactory)
-
ContainerPerMethodTest
public ContainerPerMethodTest(Application jaxrsApplication) throws TestContainerException
- Throws:
TestContainerException
-
-
Method Detail
-
setUp
public void setUp() throws Exception
Description copied from class:JerseyTest
Set up the test by creating a test container instance,starting
it and by creating a newpre-configured
test client. The test container is obtained from thetest container factory
.- Overrides:
setUp
in classJerseyTest
- Throws:
TestContainerException
- if the default test container factory cannot be obtained, or the test application deployment context is not supported by the test container factory.Exception
- if an exception is thrown during setting up the test environment.
-
tearDown
public void tearDown() throws Exception
Description copied from class:JerseyTest
Tear down the test bystopping
the test container obtained from thetest container factory
and byclosing
and discarding thepre-configured
test client that wasset up
for the test.- Overrides:
tearDown
in classJerseyTest
- Throws:
Exception
- if an exception is thrown during tearing down the test environment.
-
configureStrategy
protected TestNgStrategy configureStrategy()
Description copied from class:JerseyTestNg
Configurestrategy
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.- Overrides:
configureStrategy
in classJerseyTestNg
- Returns:
- TestNG strategy instance.
-
-