This is my pom.xml
(part of it):
[...]
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-embedded-glassfish</artifactId>
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>
[...]
This is the test:
public class FooTest extends JerseyTest {
public FooTest() throws Exception {
super("com.XXX");
}
@Before
public void setUp() throws Exception {
}
@Test
public void shouldWork() throws Exception {
}
}
This is what I'm getting in the log:
com.sun.jersey.test.framework.spi.container.TestContainerException: org.glassfish.embed.EmbeddedException: You must start the server before calling this API method: EmbeddedDeployer.EmbeddedDeployer Constructor.
at com.sun.jersey.test.framework.spi.container.embedded.glassfish.EmbeddedGlassFishTestContainerFactory$EmbeddedGlassFishTestContainer.stop(EmbeddedGlassFishTestContainerFactory.java:154)
at com.sun.jersey.test.framework.JerseyTest.tearDown(JerseyTest.java:312)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[...]
When I remove setUp()
method from the class everything works fine. What's wrong here?