diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-10-12 10:46:06 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-10-12 11:46:06 +0300 |
commit | c147b5d85bca3ddf30d9adbcd268066165889f37 (patch) | |
tree | 18d73bda278618004ec4a28ee62af7eb7edbeb98 /testbench-api/src | |
parent | 13d406a7086cc1546eac3fa86f6263bfb436de85 (diff) | |
download | vaadin-framework-c147b5d85bca3ddf30d9adbcd268066165889f37.tar.gz vaadin-framework-c147b5d85bca3ddf30d9adbcd268066165889f37.zip |
Use Collection.isEmpty() (#10172)
Diffstat (limited to 'testbench-api/src')
4 files changed, 8 insertions, 8 deletions
diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/MenuBarElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/MenuBarElement.java index 8c54b0584c..3eb42b3aba 100644 --- a/testbench-api/src/main/java/com/vaadin/testbench/elements/MenuBarElement.java +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/MenuBarElement.java @@ -94,7 +94,7 @@ public class MenuBarElement extends AbstractComponentElement { private WebElement getSelectedTopLevelItem() { List<WebElement> selectedItems = findElements( By.className("v-menubar-menuitem-selected")); - if (selectedItems.size() == 0) { + if (selectedItems.isEmpty()) { return null; } return selectedItems.get(0); diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/TabSheetElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/TabSheetElement.java index 54c7291d51..7f6004a5af 100644 --- a/testbench-api/src/main/java/com/vaadin/testbench/elements/TabSheetElement.java +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/TabSheetElement.java @@ -32,8 +32,8 @@ public class TabSheetElement extends AbstractComponentContainerElement { // a locator that does not lead to selecting tabs from a contained inner // TabSheet (#13735) - protected org.openqa.selenium.By byTabCell = By - .xpath("./div/table/tbody/tr/td[contains(normalize-space(concat(' ', @class, ' '))," + protected org.openqa.selenium.By byTabCell = By.xpath( + "./div/table/tbody/tr/td[contains(normalize-space(concat(' ', @class, ' '))," + "normalize-space(' v-tabsheet-tabitem '))]"); private static org.openqa.selenium.By byCaption = By .className("v-captiontext"); @@ -109,14 +109,14 @@ public class TabSheetElement extends AbstractComponentContainerElement { private void openTab(WebElement tabCell) { // Open the tab by clicking its caption text if it exists. List<WebElement> tabCaptions = tabCell.findElements(byCaption); - if (tabCaptions.size() > 0) { + if (!tabCaptions.isEmpty()) { tabCaptions.get(0).click(); return; } // If no caption text was found, click the icon of the tab. List<WebElement> tabIcons = tabCell .findElements(By.className("v-icon")); - if (tabIcons.size() > 0) { + if (!tabIcons.isEmpty()) { tabIcons.get(0).click(); return; } @@ -201,7 +201,7 @@ public class TabSheetElement extends AbstractComponentContainerElement { */ private String getTabCaption(WebElement tabCell) { List<WebElement> captionElements = tabCell.findElements(byCaption); - if (captionElements.size() == 0) { + if (captionElements.isEmpty()) { return null; } else { return captionElements.get(0).getText(); diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/TreeTableRowElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/TreeTableRowElement.java index be6bf144a3..d702bacd08 100644 --- a/testbench-api/src/main/java/com/vaadin/testbench/elements/TreeTableRowElement.java +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/TreeTableRowElement.java @@ -29,7 +29,7 @@ public class TreeTableRowElement extends TableRowElement { public void toggleExpanded() { List<WebElement> expandButtons = getWrappedElement() .findElements(By.className("v-treetable-treespacer")); - if (expandButtons.size() > 0) { + if (!expandButtons.isEmpty()) { expandButtons.get(0).click(); } } diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/TwinColSelectElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/TwinColSelectElement.java index b92f410f1d..01e3beaa75 100644 --- a/testbench-api/src/main/java/com/vaadin/testbench/elements/TwinColSelectElement.java +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/TwinColSelectElement.java @@ -62,7 +62,7 @@ public class TwinColSelectElement extends AbstractSelectElement { } deselButton.click(); } - while (selectedOptions.getOptions().size() > 0) { + while (!selectedOptions.getOptions().isEmpty()) { selectedOptions.selectByIndex(0); deselButton.click(); } |