use of javax.ws.rs.client.WebTarget in project jersey by jersey.
the class ValidateOnExecutionBasicTest method testOnMethodGetterMatch.
@Test
public void testOnMethodGetterMatch() throws Exception {
final WebTarget target = target("getter-on-method-match");
assertThat(target.request().get().getStatus(), equalTo(400));
assertThat(target.path("sanity").request().get().getStatus(), equalTo(400));
}
use of javax.ws.rs.client.WebTarget in project jersey by jersey.
the class SingletonBeanTest method testGet.
@Test
public void testGet() {
final WebTarget singleton = target().path("jcdibean/singleton").path(p).queryParam("x", x);
String s = singleton.request().get(String.class);
assertThat(s, containsString(singleton.getUri().toString()));
assertThat(s, containsString(String.format("p=%s", p)));
assertThat(s, containsString(String.format("queryParam=%s", x)));
}
use of javax.ws.rs.client.WebTarget in project jersey by jersey.
the class SingletonBeanTest method testCounter.
@Test
public void testCounter() {
final WebTarget counter = target().path("jcdibean/singleton").path(p).queryParam("x", x).path("counter");
if (!ExternalTestContainerFactory.class.isAssignableFrom(getTestContainerFactory().getClass())) {
// TODO: remove this workaround once JERSEY-2744 is resolved
counter.request().put(Entity.text("10"));
}
String c10 = counter.request().get(String.class);
assertThat(c10, containsString("10"));
String c11 = counter.request().get(String.class);
assertThat(c11, containsString("11"));
counter.request().put(Entity.text("32"));
String c32 = counter.request().get(String.class);
assertThat(c32, containsString("32"));
counter.request().put(Entity.text("10"));
}
use of javax.ws.rs.client.WebTarget in project jersey by jersey.
the class SingletonDependentBeanTest method testException.
@Test
public void testException() {
final WebTarget exception = target().path("jcdibean/dependent/singleton").path(p).queryParam("x", x).path("exception");
assertThat(exception.request().get().readEntity(String.class), containsString("JDCIBeanDependentException"));
}
use of javax.ws.rs.client.WebTarget in project jersey by jersey.
the class SingletonDependentBeanTest method testCounter.
@Test
public void testCounter() {
final WebTarget counter = target().path("jcdibean/dependent/singleton").path(p).queryParam("x", x).path("counter");
if (!ExternalTestContainerFactory.class.isAssignableFrom(getTestContainerFactory().getClass())) {
// TODO: remove this workaround once JERSEY-2744 is resolved
counter.request().put(Entity.text("10"));
}
String c10 = counter.request().get(String.class);
assertThat(c10, containsString("10"));
String c11 = counter.request().get(String.class);
assertThat(c11, containsString("11"));
counter.request().put(Entity.text("32"));
String c32 = counter.request().get(String.class);
assertThat(c32, containsString("32"));
counter.request().put(Entity.text("10"));
}
Aggregations