Skip to content

Commit

Permalink
[java] Deleting tests referencing deprecated methods in Require.java
Browse files Browse the repository at this point in the history
  • Loading branch information
diemol committed Jun 26, 2024
1 parent 257104e commit e8745c6
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions java/test/org/openqa/selenium/RequireTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e8745c6

Please sign in to comment.