コード例 #1
0
  /** @throws Exception */
  @Test
  public void shouldAccessStaticResource() throws Exception {
    server
        .withWebAppAt(WebAppBuilder.buildFrom(new BarResource("bar-value")), "/api/*")
        .withStaticResourcesAt("/static", "/*")
        .start();

    shouldRetrieveResourceWithValue("/api/bar", "bar-value");
    shouldRetrieveResourceWithValue("/index.html", "<html>\nfoo\n</html>");
  }
コード例 #2
0
  /** @throws Exception */
  @Test
  public void shouldAccessJerseyResources() throws Exception {
    server
        .withWebAppAt(
            WebAppBuilder.buildFrom(new FooResource("foo-value"), new BarResource("bar-value")),
            "/*")
        .start();

    shouldRetrieveResourceWithValue("/foo/0", "foo-value");
    shouldRetrieveResourceWithValue("/bar", "bar-value");

    assertEquals(
        ClientResponse.Status.NO_CONTENT,
        root()
            .path("/foo/other-foo")
            .accept(MediaType.TEXT_PLAIN)
            .put(ClientResponse.class)
            .getClientResponseStatus());

    shouldRetrieveResourceWithValue("/foo/1", "other-foo");
  }