diff --git a/java/test/org/openqa/selenium/RequireTest.java b/java/test/org/openqa/selenium/RequireTest.java index a3db623d279d3..ebfa5a1f17431 100644 --- a/java/test/org/openqa/selenium/RequireTest.java +++ b/java/test/org/openqa/selenium/RequireTest.java @@ -261,46 +261,6 @@ void canCheckStateClass() { assertThat(Require.state("That", arg2).instanceOf(String.class)).isSameAs(arg2); } - @Test - void canCheckFileState() throws IOException { - assertThatExceptionOfType(IllegalStateException.class) - .isThrownBy(() -> Require.state("Target", (Path) null).isFile()) - .withMessage("Target must be set"); - File tempFile = File.createTempFile("example", "tmp"); - tempFile.deleteOnExit(); - assertThat(Require.state("Target", tempFile.toPath()).isFile()).isSameAs(tempFile.toPath()); - File dir = tempFile.getParentFile(); - assertThatExceptionOfType(IllegalStateException.class) - .isThrownBy(() -> Require.state("Target", dir.toPath()).isFile()) - .withMessage("Target must be a regular file: %s", dir); - if (!tempFile.delete()) { - fail("Unable to delete temp file"); - } - assertThatExceptionOfType(IllegalStateException.class) - .isThrownBy(() -> Require.state("Target", tempFile.toPath()).isFile()) - .withMessage("Target must exist: %s", tempFile); - } - - @Test - void canCheckDirectoryState() throws IOException { - assertThatExceptionOfType(IllegalStateException.class) - .isThrownBy(() -> Require.state("Target", (Path) null).isDirectory()) - .withMessage("Target must be set"); - File tempFile = File.createTempFile("example", "tmp"); - tempFile.deleteOnExit(); - assertThatExceptionOfType(IllegalStateException.class) - .isThrownBy(() -> Require.state("Target", tempFile.toPath()).isDirectory()) - .withMessage("Target must be a directory: %s", tempFile); - File dir = tempFile.getParentFile(); - assertThat(Require.state("Target", dir.toPath()).isDirectory()).isSameAs(dir.toPath()); - if (!tempFile.delete()) { - fail("Unable to delete temp file"); - } - assertThatExceptionOfType(IllegalStateException.class) - .isThrownBy(() -> Require.state("Target", tempFile.toPath()).isDirectory()) - .withMessage("Target must exist: %s", tempFile); - } - @Test void canCheckFilePathState() throws IOException { assertThatExceptionOfType(IllegalStateException.class)