I suspect you may be missing provider bundle. Did you include the test
framework providers artifact in your POM?
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-bundle</artifactId>
<version>2.0-m01</version>
<type>pom</type>
<scope>test</scope>
</dependency>
It looks like you need to add this artifact in addition to your test
container. I used grizzly along with the above artifact and it worked.
-Arul
On Thu, Feb 23, 2012 at 1:16 PM, Jason Lee <jason.d.lee_at_oracle.com> wrote:
> 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
>
>
--
http://aruld.info
http://twitter.com/aruld