I'm trying to migrate a very simple test to Jersey 2.0 and having a bit
of a problem, namely, the test container is not seeing my resource.
Here's the resource source, more or less:
@Path("foo")
public class MyResource {
@GET
@Produces("text/plain")
public String argh() {
return "argh!";
}
// ...
}
And here's my test:
public class ServiceTest extends JerseyTest {
protected static final String MIME_TYPE =
MediaType.APPLICATION_JSON;
@Override
protected Application configure() {
enable(TestProperties.LOG_TRAFFIC);
ResourceConfig resourceConfig =
ResourceConfig.builder().addClasses(MyResource.class).build();
return Application.builder(resourceConfig).build();
}
@Test
public void simpleTest() {
Response response =
target().path("foo").request("text/plain").get();
assertEquals(200, response.getStatus());
}
}
The request always returns a 404. I'm looking at
examples/helloworld/.../HelloWorldTest.java, and as far as I can tell,
I'm doing exactly what it's doing (that test runs just fine), but my
resource is never found.
Any ideas what I might be doing wrong?
--
Jason Lee
Senior Member of Technical Staff
GlassFish Team
Oracle Corporation
Phone +1 405-216-3193
Blog http://blogs.steeplesoft.com