Examples of contentsString()


Examples of org.webbitserver.stub.StubHttpResponse.contentsString()

        request.header("Range", "bytes=0-");
        StubHttpResponse response = handle(request);
        assertReturnedWithStatus(206, response);
        assertEquals(String.valueOf(contents.length()), response.header("Content-Length"));
        assertEquals("bytes 0-" + (contents.length() - 1) + "/" + contents.length(), response.header("Content-Range"));
        assertEquals(contents, response.contentsString());
    }

    @Test
    public void shouldSupportUnboundedStartRangeRequests() throws Exception {
        String contents = "the yellow fox jumped over the blue log";
View Full Code Here

Examples of org.webbitserver.stub.StubHttpResponse.contentsString()

        request.header("Range", "bytes=-8");
        StubHttpResponse response = handle(request);
        assertReturnedWithStatus(206, response);
        assertEquals(String.valueOf(8), response.header("Content-Length"));
        assertEquals("bytes 31-" + (contents.length() - 1) + "/" + contents.length(), response.header("Content-Range"));
        assertEquals("blue log", response.contentsString());
    }

    @Test
    public void shouldSupportBoundedRangeRequests() throws Exception {
        String contents = "the yellow fox jumped over the blue log";
View Full Code Here

Examples of org.webbitserver.stub.StubHttpResponse.contentsString()

        StubHttpRequest request = request("/some_file");
        request.header("Range", "bytes=4-9");
        StubHttpResponse response = handle(request);
        assertReturnedWithStatus(206, response);
        assertEquals("bytes 4-9" + "/" + contents.length(), response.header("Content-Range"));
        assertEquals("yellow", response.contentsString());
        assertEquals(String.valueOf(6), response.header("Content-Length"));
    }

    @Test
    public void shouldReturnInvalidRangeIfBeyondSizeOfContent() throws Exception {
View Full Code Here

Examples of org.webbitserver.stub.StubHttpResponse.contentsString()

    public void listsDirectory() throws Exception {
        handler.enableDirectoryListing(true).welcomeFile("doesnotexist");

        StubHttpResponse response = handle(request("/"));
        assertEquals(200, response.status());
        assertThat(response.contentsString(), containsString("index.html"));
        assertThat(response.contentsString(), containsString("jquery-1.5.2.js"));
        assertThat(response.contentsString(), not(containsString("EmbeddedResourceHandlerTest")));
    }

    @Test
View Full Code Here

Examples of org.webbitserver.stub.StubHttpResponse.contentsString()

        handler.enableDirectoryListing(true).welcomeFile("doesnotexist");

        StubHttpResponse response = handle(request("/"));
        assertEquals(200, response.status());
        assertThat(response.contentsString(), containsString("index.html"));
        assertThat(response.contentsString(), containsString("jquery-1.5.2.js"));
        assertThat(response.contentsString(), not(containsString("EmbeddedResourceHandlerTest")));
    }

    @Test
    public void listsSubDirectory() throws Exception {
View Full Code Here

Examples of org.webbitserver.stub.StubHttpResponse.contentsString()

        StubHttpResponse response = handle(request("/"));
        assertEquals(200, response.status());
        assertThat(response.contentsString(), containsString("index.html"));
        assertThat(response.contentsString(), containsString("jquery-1.5.2.js"));
        assertThat(response.contentsString(), not(containsString("EmbeddedResourceHandlerTest")));
    }

    @Test
    public void listsSubDirectory() throws Exception {
      handler.enableDirectoryListing(true).welcomeFile("doesnotexist");
View Full Code Here

Examples of org.webbitserver.stub.StubHttpResponse.contentsString()

      handler.enableDirectoryListing(true).welcomeFile("doesnotexist");

      StubHttpResponse response = handle(request("/"));
      assertEquals(200, response.status());
      // / is a /
      assertThat(response.contentsString(), containsString("href=\"subdir/\""));
      assertThat(response.contentsString(), not(containsString("subfile.txt")));

      response = handle(request("/subdir/"));
      assertEquals(200, response.status());
      assertThat(response.contentsString(), containsString("subfile.txt"));
View Full Code Here

Examples of org.webbitserver.stub.StubHttpResponse.contentsString()

      StubHttpResponse response = handle(request("/"));
      assertEquals(200, response.status());
      // / is a /
      assertThat(response.contentsString(), containsString("href=\"subdir/\""));
      assertThat(response.contentsString(), not(containsString("subfile.txt")));

      response = handle(request("/subdir/"));
      assertEquals(200, response.status());
      assertThat(response.contentsString(), containsString("subfile.txt"));
      assertThat(response.contentsString(), not(containsString("index.html")));
View Full Code Here

Examples of org.webbitserver.stub.StubHttpResponse.contentsString()

      assertThat(response.contentsString(), containsString("href=\"subdir/\""));
      assertThat(response.contentsString(), not(containsString("subfile.txt")));

      response = handle(request("/subdir/"));
      assertEquals(200, response.status());
      assertThat(response.contentsString(), containsString("subfile.txt"));
      assertThat(response.contentsString(), not(containsString("index.html")));
    }

    @Test
    public void shouldFindWelcomeFile() throws Exception {
View Full Code Here

Examples of org.webbitserver.stub.StubHttpResponse.contentsString()

      assertThat(response.contentsString(), not(containsString("subfile.txt")));

      response = handle(request("/subdir/"));
      assertEquals(200, response.status());
      assertThat(response.contentsString(), containsString("subfile.txt"));
      assertThat(response.contentsString(), not(containsString("index.html")));
    }

    @Test
    public void shouldFindWelcomeFile() throws Exception {
        assertReturnedWithStatus(200, handle(request("/")));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.