Skip to content

Commit

Permalink
Enhanced Switch Statement
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Oct 24, 2024
1 parent 4450ce4 commit a04e401
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,11 @@ public Map<String, String> start() {
}

private static BrowserType browser(Playwright playwright, WithPlaywright.Browser browser) {
switch (browser) {
case CHROMIUM:
return playwright.chromium();
case FIREFOX:
return playwright.firefox();
case WEBKIT:
return playwright.webkit();
}
return playwright.chromium();
return switch (browser) {
case FIREFOX -> playwright.firefox();
case WEBKIT -> playwright.webkit();
default -> playwright.chromium();
};
}

@Override
Expand All @@ -97,4 +93,4 @@ public void inject(TestInjector testInjector) {
new TestInjector.AnnotatedAndMatchesType(InjectPlaywright.class, Browser.class));
}

}
}

0 comments on commit a04e401

Please sign in to comment.