> Hmm... so we would need to 'mock up' stuff that could be injected
> like UriInfo, HttpHeaders and Request with information that is
> important for the test. There is actually not that much information
> really, the full set is: the HTTP method, the base URI, the request
> URI, and the list of headers. Do you have any ideas how that could
> be easily expressed in such unit tests?
Spring does this using a custom @RunWith, as said. So this could look
like this:
@RunWith(JerseyTestRunner)
@Request(baseUri = "/foo")
class MyUnitTest {
// ... test methods ...
@Test
@Request(uri = "...", headers = { ... }, method = "...")
public void testFoo() {
...
}
}
If we don't need to repeat the method and uri in every test method,
but can optionally declare it on the containing test class, this might
actually be ok for users.
Regards,
Martin.