Where I am unit testing a REST function created in javax.ws.rs, and using target() for URL, as in https://stackoverflow.com/a/28726499/715269, and I don't know how to set the server part of the URL.
If I set it in hard way, the test will run only in one surrounding, on release server, for example. But normally, I run the application on any server, and API functions work on different servers, depending on where I had launch the application.
If I won't set any server for target:
String targetUrl = "/api/v1/documentTypes";
try (Response response = target(targetUrl).request().post(Entity.json(simpleJson))) {
And look for the URI in response, I see some server part set there (http://localhost:9998/), but I don't know where is it from, and this imitated server does not know the API function from targetUrl
string.
How should I write this part of unit test, so as to be run universally?
I think that maybe overrode configure() method could help, but I am not sure.