Skip to content

Commit

Permalink
Fix the EdgeOptionsTest
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Sep 28, 2021
1 parent e6366da commit eeba903
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions java/test/org/openqa/selenium/edge/EdgeOptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.openqa.selenium.edge;

import com.google.common.io.Files;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.ImmutableCapabilities;
Expand All @@ -29,6 +28,8 @@
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
Expand Down Expand Up @@ -66,8 +67,7 @@ public void canAddArguments() {
@Test
public void canAddExtensions() throws IOException {
EdgeOptions options = new EdgeOptions();
File tmpDir = File.createTempFile("webdriver", "tmp");
tmpDir.deleteOnExit();
Path tmpDir = Files.createTempDirectory("webdriver");
File ext1 = createTempFile(tmpDir, "ext1 content");
File ext2 = createTempFile(tmpDir, "ext2 content");
options.addExtensions(ext1, ext2);
Expand Down Expand Up @@ -96,11 +96,11 @@ private void checkCommonStructure(EdgeOptions options) {
.containsOnlyKeys("args", "extensions");
}

private File createTempFile(File tmpDir, String content) {
private File createTempFile(Path tmpDir, String content) {
try {
File ext = File.createTempFile("tmp", "ext", tmpDir);
Files.asCharSink(ext, Charset.defaultCharset()).write(content);
return ext;
Path file = Files.createTempFile(tmpDir, "tmp", "ext");
Files.write(file, content.getBytes(Charset.defaultCharset()));
return file.toFile();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down

0 comments on commit eeba903

Please sign in to comment.