From 545cc9bd3ba98e01421e1acc12f453e2bbf5db5a Mon Sep 17 00:00:00 2001 From: Navin Chandra Date: Mon, 17 Feb 2025 15:41:51 +0530 Subject: [PATCH 1/2] change return type in docstrings to List --- .../selenium/remote/RemoteWebDriver.java | 4 ++-- .../remote/RemoteWebDriverUnitTest.java | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/java/src/org/openqa/selenium/remote/RemoteWebDriver.java b/java/src/org/openqa/selenium/remote/RemoteWebDriver.java index e0443aea24d89..989b932125a3a 100644 --- a/java/src/org/openqa/selenium/remote/RemoteWebDriver.java +++ b/java/src/org/openqa/selenium/remote/RemoteWebDriver.java @@ -651,9 +651,9 @@ public void removeVirtualAuthenticator(VirtualAuthenticator authenticator) { } /** - * Retrieves the downloadable files as a map of file names and their corresponding URLs. + * Retrieves the names of the downloadable files. * - * @return A map containing file names as keys and URLs as values. + * @return A list containing the names of the downloadable files. * @throws WebDriverException if capability to enable downloads is not set */ @Override diff --git a/java/test/org/openqa/selenium/remote/RemoteWebDriverUnitTest.java b/java/test/org/openqa/selenium/remote/RemoteWebDriverUnitTest.java index 7d7302740307b..4eda90466ab9c 100644 --- a/java/test/org/openqa/selenium/remote/RemoteWebDriverUnitTest.java +++ b/java/test/org/openqa/selenium/remote/RemoteWebDriverUnitTest.java @@ -807,4 +807,23 @@ void noArgConstructorEmptyCapabilitiesTest() { RemoteWebDriver driver = new RemoteWebDriver() {}; // anonymous subclass assertThat(driver.getCapabilities()).isEqualTo(new ImmutableCapabilities()); } + + @Test + void getDownloadableFilesReturnsType() { + List expectedFiles = Arrays.asList("file1.txt", "file2.pdf"); + + WebDriverFixture fixture = new WebDriverFixture( + new ImmutableCapabilities("se:downloadsEnabled", true), + echoCapabilities, + valueResponder(ImmutableMap.of("names", expectedFiles)) + ); + + List result = fixture.driver.getDownloadableFiles(); + + assertThat(result) + .isInstanceOf(List.class) + .isEqualTo(expectedFiles); + + fixture.verifyCommands(new CommandPayload(DriverCommand.GET_DOWNLOADABLE_FILES, emptyMap())); + } } From 58b40bc3000506a682acd0ed5228c1e77d23cda1 Mon Sep 17 00:00:00 2001 From: Navin Chandra Date: Mon, 17 Feb 2025 15:45:24 +0530 Subject: [PATCH 2/2] run format.sh --- .../selenium/remote/RemoteWebDriverUnitTest.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/java/test/org/openqa/selenium/remote/RemoteWebDriverUnitTest.java b/java/test/org/openqa/selenium/remote/RemoteWebDriverUnitTest.java index 4eda90466ab9c..14c8ee3273eff 100644 --- a/java/test/org/openqa/selenium/remote/RemoteWebDriverUnitTest.java +++ b/java/test/org/openqa/selenium/remote/RemoteWebDriverUnitTest.java @@ -812,17 +812,15 @@ void noArgConstructorEmptyCapabilitiesTest() { void getDownloadableFilesReturnsType() { List expectedFiles = Arrays.asList("file1.txt", "file2.pdf"); - WebDriverFixture fixture = new WebDriverFixture( - new ImmutableCapabilities("se:downloadsEnabled", true), - echoCapabilities, - valueResponder(ImmutableMap.of("names", expectedFiles)) - ); + WebDriverFixture fixture = + new WebDriverFixture( + new ImmutableCapabilities("se:downloadsEnabled", true), + echoCapabilities, + valueResponder(ImmutableMap.of("names", expectedFiles))); List result = fixture.driver.getDownloadableFiles(); - assertThat(result) - .isInstanceOf(List.class) - .isEqualTo(expectedFiles); + assertThat(result).isInstanceOf(List.class).isEqualTo(expectedFiles); fixture.verifyCommands(new CommandPayload(DriverCommand.GET_DOWNLOADABLE_FILES, emptyMap())); }