Skip to content

Commit b2bb8d2

Browse files
author
Mehmet Can Cömert
committed
Issue #2859 updating unit tests.
1 parent 5959687 commit b2bb8d2

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

core/src/test/java/com/predic8/membrane/core/interceptor/server/WebServerInterceptorTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,20 @@ void noIndex() {
5151
ws.setGenerateIndex(false);
5252
ws.handleRequest(exc);
5353
// No index file is set, and no index page is generated, so throw not found.
54-
// System.out.println("exc.getResponse().getBodyAsStringDecoded() = " + exc.getResponse().getBodyAsStringDecoded());
55-
assertEquals(500, exc.getResponse().getStatusCode());
54+
// System.out.println("exc.getResponse().getBodyAsStringDecoded() = " + exc.getResponse().getBodyAsStringDecoded());
55+
assertEquals(404, exc.getResponse().getStatusCode());
5656
}
5757

5858
@Test
59-
void generateIndex() throws Exception {
59+
void generateIndex() {
6060
ws.setGenerateIndex(true);
6161
ws.handleRequest(exc);
6262
// No index file is set, but index page is being generated. Body lists the page.html resource.
63-
String body = exc.getResponse().getBodyAsStringDecoded();
64-
// System.out.println("body = " + body);
65-
66-
JsonNode json = om.readTree(body);
63+
assertEquals(200, exc.getResponse().getStatusCode());
64+
assertTrue(exc.getResponse().getHeader().getFirstValue("Content-Type").contains("text/html"));
6765

68-
assertEquals("Could not resolve file",json.get("title").asText());
69-
assertEquals("https://membrane-api.io/problems/internal",json.get("type").asText());
66+
String body = exc.getResponse().getBodyAsStringDecoded();
67+
assertTrue(body.contains("<a href=\"./index.html\">index.html</a>"));
68+
assertTrue(body.contains("<a href=\"./page.html\">page.html</a>"));
7069
}
71-
}
70+
}

0 commit comments

Comments
 (0)