@Test public void statusCode200FromURL() throws Exception { FileDownloader downloadHandler = new FileDownloader(driver); downloadHandler.setURI(downloadURI200.toURL()); downloadHandler.setHTTPRequestMethod(RequestMethod.GET); assertThat(downloadHandler.getLinkHTTPStatus(), is(equalTo(200))); }
@Test public void statusCode405FromURLUsingDelete() throws Exception { FileDownloader downloadHandler = new FileDownloader(driver); downloadHandler.setURI(downloadURI200.toURL()); downloadHandler.setHTTPRequestMethod(RequestMethod.DELETE); assertThat(downloadHandler.getLinkHTTPStatus(), is(equalTo(405))); }
@Test public void statusCode404FromString() throws Exception { FileDownloader downloadHandler = new FileDownloader(driver); downloadHandler.setURI(webServerURL + ":" + webServerPort + "/doesNotExist.html"); downloadHandler.setHTTPRequestMethod(RequestMethod.GET); assertThat(downloadHandler.getLinkHTTPStatus(), is(equalTo(404))); }
@Test public void statusCode404FromURLUsingHead() throws Exception { FileDownloader downloadHandler = new FileDownloader(driver); downloadHandler.setURI(downloadURI404.toURL()); downloadHandler.setHTTPRequestMethod(RequestMethod.HEAD); assertThat(downloadHandler.getLinkHTTPStatus(), is(equalTo(404))); }