[java] refactor(remote/command): Merge overload's business logic by nnnnoel · Pull Request #14469 · SeleniumHQ/selenium

User description

Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

Merge overload's business logic to make it easy to see at a glance

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

Enhancement


Description

  • Refactored deprecated timeout methods to delegate to their Duration-based counterparts

  • Updated NEW_SESSION(Capabilities) to call the collection-based overload

  • Eliminated duplicate business logic across method overloads


Diagram Walkthrough

flowchart LR
  A["Deprecated TimeUnit methods"] -- "delegate to" --> B["Duration-based methods"]
  C["Single Capabilities overload"] -- "delegates to" --> D["Collection-based overload"]
Loading

File Walkthrough

Relevant files
Enhancement
DriverCommand.java
Consolidate overloaded method implementations to reduce duplication

java/src/org/openqa/selenium/remote/DriverCommand.java

  • Refactored NEW_SESSION(Capabilities) to delegate to
    NEW_SESSION(Collection)
  • Updated SET_IMPLICIT_WAIT_TIMEOUT(long, TimeUnit) to call
    Duration-based overload
  • Updated SET_SCRIPT_TIMEOUT(long, TimeUnit) to call Duration-based
    overload
  • Updated SET_PAGE_LOAD_TIMEOUT(long, TimeUnit) to call Duration-based
    overload
+4/-7