I made a test case to test my Rest Web Service. but in test case I am seeing that the request is going to default port of jersey test framework which is http://localhost:9998 whereas my service is register on http://localhost:8080. I am unable to find that how can I change its port to 8080
public class UMServiceTest extends JerseyTest {
@Override
public Application configure() {
enable(TestProperties.LOG_TRAFFIC);
enable(TestProperties.DUMP_ENTITY);
return new ResourceConfig(UMService.class);
}
@Test
public void testFetchAll() {
System.out.println(getBaseUri()+"==========");
Response output = target("usermanagement").path("um").path("user").request().get();
assertEquals("should return status 200", 200, output.getStatus());
//assertNotNull("Should return list", output.getEntity());
}
You could change the Systemproperty from TestProperties for the JerseyTest too.
public class UMServiceTest extends JerseyTest
{
static
{
System.setProperty("jersey.config.test.container.port", "0");
}
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With