Skip to content

Commit

Permalink
[FLINK-13934][rest] Use hamcrest for checking String contents
Browse files Browse the repository at this point in the history
  • Loading branch information
zentol committed Sep 6, 2019
1 parent fe84fc5 commit 7c0f4a3
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void testRespondWithFile() throws Exception {
// verify that a) a file can be loaded using the ClassLoader and b) that the HistoryServer
// index_hs.html is injected
String index = HistoryServerTest.getFromHTTP("http:https://localhost:" + port + "/index.html");
Assert.assertTrue(index.contains("Apache Flink Web Dashboard"));
Assert.assertThat(index, containsString("Apache Flink Web Dashboard"));

// verify that index.html is appended if the request path ends on '/'
String index2 = HistoryServerTest.getFromHTTP("http:https://localhost:" + port + "/");
Expand All @@ -73,12 +73,12 @@ public void testRespondWithFile() throws Exception {
File dir = new File(webDir, "dir.json");
dir.mkdirs();
String dirNotFound404 = HistoryServerTest.getFromHTTP("http:https://localhost:" + port + "/dir");
Assert.assertTrue(dirNotFound404.contains("not found"));
Assert.assertThat(dirNotFound404, containsString("not found"));

// verify that a 404 message is returned when requesting a file outside the webDir
tmp.newFile("secret");
String x = HistoryServerTest.getFromHTTP("http:https://localhost:" + port + "/../secret");
Assert.assertTrue(x.contains("not found"));
Assert.assertThat(x, containsString("not found"));
} finally {
webUI.shutdown();
}
Expand Down

0 comments on commit 7c0f4a3

Please sign in to comment.