Skip to content

Instantly share code, notes, and snippets.

@vyo
Created June 8, 2017 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vyo/55fb83999b877f675234a8646c013fc5 to your computer and use it in GitHub Desktop.
Save vyo/55fb83999b877f675234a8646c013fc5 to your computer and use it in GitHub Desktop.
public class EchoControllerJerseyTest extends JerseyTest {
@Override
protected Application configure() {
return new ResourceConfig(EchoController.class);
}
@Test
public void echo() throws Exception {
String input = "input";
String reverse = new StringBuilder(input).reverse().toString();
Response response = target("echo")
.path(input)
.request()
.get();
assertEquals(Status.OK.getStatusCode(), response.getStatus());
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getMediaType());
assertEquals(reverse, response.readEntity(Echo.class).getEcho()); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment