diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-10-20 10:10:02 +0200 |
---|---|---|
committer | Péter Török <31210544+torok-peter@users.noreply.github.com> | 2017-10-20 11:10:02 +0300 |
commit | a9c83ba07e4dec90eb7d6e332b91adde9613ebb4 (patch) | |
tree | 7907a6c389ae740572197d949e27c6fd3c25491c /uitest | |
parent | 0a26d0e44169f9643e7d30ba370b8ecbbe128a56 (diff) | |
download | vaadin-framework-a9c83ba07e4dec90eb7d6e332b91adde9613ebb4.tar.gz vaadin-framework-a9c83ba07e4dec90eb7d6e332b91adde9613ebb4.zip |
Use .toLowerCase and .toUpperCase(Locale.ROOT) (#10182)
* Use .toLowerCase and .toUpperCase(Locale.ROOT)
* Spaces
* add spaces after if(
Diffstat (limited to 'uitest')
39 files changed, 223 insertions, 162 deletions
diff --git a/uitest/src/main/java/com/vaadin/launcher/util/BrowserLauncher.java b/uitest/src/main/java/com/vaadin/launcher/util/BrowserLauncher.java index cf26d4a891..5abc77e3ff 100644 --- a/uitest/src/main/java/com/vaadin/launcher/util/BrowserLauncher.java +++ b/uitest/src/main/java/com/vaadin/launcher/util/BrowserLauncher.java @@ -21,6 +21,7 @@ import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; +import java.util.Locale; /** * This class opens default browser for DemoLauncher class. Default browser is @@ -40,7 +41,7 @@ public class BrowserLauncher { boolean started = false; final String os = System.getProperty("os.name", "windows") - .toLowerCase(); + .toLowerCase(Locale.ROOT); // Linux if (os.indexOf("linux") >= 0) { diff --git a/uitest/src/main/java/com/vaadin/tests/TestBench.java b/uitest/src/main/java/com/vaadin/tests/TestBench.java index b7b8c93177..208f583dc3 100644 --- a/uitest/src/main/java/com/vaadin/tests/TestBench.java +++ b/uitest/src/main/java/com/vaadin/tests/TestBench.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Set; import com.vaadin.server.ExternalResource; @@ -180,8 +181,9 @@ public class TestBench extends com.vaadin.server.LegacyApplication if (next instanceof Class) { Class<?> c = (Class<?>) next; String string = c.getSimpleName(); - if (string.toLowerCase() - .contains(fragment.toLowerCase())) { + if (string.toLowerCase(Locale.ROOT) + .contains(fragment.toLowerCase( + Locale.ROOT))) { menu.setValue(c); mainLayout.setSplitPosition(0); return; diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java index a479922b4d..ad27e2b6ab 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java @@ -1,5 +1,7 @@ package com.vaadin.tests.components.combobox; +import java.util.Locale; + import com.vaadin.server.ThemeResource; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.ComboBox; @@ -21,8 +23,9 @@ public class ComboBoxItemIcon extends TestBase { { ComboBox<String> cb = new ComboBox<>(); cb.setItems("FI", "SE"); - cb.setItemIconGenerator(item -> new ThemeResource( - "../tests-tickets/icons/" + item.toLowerCase() + ".gif")); + cb.setItemIconGenerator( + item -> new ThemeResource("../tests-tickets/icons/" + + item.toLowerCase(Locale.ROOT) + ".gif")); addComponent(cb); } @@ -31,7 +34,8 @@ public class ComboBoxItemIcon extends TestBase { cb.setItems("Finland", "Australia", "Hungary"); cb.setItemIconGenerator( item -> new ThemeResource("../tests-tickets/icons/" - + item.substring(0, 2).toLowerCase() + ".gif")); + + item.substring(0, 2).toLowerCase(Locale.ROOT) + + ".gif")); cb.setValue("Hungary"); addComponent(cb); diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java index 3e04594de3..f03c6cb54f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldChangeResolution.java @@ -15,6 +15,8 @@ */ package com.vaadin.tests.components.datefield; +import java.util.Locale; + import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.datefield.DateResolution; import com.vaadin.tests.components.AbstractReindeerTestUI; @@ -42,13 +44,12 @@ public class DateFieldChangeResolution extends AbstractReindeerTestUI { HorizontalLayout hlayout = new HorizontalLayout(); addComponent(hlayout); for (final DateResolution value : DateResolution.values()) { - String resolutionString = value.toString().toLowerCase(); + String resolutionString = value.toString().toLowerCase(Locale.ROOT); Button button = new Button(resolutionString); button.addClickListener(event -> dateField.setResolution(value)); button.setId(BUTTON_BASE_ID + resolutionString); hlayout.addComponent(button); } - } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldChangeResolution.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldChangeResolution.java index 2bf161daf4..2a14e20467 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldChangeResolution.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldChangeResolution.java @@ -15,6 +15,8 @@ */ package com.vaadin.tests.components.datefield; +import java.util.Locale; + import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.datefield.DateTimeResolution; import com.vaadin.tests.components.AbstractReindeerTestUI; @@ -41,13 +43,12 @@ public class DateTimeFieldChangeResolution extends AbstractReindeerTestUI { HorizontalLayout hlayout = new HorizontalLayout(); addComponent(hlayout); for (final DateTimeResolution value : DateTimeResolution.values()) { - String resolutionString = value.toString().toLowerCase(); + String resolutionString = value.toString().toLowerCase(Locale.ROOT); Button button = new Button(resolutionString); button.addClickListener(event -> dateField.setResolution(value)); button.setId(BUTTON_BASE_ID + resolutionString); hlayout.addComponent(button); } - } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java index 92ba75869c..c8f7127f76 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.grid; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.stream.IntStream; @@ -54,7 +55,7 @@ public class GridComponents extends AbstractTestUIWithLog { e -> Notification.show( "Clicked button on row for: " + string, Type.WARNING_MESSAGE)); - button.setId(string.replace(' ', '_').toLowerCase()); + button.setId(string.replace(' ', '_').toLowerCase(Locale.ROOT)); return button; }, new ComponentRenderer()).setId("button").setCaption("Button"); // make sure the buttons and focus outlines fit completely in a row diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridEditorUI.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridEditorUI.java index 400ff5266c..6da0a3757f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridEditorUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridEditorUI.java @@ -18,6 +18,7 @@ package com.vaadin.tests.components.grid; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Locale; import java.util.Random; import com.vaadin.server.VaadinRequest; @@ -51,8 +52,9 @@ public class GridEditorUI extends AbstractReindeerTestUIWithLog { person.setFirstName(TestDataGenerator.getFirstName(r)); person.setLastName(TestDataGenerator.getLastName(r)); person.getAddress().setCity(TestDataGenerator.getCity(r)); - person.setEmail(person.getFirstName().toLowerCase() + "." - + person.getLastName().toLowerCase() + "@vaadin.com"); + person.setEmail(person.getFirstName().toLowerCase(Locale.ROOT) + "." + + person.getLastName().toLowerCase(Locale.ROOT) + + "@vaadin.com"); person.setPhoneNumber(TestDataGenerator.getPhoneNumber(r)); person.getAddress() diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderRightClickAfterDrag.java b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderRightClickAfterDrag.java index b4bc32ab7b..84c676b878 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderRightClickAfterDrag.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderRightClickAfterDrag.java @@ -1,5 +1,7 @@ package com.vaadin.tests.components.table; +import java.util.Locale; + import com.vaadin.server.VaadinRequest; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.ContentMode; @@ -26,10 +28,11 @@ public class HeaderRightClickAfterDrag extends AbstractReindeerTestUI { public void headerClick(Table.HeaderClickEvent event) { if (MouseEventDetails.MouseButton.RIGHT .equals(event.getButton())) { - Window window = new Window("Right-clicked:", new Label( - "<center>" + event.getPropertyId().toString() - .toUpperCase() + "</center>", - ContentMode.HTML)); + Window window = new Window("Right-clicked:", + new Label("<center>" + + event.getPropertyId().toString() + .toUpperCase(Locale.ROOT) + + "</center>", ContentMode.HTML)); window.setPositionX(event.getClientX()); window.setPositionY(event.getClientY()); window.setResizable(false); diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeMode.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeMode.java index 71b0a801b6..8445d8e5c9 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeMode.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldsValueChangeMode.java @@ -1,5 +1,7 @@ package com.vaadin.tests.components.textfield; +import java.util.Locale; + import com.vaadin.data.HasValue.ValueChangeEvent; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.ValueChangeMode; @@ -29,7 +31,7 @@ public class TextFieldsValueChangeMode extends AbstractTestUIWithLog { private Component createFields(Class<?> fieldClass) { VerticalLayout vl = new VerticalLayout(); - String id = fieldClass.getSimpleName().toLowerCase(); + String id = fieldClass.getSimpleName().toLowerCase(Locale.ROOT); try { AbstractField<String> f = (AbstractField<String>) fieldClass .newInstance(); diff --git a/uitest/src/main/java/com/vaadin/tests/containers/TestItemSorter.java b/uitest/src/main/java/com/vaadin/tests/containers/TestItemSorter.java index 4af48db20a..0c6da38a1e 100644 --- a/uitest/src/main/java/com/vaadin/tests/containers/TestItemSorter.java +++ b/uitest/src/main/java/com/vaadin/tests/containers/TestItemSorter.java @@ -2,6 +2,7 @@ package com.vaadin.tests.containers; import java.util.Collection; import java.util.Comparator; +import java.util.Locale; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; @@ -33,13 +34,15 @@ public class TestItemSorter extends TestBase { Boolean b1 = ((CheckBox) o1).getValue(); return b1.compareTo(((CheckBox) o2).getValue()); } else if (o1 instanceof Button && o2 instanceof Button) { - String caption1 = ((Button) o1).getCaption().toLowerCase(); - String caption2 = ((Button) o2).getCaption().toLowerCase(); + String caption1 = ((Button) o1).getCaption() + .toLowerCase(Locale.ROOT); + String caption2 = ((Button) o2).getCaption() + .toLowerCase(Locale.ROOT); return caption1.compareTo(caption2); } else if (o1 instanceof String && o2 instanceof String) { - return ((String) o1).toLowerCase() - .compareTo(((String) o2).toLowerCase()); + return ((String) o1).toLowerCase(Locale.ROOT) + .compareTo(((String) o2).toLowerCase(Locale.ROOT)); } return 0; @@ -54,8 +57,8 @@ public class TestItemSorter extends TestBase { private static void populateContainer(IndexedContainer container) { container.removeAllItems(); - String[] strings = { "Text 1", "Text 2", "true", "false", - "Caption 1", "Caption 2" }; + String[] strings = { "Text 1", "Text 2", "true", "false", "Caption 1", + "Caption 2" }; for (String s : strings) { Object id = container.addItem(); Item item = container.getItem(id); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/ButtonsTest.java b/uitest/src/main/java/com/vaadin/tests/themes/ButtonsTest.java index 76bdb6cd13..5c42c445c0 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/ButtonsTest.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/ButtonsTest.java @@ -1,5 +1,7 @@ package com.vaadin.tests.themes; +import java.util.Locale; + import com.vaadin.server.ThemeResource; import com.vaadin.server.UserError; import com.vaadin.ui.Button; @@ -125,7 +127,7 @@ public class ButtonsTest extends com.vaadin.server.LegacyApplication { } else { b = new Button(style + " style"); } - b.setStyleName(style.toLowerCase()); + b.setStyleName(style.toLowerCase(Locale.ROOT)); if (icon) { b.setIcon(new ThemeResource("../runo/icons/" + (largeIcons ? "64" : "16") + "/document.png")); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java index 4c83430832..b5cb23a867 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java @@ -15,6 +15,8 @@ */ package com.vaadin.tests.themes.valo; +import java.util.Locale; + import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.icons.VaadinIcons; import com.vaadin.navigator.View; @@ -185,7 +187,8 @@ public class CommonParts extends VerticalLayout implements View { typeString = ""; notification.setStyleName(styleString.trim()); } else { - typeString = selectedItem.getText().toLowerCase(); + typeString = selectedItem.getText() + .toLowerCase(Locale.ROOT); notification.setStyleName( (typeString + " " + styleString.trim()) .trim()); @@ -214,8 +217,8 @@ public class CommonParts extends VerticalLayout implements View { styleString = ""; for (MenuItem item : style.getItems()) { if (item.isChecked()) { - styleString += " " - + item.getText().toLowerCase(); + styleString += " " + item.getText() + .toLowerCase(Locale.ROOT); } } if (!styleString.trim().isEmpty()) { @@ -603,7 +606,8 @@ public class CommonParts extends VerticalLayout implements View { if (selectedItem.getText() .equals("Borderless Toolbars")) { toolbarStyle = selectedItem.isChecked() - ? ValoTheme.MENUBAR_BORDERLESS : null; + ? ValoTheme.MENUBAR_BORDERLESS + : null; } win.setContent(windowContent()); @@ -638,8 +642,9 @@ public class CommonParts extends VerticalLayout implements View { @Override public void menuSelected(MenuItem selectedItem) { if (selectedItem.getText().equals("Caption")) { - win.setCaption(selectedItem.isChecked() - ? "Window Caption" : null); + win.setCaption( + selectedItem.isChecked() ? "Window Caption" + : null); } else if (selectedItem.getText().equals("Closable")) { win.setClosable(selectedItem.isChecked()); } else if (selectedItem.getText().equals("Resizable")) { diff --git a/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java b/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java index bdb73234ba..2ac37a07f7 100644 --- a/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java +++ b/uitest/src/main/java/com/vaadin/tests/util/PersonContainer.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Locale; import java.util.Random; import com.vaadin.v7.data.util.BeanItemContainer; @@ -56,8 +57,8 @@ public class PersonContainer extends BeanItemContainer<Person> p.setFirstName(TestDataGenerator.getFirstName(r)); p.setLastName(TestDataGenerator.getLastName(r)); p.getAddress().setCity(TestDataGenerator.getCity(r)); - p.setEmail(p.getFirstName().toLowerCase() + "." - + p.getLastName().toLowerCase() + "@vaadin.com"); + p.setEmail(p.getFirstName().toLowerCase(Locale.ROOT) + "." + + p.getLastName().toLowerCase(Locale.ROOT) + "@vaadin.com"); p.setPhoneNumber(TestDataGenerator.getPhoneNumber(r)); p.getAddress().setPostalCode(TestDataGenerator.getPostalCode(r)); diff --git a/uitest/src/main/java/com/vaadin/tests/widgetset/client/SerializerTestConnector.java b/uitest/src/main/java/com/vaadin/tests/widgetset/client/SerializerTestConnector.java index 797aed66cb..037fc049a8 100644 --- a/uitest/src/main/java/com/vaadin/tests/widgetset/client/SerializerTestConnector.java +++ b/uitest/src/main/java/com/vaadin/tests/widgetset/client/SerializerTestConnector.java @@ -23,6 +23,7 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -169,8 +170,8 @@ public class SerializerTestConnector extends AbstractExtensionConnector { public void sendChar(char value, Character boxedValue, char[] array) { rpc.sendChar(Character.toUpperCase(boxedValue.charValue()), - Character.valueOf(value), - new String(array).toLowerCase().toCharArray()); + Character.valueOf(value), new String(array) + .toLowerCase(Locale.ROOT).toCharArray()); } @Override diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/TextChangeEvents2.java b/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/TextChangeEvents2.java index 4dd7dfd527..7e32692e58 100644 --- a/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/TextChangeEvents2.java +++ b/uitest/src/main/java/com/vaadin/v7/tests/components/textfield/TextChangeEvents2.java @@ -1,5 +1,7 @@ package com.vaadin.v7.tests.components.textfield; +import java.util.Locale; + import com.vaadin.event.FieldEvents.BlurEvent; import com.vaadin.event.FieldEvents.BlurListener; import com.vaadin.event.FieldEvents.FocusEvent; @@ -108,7 +110,7 @@ public class TextChangeEvents2 extends TestBase { @Override public void textChange(TextChangeEvent event) { - tf.setValue(event.getText().toUpperCase()); + tf.setValue(event.getText().toUpperCase(Locale.ROOT)); } }); @@ -122,8 +124,8 @@ public class TextChangeEvents2 extends TestBase { } { - final TextField[] tfs = { new TextField(), - new TextField(), new TextField(), new TextField() }; + final TextField[] tfs = { new TextField(), new TextField(), + new TextField(), new TextField() }; HorizontalLayout hl = new HorizontalLayout(); hl.setCaption("Blää"); getLayout().addComponent(hl); diff --git a/uitest/src/test/java/com/vaadin/tests/binder/BinderValidatorErrorLevelTest.java b/uitest/src/test/java/com/vaadin/tests/binder/BinderValidatorErrorLevelTest.java index 4be9f9a49e..20b788a125 100644 --- a/uitest/src/test/java/com/vaadin/tests/binder/BinderValidatorErrorLevelTest.java +++ b/uitest/src/test/java/com/vaadin/tests/binder/BinderValidatorErrorLevelTest.java @@ -1,6 +1,7 @@ package com.vaadin.tests.binder; import java.io.IOException; +import java.util.Locale; import org.junit.Assert; import org.junit.Test; @@ -22,20 +23,23 @@ public class BinderValidatorErrorLevelTest extends SingleBrowserTest { // Screenshot the whole slot compareScreen(textField.findElement(By.xpath("..")), - l.name().toLowerCase()); + l.name().toLowerCase(Locale.ROOT)); Assert.assertTrue("Error style for " + l.name() + " not present", - textField.getAttribute("class").contains( - "v-textfield-error-" + l.name().toLowerCase())); + textField.getAttribute("class") + .contains("v-textfield-error-" + + l.name().toLowerCase(Locale.ROOT))); textField.setValue("long enough text"); Assert.assertFalse("Error style for " + l.name() + " still present", - textField.getAttribute("class").contains( - "v-textfield-error-" + l.name().toLowerCase())); + textField.getAttribute("class") + .contains("v-textfield-error-" + + l.name().toLowerCase(Locale.ROOT))); textField.setValue("foo"); Assert.assertTrue( "Error style for " + l.name() + " should be present again.", - textField.getAttribute("class").contains( - "v-textfield-error-" + l.name().toLowerCase())); + textField.getAttribute("class") + .contains("v-textfield-error-" + + l.name().toLowerCase(Locale.ROOT))); } } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/ErrorLevelsTest.java b/uitest/src/test/java/com/vaadin/tests/components/ErrorLevelsTest.java index 2dc9e02914..647c9601e4 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ErrorLevelsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ErrorLevelsTest.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; +import java.util.Locale; import org.junit.Test; import org.openqa.selenium.Keys; @@ -133,7 +134,7 @@ public class ErrorLevelsTest extends SingleBrowserTest { private String getErrorLevelClassName(String prefix, ErrorLevel errorLevel) { - return prefix + "-" + errorLevel.toString().toLowerCase(); + return prefix + "-" + errorLevel.toString().toLowerCase(Locale.ROOT); } private List<String> getErrorLevelClassNames(String prefix, @@ -147,7 +148,8 @@ public class ErrorLevelsTest extends SingleBrowserTest { private void selectErrorLevel(ErrorLevel errorLevel) { errorLevelSelector.clear(); - errorLevelSelector.sendKeys(errorLevel.toString().toLowerCase()); + errorLevelSelector + .sendKeys(errorLevel.toString().toLowerCase(Locale.ROOT)); errorLevelSelector.sendKeys(getReturn()); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java index 36367e4b66..b5883d43b9 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/checkboxgroup/CheckBoxGroupTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Locale; import java.util.stream.Collectors; import org.junit.Before; @@ -260,11 +261,11 @@ public class CheckBoxGroupTest extends MultiBrowserTest { for (int i = 0; i < optionsCssClasses.size(); i++) { String cssClassList = optionsCssClasses.get(i); if (i == 10) { - assertTrue("10th item should be disabled", - cssClassList.toLowerCase().contains("disabled")); + assertTrue("10th item should be disabled", cssClassList + .toLowerCase(Locale.ROOT).contains("disabled")); } else { - assertFalse("Only 10th item should be disabled", - cssClassList.toLowerCase().contains("disabled")); + assertFalse("Only 10th item should be disabled", cssClassList + .toLowerCase(Locale.ROOT).contains("disabled")); } } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridColspansTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridColspansTest.java index 27b9e805bd..306e0cbe3f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridColspansTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridColspansTest.java @@ -57,14 +57,14 @@ public class GridColspansTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); assertEquals("Failed initial condition.", "all the stuff", - grid.getHeaderCell(0, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(0, 1).getText().toLowerCase(Locale.ROOT)); assertEquals("Failed initial condition.", "first name", - grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ROOT)); $(ButtonElement.class).caption("Show/Hide firstName").first().click(); assertEquals("Header text changed on column hide.", "all the stuff", - grid.getHeaderCell(0, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(0, 1).getText().toLowerCase(Locale.ROOT)); assertEquals("Failed initial condition.", "last name", - grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ROOT)); } @Test @@ -74,17 +74,17 @@ public class GridColspansTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); assertEquals("Failed initial condition.", "first name", - grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ROOT)); $(ButtonElement.class).caption("Show/Hide firstName").first().click(); assertEquals("Failed initial condition.", "last name", - grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ROOT)); $(ButtonElement.class).caption("Show/Hide firstName").first().click(); assertEquals("Failed to find first name in last column", "first name", - grid.getHeaderCell(2, 5).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(2, 5).getText().toLowerCase(Locale.ROOT)); } @@ -95,18 +95,18 @@ public class GridColspansTest extends MultiBrowserTest { GridElement grid = $(GridElement.class).first(); GridCellElement headerCell = grid.getHeaderCell(1, 1); assertEquals("Failed initial condition.", "full name", - headerCell.getText().toLowerCase(Locale.ENGLISH)); + headerCell.getText().toLowerCase(Locale.ROOT)); assertEquals("Failed initial condition.", "first name", - grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ENGLISH)); + grid.getHeaderCell(2, 1).getText().toLowerCase(Locale.ROOT)); $(ButtonElement.class).get(1).click(); headerCell = grid.getHeaderCell(1, 1); assertEquals("Joined Header text not changed on column reorder.", - "misc", headerCell.getText().toLowerCase(Locale.ENGLISH)); + "misc", headerCell.getText().toLowerCase(Locale.ROOT)); assertEquals("Unexpected colspan", "1", headerCell.getAttribute("colspan")); headerCell = grid.getHeaderCell(1, 2); assertEquals("Header text not changed on column reorder", "full name", - headerCell.getText().toLowerCase(Locale.ENGLISH)); + headerCell.getText().toLowerCase(Locale.ROOT)); assertEquals("Unexpected colspan", "2", headerCell.getAttribute("colspan")); diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java index 88b218e6bf..4a303ddfb5 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridComponentsTest.java @@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.Locale; import java.util.stream.IntStream; import java.util.stream.Stream; @@ -142,7 +143,9 @@ public class GridComponentsTest extends MultiBrowserTest { GridRowElement row = $(GridElement.class).first().getRow(i); assertEquals("Label text did not match", string, row.getCell(0).getText()); - row.findElement(By.id(string.replace(' ', '_').toLowerCase())).click(); + row.findElement( + By.id(string.replace(' ', '_').toLowerCase(Locale.ROOT))) + .click(); // IE 11 is slow, need to wait for the notification. waitUntil(driver -> isElementPresent(NotificationElement.class), 10); assertTrue("Notification should contain given text", diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridGeneratedPropertiesTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridGeneratedPropertiesTest.java index df89f217f3..c2c28c75df 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridGeneratedPropertiesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridGeneratedPropertiesTest.java @@ -19,6 +19,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import java.util.Locale; + import org.junit.Test; import com.vaadin.testbench.elements.GridElement; @@ -35,7 +37,7 @@ public class GridGeneratedPropertiesTest extends MultiBrowserTest { openTestURL(); GridElement grid = $(GridElement.class).first(); assertEquals("Miles header wasn't present.", "miles", - grid.getHeaderCell(0, 2).getText().toLowerCase()); + grid.getHeaderCell(0, 2).getText().toLowerCase(Locale.ROOT)); } @Test diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionScrollBarTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionScrollBarTest.java index 93935f7524..4c4f4595c4 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionScrollBarTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionScrollBarTest.java @@ -18,6 +18,7 @@ package com.vaadin.tests.components.grid; import static org.junit.Assert.assertTrue; import java.io.IOException; +import java.util.Locale; import org.junit.Test; @@ -33,7 +34,7 @@ public class GridMultiSelectionScrollBarTest extends MultiBrowserTest { assertTrue("Horizontal scrollbar should not be visible.", $(GridElement.class).first().getHorizontalScroller() - .getAttribute("style").toLowerCase() + .getAttribute("style").toLowerCase(Locale.ROOT) .contains("display: none;")); // Just to make sure nothing odd happened. diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicsTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicsTest.java index caec06b3f5..67c196a4e9 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridBasicsTest.java @@ -5,6 +5,7 @@ import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.stream.Stream; import org.junit.Before; @@ -150,8 +151,8 @@ public abstract class GridBasicsTest extends MultiBrowserTest { protected void assertColumnHeader(String expectedHeaderCaption, TestBenchElement testBenchElement) { - assertEquals(expectedHeaderCaption.toLowerCase(), - testBenchElement.getText().toLowerCase()); + assertEquals(expectedHeaderCaption.toLowerCase(Locale.ROOT), + testBenchElement.getText().toLowerCase(Locale.ROOT)); } protected void assertColumnIsSorted(int index) { @@ -199,7 +200,8 @@ public abstract class GridBasicsTest extends MultiBrowserTest { List<WebElement> elements = sidebar .findElements(By.className("column-hiding-toggle")); for (WebElement e : elements) { - if (e.getText().toLowerCase().startsWith("column " + columnIndex)) { + if (e.getText().toLowerCase(Locale.ROOT) + .startsWith("column " + columnIndex)) { return e; } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridHeaderFooterTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridHeaderFooterTest.java index b7ba76ea73..322524fc76 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridHeaderFooterTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/grid/basics/GridHeaderFooterTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.List; +import java.util.Locale; import java.util.stream.IntStream; import org.junit.Test; @@ -157,7 +158,8 @@ public class GridHeaderFooterTest extends GridBasicsTest { "Text Header"); GridCellElement textCell = getGridElement().getHeaderCell(0, 2); - assertEquals("text header", textCell.getText().toLowerCase()); + assertEquals("text header", + textCell.getText().toLowerCase(Locale.ROOT)); } @Test @@ -180,16 +182,16 @@ public class GridHeaderFooterTest extends GridBasicsTest { assertTrue("No notifications should've been shown", !$(NotificationElement.class).exists()); assertEquals("Header should've been reverted back to text header", - "text header", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + "text header", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); } @Test public void testColumnHidingToggleCaption_settingWidgetToHeader_toggleCaptionStays() { toggleColumnHidable(1); getSidebarOpenButton().click(); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); assertEquals("Column 1", getColumnHidingToggle(1).getText()); selectMenuPath("Component", "Columns", "Column 1", "Header Type", @@ -218,7 +220,8 @@ public class GridHeaderFooterTest extends GridBasicsTest { "Text Footer"); GridCellElement textCell = getGridElement().getFooterCell(0, 2); - assertEquals("text footer", textCell.getText().toLowerCase()); + assertEquals("text footer", + textCell.getText().toLowerCase(Locale.ROOT)); } @Test @@ -241,16 +244,16 @@ public class GridHeaderFooterTest extends GridBasicsTest { assertTrue("No notifications should've been shown", !$(NotificationElement.class).exists()); assertEquals("Footer should've been reverted back to text footer", - "text footer", - getGridElement().getFooterCell(0, 1).getText().toLowerCase()); + "text footer", getGridElement().getFooterCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); } @Test public void testColumnHidingToggleCaption_settingWidgetToFooter_toggleCaptionStays() { toggleColumnHidable(1); getSidebarOpenButton().click(); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); assertEquals("Column 1", getColumnHidingToggle(1).getText()); selectMenuPath("Component", "Columns", "Column 1", "Footer Type", diff --git a/uitest/src/test/java/com/vaadin/tests/components/table/ColumnReorderingWithManyColumnsTest.java b/uitest/src/test/java/com/vaadin/tests/components/table/ColumnReorderingWithManyColumnsTest.java index 98b10b9ce0..5e5773fc3f 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/table/ColumnReorderingWithManyColumnsTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/table/ColumnReorderingWithManyColumnsTest.java @@ -3,6 +3,7 @@ package com.vaadin.tests.components.table; import static org.junit.Assert.assertEquals; import java.io.IOException; +import java.util.Locale; import org.junit.Test; import org.openqa.selenium.By; @@ -25,7 +26,7 @@ public class ColumnReorderingWithManyColumnsTest extends MultiBrowserTest { .findElement(By.className("v-table-focus-slot-right")); String markedColumnName = markedElement.findElement(By.xpath("..")) .getText(); - assertEquals("col-9", markedColumnName.toLowerCase()); + assertEquals("col-9", markedColumnName.toLowerCase(Locale.ROOT)); } private void drag(WebElement source, WebElement target) { diff --git a/uitest/src/test/java/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java b/uitest/src/test/java/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java index 73dfc8f77e..3f7ab9c098 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/ui/UIAutoGeneratedStyleNameTest.java @@ -39,7 +39,7 @@ public class UIAutoGeneratedStyleNameTest extends MultiBrowserTest { assertTrue("UI div element doesn't contain autogenerated style name", containsStyle(getDriver().findElement(By.className("v-app")), UIAutoGeneratedStyleName.class.getSimpleName() - .toLowerCase(Locale.ENGLISH))); + .toLowerCase(Locale.ROOT))); assertTrue( "Overlays div element doesn't contain autogenerated style name", @@ -47,7 +47,7 @@ public class UIAutoGeneratedStyleNameTest extends MultiBrowserTest { getDriver().findElement( By.className("v-overlay-container")), UIAutoGeneratedStyleName.class.getSimpleName() - .toLowerCase(Locale.ENGLISH))); + .toLowerCase(Locale.ROOT))); } private boolean containsStyle(WebElement element, String style) { diff --git a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java index f23f087b40..655d046166 100644 --- a/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java +++ b/uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java @@ -19,6 +19,8 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; +import java.util.Locale; + import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; @@ -105,7 +107,8 @@ public class BasicCrudGridEditorRowTest extends MultiBrowserTest { // Open editor row new Actions(getDriver()).doubleClick(cell).perform(); - String attribute = grid.getEditor().getAttribute("style").toLowerCase(); + String attribute = grid.getEditor().getAttribute("style") + .toLowerCase(Locale.ROOT); assertFalse("Style should not contain top.", attribute.contains("top:")); } diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/AffectedTB3TestLocator.java b/uitest/src/test/java/com/vaadin/tests/tb3/AffectedTB3TestLocator.java index 9f8a79859d..016a246d40 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/AffectedTB3TestLocator.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/AffectedTB3TestLocator.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Set; public class AffectedTB3TestLocator extends TB3TestLocator { @@ -65,7 +66,8 @@ public class AffectedTB3TestLocator extends TB3TestLocator { String lastPart = packageParts[packageParts.length - 2]; for (String f : affectedFiles) { - if (f.toLowerCase().contains(lastPart.toLowerCase())) { + if (f.toLowerCase(Locale.ROOT) + .contains(lastPart.toLowerCase(Locale.ROOT))) { affectedTestClasses.add(c); // Break here not to accidentally add the same test class @@ -82,7 +84,7 @@ public class AffectedTB3TestLocator extends TB3TestLocator { List<String> affectedFilePaths = new ArrayList<>(); for (String path : changedTB3TestLocator.getChangedFilePaths()) { - if (!path.toLowerCase().contains("test")) { + if (!path.toLowerCase(Locale.ROOT).contains("test")) { affectedFilePaths.add(path); } } diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java b/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java index 98a98ffae0..8b3967f087 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/ChangedTB3TestLocator.java @@ -19,6 +19,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import org.eclipse.jgit.api.DiffCommand; import org.eclipse.jgit.api.Git; @@ -153,8 +154,8 @@ public class ChangedTB3TestLocator extends TB3TestLocator { List<String> changedTestFilePaths = new ArrayList<>(); for (String filePath : getChangedFilePaths()) { - if (filePath.toLowerCase().startsWith("uitest") - && filePath.toLowerCase().endsWith(".java")) { + if (filePath.toLowerCase(Locale.ROOT).startsWith("uitest") + && filePath.toLowerCase(Locale.ROOT).endsWith(".java")) { changedTestFilePaths.add(filePath); } } diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/ParameterizedTB3Runner.java b/uitest/src/test/java/com/vaadin/tests/tb3/ParameterizedTB3Runner.java index 20107f8058..9cadcece10 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/ParameterizedTB3Runner.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/ParameterizedTB3Runner.java @@ -77,7 +77,7 @@ public class ParameterizedTB3Runner extends TB3Runner { // getThemes -> setTheme String setter = "set" + m.getName().substring("get".length()); setter = setter.substring(0, setter.length() - 1); - // property = property.substring(0, 1).toLowerCase() + // property = property.substring(0, 1).toLowerCase(Locale.ROOT) // + property.substring(1); Method setterMethod; diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java b/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java index 4a34c355ad..8e55e9140a 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/PrivateTB3Configuration.java @@ -26,6 +26,7 @@ import java.net.NetworkInterface; import java.net.SocketException; import java.util.Calendar; import java.util.Enumeration; +import java.util.Locale; import java.util.Properties; import org.openqa.selenium.ie.InternetExplorerDriver; @@ -131,8 +132,9 @@ public abstract class PrivateTB3Configuration extends ScreenshotTB3Test { protected static DesiredCapabilities getRunLocallyCapabilities() { VaadinBrowserFactory factory = new VaadinBrowserFactory(); try { - return factory.create(Browser.valueOf(properties - .getProperty(RUN_LOCALLY_PROPERTY).toUpperCase())); + return factory.create( + Browser.valueOf(properties.getProperty(RUN_LOCALLY_PROPERTY) + .toUpperCase(Locale.ROOT))); } catch (Exception e) { System.err.println(e.getMessage()); System.err.println("Falling back to FireFox"); diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java index 7c4a5962f2..073670f75b 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; +import java.util.Locale; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; @@ -146,8 +147,8 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest { protected void assertColumnHeader(String expectedHeaderCaption, TestBenchElement testBenchElement) { - assertEquals(expectedHeaderCaption.toLowerCase(), - testBenchElement.getText().toLowerCase()); + assertEquals(expectedHeaderCaption.toLowerCase(Locale.ROOT), + testBenchElement.getText().toLowerCase(Locale.ROOT)); } protected GridCellElement getDefaultColumnHeader(int index) { @@ -244,7 +245,7 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest { List<WebElement> elements = sidebar .findElements(By.className("column-hiding-toggle")); for (WebElement e : elements) { - if ((e.getText().toLowerCase()) + if ((e.getText().toLowerCase(Locale.ROOT)) .startsWith("column " + columnIndex)) { return e; } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnHidingTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnHidingTest.java index 6531acb993..c81c024453 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnHidingTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridColumnHidingTest.java @@ -22,8 +22,8 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.util.List; +import java.util.Locale; -import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -827,20 +827,17 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest { selectMenuPath("Component", "Row details", "Toggle details for...", "Row 1"); assertColumnHeaderOrder(0, 1, 2, 3, 4); - assertNotNull("Details not found", - getGridElement().getDetails(1)); + assertNotNull("Details not found", getGridElement().getDetails(1)); toggleHideColumnAPI(0); assertColumnHeaderOrder(1, 2, 3, 4); - assertNotNull("Details not found", - getGridElement().getDetails(1)); + assertNotNull("Details not found", getGridElement().getDetails(1)); toggleHideColumnAPI(0); assertColumnHeaderOrder(0, 1, 2, 3, 4); - assertNotNull("Details not found", - getGridElement().getDetails(1)); + assertNotNull("Details not found", getGridElement().getDetails(1)); } @Test @@ -884,17 +881,13 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest { toggleHideColumnAPI(1); getGridElement().scrollToRow(500); - assertEquals("(500, 0)", - getGridElement().getCell(500, 0).getText()); - assertEquals("(500, 2)", - getGridElement().getCell(500, 1).getText()); + assertEquals("(500, 0)", getGridElement().getCell(500, 0).getText()); + assertEquals("(500, 2)", getGridElement().getCell(500, 1).getText()); toggleHideColumnAPI(1); - assertEquals("(500, 0)", - getGridElement().getCell(500, 0).getText()); - assertEquals("(500, 1)", - getGridElement().getCell(500, 1).getText()); + assertEquals("(500, 0)", getGridElement().getCell(500, 0).getText()); + assertEquals("(500, 1)", getGridElement().getCell(500, 1).getText()); } @Test @@ -902,26 +895,20 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest { toggleHidableColumnAPI(0); toggleHidableColumnAPI(1); - assertEquals("(500, 0)", - getGridElement().getCell(500, 0).getText()); - assertEquals("(500, 1)", - getGridElement().getCell(500, 1).getText()); + assertEquals("(500, 0)", getGridElement().getCell(500, 0).getText()); + assertEquals("(500, 1)", getGridElement().getCell(500, 1).getText()); toggleHideColumnAPI(0); toggleHideColumnAPI(1); - assertEquals("(500, 2)", - getGridElement().getCell(500, 0).getText()); - assertEquals("(500, 3)", - getGridElement().getCell(500, 1).getText()); + assertEquals("(500, 2)", getGridElement().getCell(500, 0).getText()); + assertEquals("(500, 3)", getGridElement().getCell(500, 1).getText()); toggleHideColumnAPI(0); toggleHideColumnAPI(1); - assertEquals("(500, 0)", - getGridElement().getCell(500, 0).getText()); - assertEquals("(500, 1)", - getGridElement().getCell(500, 1).getText()); + assertEquals("(500, 0)", getGridElement().getCell(500, 0).getText()); + assertEquals("(500, 1)", getGridElement().getCell(500, 1).getText()); } private void loadSpannedCellsFixture() { @@ -987,7 +974,8 @@ public class GridColumnHidingTest extends GridBasicClientFeaturesTest { private void verifyHeaderCellContent(int row, int column, String content) { GridCellElement headerCell = getGridElement().getHeaderCell(row, column); - assertEquals(content.toLowerCase(), headerCell.getText().toLowerCase()); + assertEquals(content.toLowerCase(Locale.ROOT), + headerCell.getText().toLowerCase(Locale.ROOT)); assertTrue(headerCell.isDisplayed()); } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridFooterTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridFooterTest.java index 906f1fedba..cea86af619 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridFooterTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridFooterTest.java @@ -19,6 +19,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; +import java.util.Locale; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -160,7 +162,8 @@ public class GridFooterTest extends GridStaticSectionTest { * Reindeer has a CSS text transformation that changes the casing so * that we can't rely on it being what we set */ - assertEquals("footer (0,0)", textCell.getText().toLowerCase()); + assertEquals("footer (0,0)", + textCell.getText().toLowerCase(Locale.ROOT)); GridCellElement widgetCell = getGridElement().getFooterCell(0, 1); assertTrue(widgetCell.isElementPresent(By.className("gwt-HTML"))); @@ -193,7 +196,8 @@ public class GridFooterTest extends GridStaticSectionTest { * Reindeer has a CSS text transformation that changes the casing so * that we can't rely on it being what we set */ - assertEquals("text footer", textCell.getText().toLowerCase()); + assertEquals("text footer", + textCell.getText().toLowerCase(Locale.ROOT)); } @Test @@ -207,11 +211,11 @@ public class GridFooterTest extends GridStaticSectionTest { GridCellElement widgetCell = getGridElement().getFooterCell(0, 0); WebElement button = widgetCell.findElement(By.className("gwt-Button")); - assertNotEquals("clicked", button.getText().toLowerCase()); + assertNotEquals("clicked", button.getText().toLowerCase(Locale.ROOT)); new Actions(getDriver()).moveToElement(button, 5, 5).click().perform(); - assertEquals("clicked", button.getText().toLowerCase()); + assertEquals("clicked", button.getText().toLowerCase(Locale.ROOT)); } private void assertFooterCount(int count) { diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridHeaderTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridHeaderTest.java index 0f4a10a1af..7ece0ed729 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridHeaderTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridHeaderTest.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import java.util.Arrays; +import java.util.Locale; import org.junit.Test; import org.openqa.selenium.By; @@ -204,7 +205,8 @@ public class GridHeaderTest extends GridStaticSectionTest { * Reindeer has a CSS text transformation that changes the casing so * that we can't rely on it being what we set */ - assertEquals("header (0,0)", textCell.getText().toLowerCase()); + assertEquals("header (0,0)", + textCell.getText().toLowerCase(Locale.ROOT)); GridCellElement widgetCell = getGridElement().getHeaderCell(0, 1); assertTrue(widgetCell.isElementPresent(By.className("gwt-HTML"))); @@ -235,7 +237,8 @@ public class GridHeaderTest extends GridStaticSectionTest { * Reindeer has a CSS text transformation that changes the casing so * that we can't rely on it being what we set */ - assertEquals("text header", textCell.getText().toLowerCase()); + assertEquals("text header", + textCell.getText().toLowerCase(Locale.ROOT)); } @Test @@ -249,7 +252,7 @@ public class GridHeaderTest extends GridStaticSectionTest { new Actions(getDriver()).moveToElement(button, 5, 5).click().perform(); - assertEquals("clicked", button.getText().toLowerCase()); + assertEquals("clicked", button.getText().toLowerCase(Locale.ROOT)); } @Test @@ -264,11 +267,11 @@ public class GridHeaderTest extends GridStaticSectionTest { GridCellElement widgetCell = getGridElement().getHeaderCell(0, 0); WebElement button = widgetCell.findElement(By.className("gwt-Button")); - assertNotEquals("clicked", button.getText().toLowerCase()); + assertNotEquals("clicked", button.getText().toLowerCase(Locale.ROOT)); new Actions(getDriver()).moveToElement(button, 5, 5).click().perform(); - assertEquals("clicked", button.getText().toLowerCase()); + assertEquals("clicked", button.getText().toLowerCase(Locale.ROOT)); } private void assertHeaderCount(int count) { diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridStaticSectionTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridStaticSectionTest.java index 835e9d576c..6b9aa813de 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridStaticSectionTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/client/GridStaticSectionTest.java @@ -17,6 +17,8 @@ package com.vaadin.v7.tests.components.grid.basicfeatures.client; import static org.junit.Assert.assertEquals; +import java.util.Locale; + import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -88,8 +90,8 @@ public abstract class GridStaticSectionTest // IE 8 returns tags as upper case while other browsers do not, make the // comparison non-casesensive - html = html.toLowerCase(); - text = text.toLowerCase(); + html = html.toLowerCase(Locale.ROOT); + text = text.toLowerCase(Locale.ROOT); // IE 8 returns attributes without quotes, make the comparison without // quotes diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java index c27afc4fd0..d3f3f74f38 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridColumnVisibilityTest.java @@ -21,7 +21,8 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import org.junit.Assert; +import java.util.Locale; + import org.junit.Before; import org.junit.Test; @@ -32,10 +33,10 @@ import com.vaadin.v7.tests.components.grid.basicfeatures.GridBasicFeaturesTest; @TestCategory("grid") public class GridColumnVisibilityTest extends GridBasicFeaturesTest { - private static final String[] TOGGLE_LISTENER = { "Component", - "State", "ColumnVisibilityChangeListener" }; - private static final String[] TOGGLE_HIDE_COLUMN_0 = { - "Component", "Columns", "Column 0", "Hidden" }; + private static final String[] TOGGLE_LISTENER = { "Component", "State", + "ColumnVisibilityChangeListener" }; + private static final String[] TOGGLE_HIDE_COLUMN_0 = { "Component", + "Columns", "Column 0", "Hidden" }; private static final String COLUMN_0_BECAME_HIDDEN_MSG = "Visibility " + "changed: propertyId: Column 0, isHidden: true"; @@ -51,20 +52,20 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest { @Test public void columnIsNotShownWhenHidden() { - assertEquals("column 0", - getGridElement().getHeaderCell(0, 0).getText().toLowerCase()); + assertEquals("column 0", getGridElement().getHeaderCell(0, 0).getText() + .toLowerCase(Locale.ROOT)); selectMenuPath(TOGGLE_HIDE_COLUMN_0); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 0).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 0).getText() + .toLowerCase(Locale.ROOT)); } @Test public void columnIsShownWhenUnhidden() { selectMenuPath(TOGGLE_HIDE_COLUMN_0); selectMenuPath(TOGGLE_HIDE_COLUMN_0); - assertEquals("column 0", - getGridElement().getHeaderCell(0, 0).getText().toLowerCase()); + assertEquals("column 0", getGridElement().getHeaderCell(0, 0).getText() + .toLowerCase(Locale.ROOT)); } @Test @@ -170,15 +171,15 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest { public void testColumnHidingToggleCaption_settingToggleCaption_updatesToggle() { toggleColumnHidable(1); getSidebarOpenButton().click(); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); assertEquals("Column 1", getColumnHidingToggle(1).getText()); toggleColumnHidingToggleCaptionChange(1); getSidebarOpenButton().click(); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); assertEquals("Column 1 caption 0", getColumnHidingToggle(1).getText()); toggleColumnHidingToggleCaptionChange(1); @@ -190,8 +191,8 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest { public void testColumnHidingToggleCaption_settingWidgetToHeader_toggleCaptionStays() { toggleColumnHidable(1); getSidebarOpenButton().click(); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); assertEquals("Column 1", getColumnHidingToggle(1).getText()); selectMenuPath("Component", "Columns", "Column 1", "Header Type", @@ -209,8 +210,8 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest { "Change header caption"); getSidebarOpenButton().click(); - assertEquals("column 1 header 0", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1 header 0", getGridElement().getHeaderCell(0, 1) + .getText().toLowerCase(Locale.ROOT)); assertEquals("Column 1 header 0", getColumnHidingToggle(1).getText()); } @@ -224,8 +225,8 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest { "Change header caption"); getSidebarOpenButton().click(); - assertEquals("column 1 header 0", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + assertEquals("column 1 header 0", getGridElement().getHeaderCell(0, 1) + .getText().toLowerCase(Locale.ROOT)); assertEquals("Column 1 caption 0", getColumnHidingToggle(1).getText()); } @@ -322,8 +323,7 @@ public class GridColumnVisibilityTest extends GridBasicFeaturesTest { getColumnHidingToggle(3).click(); // Make sure that the new column contains the data it should - assertEquals("(999, 3)", - getGridElement().getCell(999, 3).getText()); + assertEquals("(999, 3)", getGridElement().getCell(999, 3).getText()); } private void verifyColumnFrozen(int index) { diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStaticSectionComponentTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStaticSectionComponentTest.java index ed0b4a7186..10f9173300 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStaticSectionComponentTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStaticSectionComponentTest.java @@ -18,6 +18,8 @@ package com.vaadin.v7.tests.components.grid.basicfeatures.server; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import java.util.Locale; + import org.junit.Test; import com.vaadin.testbench.elements.ButtonElement; @@ -64,8 +66,8 @@ public class GridStaticSectionComponentTest extends GridBasicFeaturesTest { assertTrue("No notifications should've been shown", !$(NotificationElement.class).exists()); assertEquals("Header should've been reverted back to text header", - "text header", - getGridElement().getHeaderCell(0, 1).getText().toLowerCase()); + "text header", getGridElement().getHeaderCell(0, 1).getText() + .toLowerCase(Locale.ROOT)); } } diff --git a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStructureTest.java b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStructureTest.java index 53a229a4c0..1d139b67a9 100644 --- a/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStructureTest.java +++ b/uitest/src/test/java/com/vaadin/v7/tests/components/grid/basicfeatures/server/GridStructureTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.List; +import java.util.Locale; import org.junit.Test; import org.openqa.selenium.NoSuchElementException; @@ -58,11 +59,11 @@ public class GridStructureTest extends GridBasicFeaturesTest { setDebug(true); openTestURL(); - assertEquals("column 0", - getGridElement().getHeaderCell(0, 0).getText().toLowerCase()); + assertEquals("column 0", getGridElement().getHeaderCell(0, 0).getText() + .toLowerCase(Locale.ROOT)); selectMenuPath("Component", "Columns", "Column 0", "Add / Remove"); - assertEquals("column 1", - getGridElement().getHeaderCell(0, 0).getText().toLowerCase()); + assertEquals("column 1", getGridElement().getHeaderCell(0, 0).getText() + .toLowerCase(Locale.ROOT)); selectMenuPath("Component", "Columns", "Column 0", "Add / Remove"); // Column 0 is now the last column in Grid. @@ -76,14 +77,16 @@ public class GridStructureTest extends GridBasicFeaturesTest { // Column 0 should be visible List<TestBenchElement> cells = getGridHeaderRowCells(); - assertEquals("column 0", cells.get(0).getText().toLowerCase()); + assertEquals("column 0", + cells.get(0).getText().toLowerCase(Locale.ROOT)); // Hide column 0 selectMenuPath("Component", "Columns", "Column 0", "Add / Remove"); // Column 1 should now be the first cell cells = getGridHeaderRowCells(); - assertEquals("column 1", cells.get(0).getText().toLowerCase()); + assertEquals("column 1", + cells.get(0).getText().toLowerCase(Locale.ROOT)); } @Test |