diff options
author | Ilia Motornyi <elmot@vaadin.com> | 2018-04-19 15:14:53 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-04-19 15:14:53 +0300 |
commit | d543e47becc77e5b18c69a416e6e84122ac10fe1 (patch) | |
tree | 49b4e4e245319b0e93a4b1d3739096eb2d082eea /server/src/test | |
parent | bdbb0b4328a36a66bb492973ca72497bfd34f6ad (diff) | |
download | vaadin-framework-d543e47becc77e5b18c69a416e6e84122ac10fe1.tar.gz vaadin-framework-d543e47becc77e5b18c69a416e6e84122ac10fe1.zip |
Enable Maven plugin for Eclipse formatting (#10829)
Diffstat (limited to 'server/src/test')
36 files changed, 176 insertions, 144 deletions
diff --git a/server/src/test/java/com/vaadin/data/BeanBinderTest.java b/server/src/test/java/com/vaadin/data/BeanBinderTest.java index e6740f35ba..bdcfb16d7b 100644 --- a/server/src/test/java/com/vaadin/data/BeanBinderTest.java +++ b/server/src/test/java/com/vaadin/data/BeanBinderTest.java @@ -322,17 +322,21 @@ public class BeanBinderTest binder.bind(nameField, "readOnlyProperty"); binder.setReadOnly(true); - assertTrue("Name field should be ignored and be readonly", nameField.isReadOnly()); + assertTrue("Name field should be ignored and be readonly", + nameField.isReadOnly()); binder.setReadOnly(false); - assertTrue("Name field should be ignored and be readonly", nameField.isReadOnly()); + assertTrue("Name field should be ignored and be readonly", + nameField.isReadOnly()); nameField.setReadOnly(false); binder.setReadOnly(true); - assertFalse("Name field should be ignored and not be readonly", nameField.isReadOnly()); + assertFalse("Name field should be ignored and not be readonly", + nameField.isReadOnly()); binder.setReadOnly(false); - assertFalse("Name field should be ignored and not be readonly", nameField.isReadOnly()); + assertFalse("Name field should be ignored and not be readonly", + nameField.isReadOnly()); } @Test diff --git a/server/src/test/java/com/vaadin/data/BeanPropertySetTest.java b/server/src/test/java/com/vaadin/data/BeanPropertySetTest.java index 60c2f5a905..583afc2dd6 100644 --- a/server/src/test/java/com/vaadin/data/BeanPropertySetTest.java +++ b/server/src/test/java/com/vaadin/data/BeanPropertySetTest.java @@ -36,10 +36,12 @@ public class BeanPropertySetTest { PropertySet<Person> deserializedPropertySet = ClassesSerializableTest .serializeAndDeserialize(originalPropertySet); - comparePropertySet(originalPropertySet, deserializedPropertySet, "Deserialized instance should be the same as the original"); + comparePropertySet(originalPropertySet, deserializedPropertySet, + "Deserialized instance should be the same as the original"); } - private void comparePropertySet(PropertySet<?> propertySetA, PropertySet<?> propertySetB, String message) { + private void comparePropertySet(PropertySet<?> propertySetA, + PropertySet<?> propertySetB, String message) { PropertyDefinition<?, ?>[] propertiesA = propertySetA.getProperties() .sorted(Comparator.comparing(PropertyDefinition::getName)) @@ -50,8 +52,7 @@ public class BeanPropertySetTest { assertEquals(message, propertiesA.length, propertiesB.length); for (int i = 0; i < propertiesB.length; i++) { - assertSame(message, - propertiesA[i], propertiesB[i]); + assertSame(message, propertiesA[i], propertiesB[i]); } } @@ -79,7 +80,9 @@ public class BeanPropertySetTest { PropertySet<Person> deserializedPropertySet = (PropertySet<Person>) in .readObject(); - comparePropertySet(BeanPropertySet.get(Person.class), deserializedPropertySet, "Deserialized instance should be the same as in the cache"); + comparePropertySet(BeanPropertySet.get(Person.class), + deserializedPropertySet, + "Deserialized instance should be the same as in the cache"); assertNotSame( "Deserialized instance should not be the same as the original", originalPropertySet, deserializedPropertySet); @@ -112,9 +115,10 @@ public class BeanPropertySetTest { throws Exception { PropertyDefinition<com.vaadin.tests.data.bean.Person, ?> definition = BeanPropertySet - .get(com.vaadin.tests.data.bean.Person.class,true, getDefaultFilter()) - .getProperty("address.postalCode").orElseThrow(AssertionFailedError::new); - + .get(com.vaadin.tests.data.bean.Person.class, true, + getDefaultFilter()) + .getProperty("address.postalCode") + .orElseThrow(AssertionFailedError::new); PropertyDefinition<com.vaadin.tests.data.bean.Person, ?> deserializedDefinition = ClassesSerializableTest .serializeAndDeserialize(definition); diff --git a/server/src/test/java/com/vaadin/data/BinderTest.java b/server/src/test/java/com/vaadin/data/BinderTest.java index 5ca469011c..f4515dc211 100644 --- a/server/src/test/java/com/vaadin/data/BinderTest.java +++ b/server/src/test/java/com/vaadin/data/BinderTest.java @@ -530,7 +530,8 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> { textField.setValue(" "); ErrorMessage errorMessage = textField.getErrorMessage(); assertNotNull(errorMessage); - assertEquals("Input is required.", errorMessage.getFormattedHtmlMessage()); + assertEquals("Input is required.", + errorMessage.getFormattedHtmlMessage()); // validation is done for all changed bindings once. assertEquals(1, invokes.get()); @@ -547,7 +548,8 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> { Converter<String, String> stringBasicPreProcessingConverter = new Converter<String, String>() { @Override - public Result<String> convertToModel(String value, ValueContext context) { + public Result<String> convertToModel(String value, + ValueContext context) { if (StringUtils.isBlank(value)) { return Result.ok(null); } @@ -555,7 +557,8 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> { } @Override - public String convertToPresentation(String value, ValueContext context) { + public String convertToPresentation(String value, + ValueContext context) { if (value == null) { return ""; } @@ -584,7 +587,8 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> { textField.setValue(" "); ErrorMessage errorMessage = textField.getErrorMessage(); assertNotNull(errorMessage); - assertEquals("Input required.", errorMessage.getFormattedHtmlMessage()); + assertEquals("Input required.", + errorMessage.getFormattedHtmlMessage()); // validation is done for all changed bindings once. assertEquals(1, invokes.get()); diff --git a/server/src/test/java/com/vaadin/data/BinderTestBase.java b/server/src/test/java/com/vaadin/data/BinderTestBase.java index 2cb560562b..ca3e2d0779 100644 --- a/server/src/test/java/com/vaadin/data/BinderTestBase.java +++ b/server/src/test/java/com/vaadin/data/BinderTestBase.java @@ -17,7 +17,8 @@ import com.vaadin.ui.TextField; * * @since 8.0 */ -public abstract class BinderTestBase<BINDER extends Binder<ITEM>, ITEM> implements Serializable { +public abstract class BinderTestBase<BINDER extends Binder<ITEM>, ITEM> + implements Serializable { protected static final String NEGATIVE_ERROR_MESSAGE = "Value must be non-negative"; @@ -35,13 +36,13 @@ public abstract class BinderTestBase<BINDER extends Binder<ITEM>, ITEM> implemen protected Validator<String> notEmpty = Validator.from(val -> !val.isEmpty(), EMPTY_ERROR_MESSAGE); protected Converter<String, Integer> stringToInteger = Converter.from( - Integer::valueOf, String::valueOf, - e -> NOT_NUMBER_ERROR_MESSAGE); + Integer::valueOf, String::valueOf, e -> NOT_NUMBER_ERROR_MESSAGE); protected Validator<Integer> notNegative = Validator.from(x -> x >= 0, NEGATIVE_ERROR_MESSAGE); public static void testSerialization(Object toSerialize) { - try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(new ByteArrayOutputStream())) { + try (ObjectOutputStream objectOutputStream = new ObjectOutputStream( + new ByteArrayOutputStream())) { objectOutputStream.writeObject(toSerialize); } catch (Exception e) { throw new RuntimeException(e); diff --git a/server/src/test/java/com/vaadin/data/HasItemsTest.java b/server/src/test/java/com/vaadin/data/HasItemsTest.java index 6bbdb46f4b..8522bcee72 100644 --- a/server/src/test/java/com/vaadin/data/HasItemsTest.java +++ b/server/src/test/java/com/vaadin/data/HasItemsTest.java @@ -45,16 +45,14 @@ public class HasItemsTest { DataProvider dataProvider = hasItems.getDataProvider(); - Assert.assertTrue( - hasItemsType.getSimpleName() - + " setItems method with varargs parameters of does not create a list data provider", + Assert.assertTrue(hasItemsType.getSimpleName() + + " setItems method with varargs parameters of does not create a list data provider", dataProvider instanceof ListDataProvider); ListDataProvider listDataProvider = (ListDataProvider) dataProvider; - Assert.assertTrue( - hasItemsType.getSimpleName() - + " does not have setItems method with varargs parameters of does not create an ArrayList backed list data provider", + Assert.assertTrue(hasItemsType.getSimpleName() + + " does not have setItems method with varargs parameters of does not create an ArrayList backed list data provider", listDataProvider.getItems() instanceof ArrayList); List list = (List) listDataProvider.getItems(); diff --git a/server/src/test/java/com/vaadin/data/NestedPropertyNameTest.java b/server/src/test/java/com/vaadin/data/NestedPropertyNameTest.java index 070a3de40a..24e0cae331 100644 --- a/server/src/test/java/com/vaadin/data/NestedPropertyNameTest.java +++ b/server/src/test/java/com/vaadin/data/NestedPropertyNameTest.java @@ -5,36 +5,36 @@ import org.junit.Test; import com.vaadin.ui.Grid; public class NestedPropertyNameTest { - + @Test public void nestedProperty_sameNameCanBeAdded() { Grid<Person> grid = new Grid<>(Person.class); grid.addColumn("street.name"); } - private class Person{ + private class Person { String name; Street street; - + public String getName() { return name; } - + public void setName(String name) { this.name = name; } - + public Street getStreet() { return street; } - + public void setStreet(Street street) { this.street = street; } - + } - - private class Street{ + + private class Street { String name; public String getName() { diff --git a/server/src/test/java/com/vaadin/data/PropertyRetrospectionTest.java b/server/src/test/java/com/vaadin/data/PropertyRetrospectionTest.java index 3b3a611345..01ccdedae7 100644 --- a/server/src/test/java/com/vaadin/data/PropertyRetrospectionTest.java +++ b/server/src/test/java/com/vaadin/data/PropertyRetrospectionTest.java @@ -67,35 +67,40 @@ public class PropertyRetrospectionTest { } @Test - public void testGridBeanProperties() - { + public void testGridBeanProperties() { Grid<BeanOne> grid1 = new Grid<>(BeanOne.class); - assertEquals(2,BeanPropertySet.get(BeanOne.class).getProperties().count()); - assertEquals(2,grid1.getColumns().size()); + assertEquals(2, + BeanPropertySet.get(BeanOne.class).getProperties().count()); + assertEquals(2, grid1.getColumns().size()); grid1.addColumn("innerBean.innerString"); - assertEquals(3,grid1.getColumns().size()); - assertEquals(2,BeanPropertySet.get(BeanOne.class).getProperties().count()); - + assertEquals(3, grid1.getColumns().size()); + assertEquals(2, + BeanPropertySet.get(BeanOne.class).getProperties().count()); Grid<BeanOne> grid2 = new Grid<>(BeanOne.class); - assertEquals(2,BeanPropertySet.get(BeanOne.class).getProperties().count()); - assertEquals(2,grid2.getColumns().size()); + assertEquals(2, + BeanPropertySet.get(BeanOne.class).getProperties().count()); + assertEquals(2, grid2.getColumns().size()); grid2.addColumn("innerBean.innerString"); - assertEquals(3,grid2.getColumns().size()); - assertEquals(2,BeanPropertySet.get(BeanOne.class).getProperties().count()); + assertEquals(3, grid2.getColumns().size()); + assertEquals(2, + BeanPropertySet.get(BeanOne.class).getProperties().count()); } @Test - public void testBinder() - { + public void testBinder() { Binder<BeanTwo> binder1 = new Binder<>(BeanTwo.class); - assertEquals(2,BeanPropertySet.get(BeanTwo.class).getProperties().count()); + assertEquals(2, + BeanPropertySet.get(BeanTwo.class).getProperties().count()); binder1.forField(new TextField()).bind("innerBean.innerString"); - assertEquals(2,BeanPropertySet.get(BeanTwo.class).getProperties().count()); + assertEquals(2, + BeanPropertySet.get(BeanTwo.class).getProperties().count()); Binder<BeanTwo> binder2 = new Binder<>(BeanTwo.class); - assertEquals(2,BeanPropertySet.get(BeanTwo.class).getProperties().count()); + assertEquals(2, + BeanPropertySet.get(BeanTwo.class).getProperties().count()); binder2.forField(new TextField()).bind("innerBean.innerString"); - assertEquals(2,BeanPropertySet.get(BeanTwo.class).getProperties().count()); + assertEquals(2, + BeanPropertySet.get(BeanTwo.class).getProperties().count()); } } diff --git a/server/src/test/java/com/vaadin/data/ReadOnlyHasValueTest.java b/server/src/test/java/com/vaadin/data/ReadOnlyHasValueTest.java index 38338e8a22..6ed172a56a 100644 --- a/server/src/test/java/com/vaadin/data/ReadOnlyHasValueTest.java +++ b/server/src/test/java/com/vaadin/data/ReadOnlyHasValueTest.java @@ -83,12 +83,11 @@ public class ReadOnlyHasValueTest { public void testEmptyValue() { Binder<Bean> beanBinder = new Binder<>(Bean.class); Label label = new Label(); - ReadOnlyHasValue<String> strHasValue = - new ReadOnlyHasValue<>(label::setValue, NO_VALUE); + ReadOnlyHasValue<String> strHasValue = new ReadOnlyHasValue<>( + label::setValue, NO_VALUE); beanBinder.forField(strHasValue) - .withConverter(Long::parseLong,(Long i)->"" + i) - .bind("v"); + .withConverter(Long::parseLong, (Long i) -> "" + i).bind("v"); beanBinder.readBean(new Bean(42)); assertEquals("42", label.getValue()); diff --git a/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchicalCommunicatorTest.java b/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchicalCommunicatorTest.java index 9c1c47215c..3475be5520 100644 --- a/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchicalCommunicatorTest.java +++ b/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchicalCommunicatorTest.java @@ -69,7 +69,7 @@ public class HierarchicalCommunicatorTest { communicator.pushData(1, Arrays.asList(ROOT, FOLDER, LEAF)); communicator.expand(ROOT); communicator.expand(FOLDER); - //Put the item into client queue + // Put the item into client queue communicator.refresh(item); treeData.removeItem(item); if (refreshAll) { @@ -83,20 +83,22 @@ public class HierarchicalCommunicatorTest { @Test public void testReplaceAll() { communicator.pushData(1, Arrays.asList(ROOT, FOLDER, LEAF)); - //Some modifications + // Some modifications communicator.expand(ROOT); communicator.expand(FOLDER); communicator.refresh(LEAF); - //Replace dataprovider - communicator.setDataProvider(new TreeDataProvider<>(new TreeData<>()), null); + // Replace dataprovider + communicator.setDataProvider(new TreeDataProvider<>(new TreeData<>()), + null); dataProvider.refreshAll(); communicator.beforeClientResponse(false); assertFalse("Stalled object in KeyMapper", communicator.getKeyMapper().has(ROOT)); - assertEquals(-1,communicator.getParentIndex(FOLDER).longValue()); + assertEquals(-1, communicator.getParentIndex(FOLDER).longValue()); } - private static class TestHierarchicalDataCommunicator<T> extends HierarchicalDataCommunicator<T> { + private static class TestHierarchicalDataCommunicator<T> + extends HierarchicalDataCommunicator<T> { @Override public void extend(AbstractClientConnector target) { super.extend(target); diff --git a/server/src/test/java/com/vaadin/server/communication/HugeFileUploadTest.java b/server/src/test/java/com/vaadin/server/communication/HugeFileUploadTest.java index 50e779c804..eb13ccf32a 100644 --- a/server/src/test/java/com/vaadin/server/communication/HugeFileUploadTest.java +++ b/server/src/test/java/com/vaadin/server/communication/HugeFileUploadTest.java @@ -40,12 +40,15 @@ public class HugeFileUploadTest { public void setup() throws IOException { MockitoAnnotations.initMocks(this); // 0= UIid, 1 = cid, 2= name, 3 = sec key - when(request.getPathInfo()).thenReturn("/" + UPLOAD_URL_PREFIX + UI_ID + "/" + CONN_ID + "/var/" + SEC_KEY); - when(request.getContentType()).thenReturn("application/multipart-attached;boundary=bbbbb"); + when(request.getPathInfo()).thenReturn("/" + UPLOAD_URL_PREFIX + UI_ID + + "/" + CONN_ID + "/var/" + SEC_KEY); + when(request.getContentType()) + .thenReturn("application/multipart-attached;boundary=bbbbb"); when(session.hasLock()).thenReturn(true); when(session.getUIById(UI_ID)).thenReturn(ui); when(ui.getConnectorTracker()).thenReturn(connectorTracker); - when(connectorTracker.getStreamVariable(CONN_ID,"var")).thenReturn(streamVariable); + when(connectorTracker.getStreamVariable(CONN_ID, "var")) + .thenReturn(streamVariable); when(connectorTracker.getSeckey(streamVariable)).thenReturn(SEC_KEY); when(request.getInputStream()).thenReturn(new InputStream() { @Override diff --git a/server/src/test/java/com/vaadin/tests/CompileTransitionPropertyTest.java b/server/src/test/java/com/vaadin/tests/CompileTransitionPropertyTest.java index 685baae509..0f84855c89 100644 --- a/server/src/test/java/com/vaadin/tests/CompileTransitionPropertyTest.java +++ b/server/src/test/java/com/vaadin/tests/CompileTransitionPropertyTest.java @@ -21,8 +21,7 @@ public class CompileTransitionPropertyTest { if (file.contains("%20")) { fail("path contains spaces, please move the project"); } - ScssStylesheet ss = ScssStylesheet - .get(file); + ScssStylesheet ss = ScssStylesheet.get(file); ss.compile(); // extract the style rules for .my-label String compiled = ss.printState(); @@ -56,4 +55,4 @@ public class CompileTransitionPropertyTest { assertTrue("Unexpected style rules for .my-label: " + modifiedStyle, modifiedStyle.isEmpty()); } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/components/TreeTest.java b/server/src/test/java/com/vaadin/tests/components/TreeTest.java index d48109e669..517ee6a56b 100644 --- a/server/src/test/java/com/vaadin/tests/components/TreeTest.java +++ b/server/src/test/java/com/vaadin/tests/components/TreeTest.java @@ -88,9 +88,9 @@ public class TreeTest { tree.setDescription(TEST_DESCRIPTION); tree.setIcon(new ThemeResource(TEST_RESOURCE_ID)); - assertEquals(TEST_CAPTION,tree.getCaption()); - assertEquals(TEST_DESCRIPTION,tree.getDescription()); - assertEquals(TEST_RESOURCE_ID,tree.getIcon().toString()); + assertEquals(TEST_CAPTION, tree.getCaption()); + assertEquals(TEST_DESCRIPTION, tree.getDescription()); + assertEquals(TEST_RESOURCE_ID, tree.getIcon().toString()); assertFalse(tree.isCaptionAsHtml()); tree.setCaptionAsHtml(true); diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSortTest.java b/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSortTest.java index ddf4844490..392a20afa2 100644 --- a/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSortTest.java +++ b/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSortTest.java @@ -26,9 +26,11 @@ public class GridNullValueSortTest { VaadinSession.setCurrent(null); this.grid = new Grid<TestClass>(); this.stringColumn = this.grid.addColumn(bean -> bean.stringField); - this.nonComparableColumn = this.grid.addColumn(bean -> bean.nonComparableField); + this.nonComparableColumn = this.grid + .addColumn(bean -> bean.nonComparableField); - this.grid.setItems(new TestClass(null, new Object()), new TestClass("something", null)); + this.grid.setItems(new TestClass(null, new Object()), + new TestClass("something", null)); new MockUI().setContent(grid); } diff --git a/server/src/test/java/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java index 9167257bd1..4c974a59c8 100644 --- a/server/src/test/java/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java @@ -63,13 +63,15 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase<MenuBar> { + "<menu descriptioncontentmode=\"TEXT\" description=\"Just plain text\">plain text</menu>" + "</vaadin-menu-bar>"; MenuBar menuBar = new MenuBar(); - menuBar.addItem("One", null).setDescription("This description is implicitly preformatted"); - menuBar.addItem("preformatted", null) - .setDescription("This description\nis explicitly\n\npreformatted", ContentMode.PREFORMATTED); - menuBar.addItem("HTML", null) - .setDescription("<b>I</b> contain <br/> <e>html</e>", ContentMode.HTML); - menuBar.addItem("plain text", null) - .setDescription("Just plain text", ContentMode.TEXT); + menuBar.addItem("One", null) + .setDescription("This description is implicitly preformatted"); + menuBar.addItem("preformatted", null).setDescription( + "This description\nis explicitly\n\npreformatted", + ContentMode.PREFORMATTED); + menuBar.addItem("HTML", null).setDescription( + "<b>I</b> contain <br/> <e>html</e>", ContentMode.HTML); + menuBar.addItem("plain text", null).setDescription("Just plain text", + ContentMode.TEXT); testWrite(design, menuBar); testRead(design, menuBar); @@ -177,7 +179,8 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase<MenuBar> { actual.getDescription()); assertEquals(baseError + "Style Name", expected.getStyleName(), actual.getStyleName()); - assertEquals(baseError + "Content Mode", expected.getDescriptionContentMode(), + assertEquals(baseError + "Content Mode", + expected.getDescriptionContentMode(), actual.getDescriptionContentMode()); if (expected.getIcon() != null) { diff --git a/server/src/test/java/com/vaadin/tests/data/bean/BeanWithEnums.java b/server/src/test/java/com/vaadin/tests/data/bean/BeanWithEnums.java index 22c1af75ba..73b818a801 100644 --- a/server/src/test/java/com/vaadin/tests/data/bean/BeanWithEnums.java +++ b/server/src/test/java/com/vaadin/tests/data/bean/BeanWithEnums.java @@ -4,7 +4,7 @@ import java.io.Serializable; import java.util.HashSet; import java.util.Set; -public class BeanWithEnums implements Serializable{ +public class BeanWithEnums implements Serializable { private Set<TestEnum> enums = new HashSet<>(); public Set<TestEnum> getEnums() { diff --git a/server/src/test/java/com/vaadin/tests/design/LocaleTest.java b/server/src/test/java/com/vaadin/tests/design/LocaleTest.java index 9293e56983..ab04cbc727 100644 --- a/server/src/test/java/com/vaadin/tests/design/LocaleTest.java +++ b/server/src/test/java/com/vaadin/tests/design/LocaleTest.java @@ -77,19 +77,19 @@ public class LocaleTest { assertTrue( "The element should not have a locale specification, found locale " + eb1.attr("locale"), - eb1.attr("locale").isEmpty()); + eb1.attr("locale").isEmpty()); Element eb2 = ehLayout.child(1); assertEquals("Wrong locale information.", "en_US", eb2.attr("locale")); Element ehLayout2 = evLayout.child(1); assertTrue( "The element should not have a locale specification, found locale " + ehLayout2.attr("locale"), - ehLayout2.attr("locale").isEmpty()); + ehLayout2.attr("locale").isEmpty()); Element el1 = ehLayout2.child(0); assertTrue( "The element should not have a locale specification, found locale " + el1.attr("locale"), - el1.attr("locale").isEmpty()); + el1.attr("locale").isEmpty()); Element el2 = ehLayout2.child(1); assertEquals("Wrong locale information.", "en_CA", el2.attr("locale")); } @@ -163,4 +163,4 @@ public class LocaleTest { assertEquals("The component should have the same locale as its parent.", hLayout.getLocale(), b3.getLocale()); } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/design/UPPERCASE/InUpperCasePackage.java b/server/src/test/java/com/vaadin/tests/design/UPPERCASE/InUpperCasePackage.java index 255581d9f3..1708bd5f96 100644 --- a/server/src/test/java/com/vaadin/tests/design/UPPERCASE/InUpperCasePackage.java +++ b/server/src/test/java/com/vaadin/tests/design/UPPERCASE/InUpperCasePackage.java @@ -4,4 +4,4 @@ import com.vaadin.ui.VerticalLayout; public class InUpperCasePackage extends VerticalLayout { -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootForVerticalLayout.java b/server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootForVerticalLayout.java index 0394e7b70c..840fdf1488 100644 --- a/server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootForVerticalLayout.java +++ b/server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootForVerticalLayout.java @@ -7,7 +7,8 @@ import com.vaadin.ui.Label; import com.vaadin.ui.declarative.Design; @DesignRoot("DesignWithEmptyAnnotation.html") -public class CustomComponentDesignRootForVerticalLayout extends CustomComponent { +public class CustomComponentDesignRootForVerticalLayout + extends CustomComponent { public Button ok; public Button cancel; diff --git a/server/src/test/java/com/vaadin/tests/event/MarkAsDirtyListenerTest.java b/server/src/test/java/com/vaadin/tests/event/MarkAsDirtyListenerTest.java index 461ab74bcf..0ac04db157 100644 --- a/server/src/test/java/com/vaadin/tests/event/MarkAsDirtyListenerTest.java +++ b/server/src/test/java/com/vaadin/tests/event/MarkAsDirtyListenerTest.java @@ -29,8 +29,9 @@ public class MarkAsDirtyListenerTest { UI ui = new MockUI(); AtomicReference<MarkedAsDirtyConnectorEvent> events = new AtomicReference<>(); - ui.getConnectorTracker().addMarkedAsDirtyListener(event -> Assert - .assertTrue("No reference should have been registered", + ui.getConnectorTracker() + .addMarkedAsDirtyListener(event -> Assert.assertTrue( + "No reference should have been registered", events.compareAndSet(null, event))); // UI is marked dirty on creation and when adding a listener ComponentTest.syncToClient(ui); @@ -48,9 +49,12 @@ public class MarkAsDirtyListenerTest { @Test public void fire_event_for_setContent() { List<MarkedAsDirtyConnectorEvent> events = new ArrayList<>(); - UI ui = new MockUI() {{ - getConnectorTracker().addMarkedAsDirtyListener(event -> events.add(event)); - }}; + UI ui = new MockUI() { + { + getConnectorTracker() + .addMarkedAsDirtyListener(event -> events.add(event)); + } + }; ComponentTest.syncToClient(ui); Button button = new Button("Button"); @@ -72,8 +76,9 @@ public class MarkAsDirtyListenerTest { ComponentTest.syncToClient(button); AtomicReference<MarkedAsDirtyConnectorEvent> events = new AtomicReference<>(); - ui.getConnectorTracker().addMarkedAsDirtyListener(event -> Assert - .assertTrue("No reference should have been registered", + ui.getConnectorTracker() + .addMarkedAsDirtyListener(event -> Assert.assertTrue( + "No reference should have been registered", events.compareAndSet(null, event))); button.setIconAlternateText("alternate"); @@ -89,9 +94,12 @@ public class MarkAsDirtyListenerTest { @Test public void fire_events_for_each_component() { List<MarkedAsDirtyConnectorEvent> events = new ArrayList<>(); - UI ui = new MockUI() {{ - getConnectorTracker().addMarkedAsDirtyListener(event -> events.add(event)); - }}; + UI ui = new MockUI() { + { + getConnectorTracker() + .addMarkedAsDirtyListener(event -> events.add(event)); + } + }; HorizontalLayout layout = new HorizontalLayout(); // UI initially marked as dirty so should not show as event. @@ -126,8 +134,9 @@ public class MarkAsDirtyListenerTest { ComponentTest.syncToClient(button); AtomicReference<MarkedAsDirtyConnectorEvent> events = new AtomicReference<>(); - ui.getConnectorTracker().addMarkedAsDirtyListener(event -> Assert - .assertTrue("Only one event should have registered", + ui.getConnectorTracker() + .addMarkedAsDirtyListener(event -> Assert.assertTrue( + "Only one event should have registered", events.compareAndSet(null, event))); button.setIconAlternateText("alternate"); diff --git a/server/src/test/java/com/vaadin/tests/server/KeyMapperIdGetterTest.java b/server/src/test/java/com/vaadin/tests/server/KeyMapperIdGetterTest.java index de51b5cffc..3e64eaf963 100644 --- a/server/src/test/java/com/vaadin/tests/server/KeyMapperIdGetterTest.java +++ b/server/src/test/java/com/vaadin/tests/server/KeyMapperIdGetterTest.java @@ -3,13 +3,14 @@ package com.vaadin.tests.server; import com.vaadin.server.KeyMapper; /** - * The test checks the same functionality as {@link KeyMapperTest} does, but uses custom {@code identifierGetter} - * instead of default trivial one. {@code BrokenBean} intentionally has broken {@code hashCode} and {@code equals}, and the test should pass - * despite of that, because {@code BrokenBean.getId()} is used for bean identification. + * The test checks the same functionality as {@link KeyMapperTest} does, but + * uses custom {@code identifierGetter} instead of default trivial one. + * {@code BrokenBean} intentionally has broken {@code hashCode} and + * {@code equals}, and the test should pass despite of that, because + * {@code BrokenBean.getId()} is used for bean identification. */ public class KeyMapperIdGetterTest extends KeyMapperTest { - private static class BrokenBean { private final Object id = new Object(); diff --git a/server/src/test/java/com/vaadin/tests/server/SimpleMultiPartInputStreamTest.java b/server/src/test/java/com/vaadin/tests/server/SimpleMultiPartInputStreamTest.java index 06ae1570b2..ac37645cbf 100644 --- a/server/src/test/java/com/vaadin/tests/server/SimpleMultiPartInputStreamTest.java +++ b/server/src/test/java/com/vaadin/tests/server/SimpleMultiPartInputStreamTest.java @@ -22,8 +22,8 @@ public class SimpleMultiPartInputStreamTest { protected void checkBoundaryDetection(byte[] input, String boundary, byte[] expected) throws Exception { ByteArrayInputStream bais = new ByteArrayInputStream(input); - try (SimpleMultiPartInputStream smpis = new SimpleMultiPartInputStream(bais, - boundary)) { + try (SimpleMultiPartInputStream smpis = new SimpleMultiPartInputStream( + bais, boundary)) { ByteArrayOutputStream resultStream = new ByteArrayOutputStream(); int outbyte; try { @@ -33,7 +33,7 @@ public class SimpleMultiPartInputStreamTest { } catch (IOException e) { throw new IOException( e.getMessage() + "; expected " + new String(expected) - + " but got " + resultStream.toString()); + + " but got " + resultStream.toString()); } if (!Arrays.equals(expected, resultStream.toByteArray())) { throw new Exception("Mismatch: expected " + new String(expected) diff --git a/server/src/test/java/com/vaadin/tests/server/component/ReadEmptyDesignTest.java b/server/src/test/java/com/vaadin/tests/server/component/ReadEmptyDesignTest.java index 1156d72b71..2757fd6c3d 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/ReadEmptyDesignTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/ReadEmptyDesignTest.java @@ -67,4 +67,4 @@ public class ReadEmptyDesignTest { html.appendChild(doc.createElement("body")); return doc; } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractlisting/AbstractListingDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractlisting/AbstractListingDeclarativeTest.java index 5c04a493c5..9ebcad433d 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/abstractlisting/AbstractListingDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/abstractlisting/AbstractListingDeclarativeTest.java @@ -72,11 +72,11 @@ public abstract class AbstractListingDeclarativeTest<T extends AbstractListing> List<String> items = Arrays.asList("foo", "bar", "foobar", "barfoo"); - String design = String.format( - "<%s>\n" + "<option item='foo' icon='%s'>foo</option>\n" - + "<option item='bar' icon='%s'>bar</option>" - + "<option item='foobar' icon='theme://%s'>foobar</option>" - + "<option item='barfoo'>barfoo</option>" + "</%s>", + String design = String.format("<%s>\n" + + "<option item='foo' icon='%s'>foo</option>\n" + + "<option item='bar' icon='%s'>bar</option>" + + "<option item='foobar' icon='theme://%s'>foobar</option>" + + "<option item='barfoo'>barfoo</option>" + "</%s>", getComponentTag(), EXTERNAL_URL, FILE_PATH, THEME_PATH, getComponentTag()); diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractmultiselect/AbstractMultiSelectDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractmultiselect/AbstractMultiSelectDeclarativeTest.java index 0745ba0f5c..7291db35bb 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/abstractmultiselect/AbstractMultiSelectDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/abstractmultiselect/AbstractMultiSelectDeclarativeTest.java @@ -39,10 +39,10 @@ public abstract class AbstractMultiSelectDeclarativeTest<T extends AbstractMulti String type = "com.vaadin.SomeType"; String attribute = "data-type"; - String design = String.format( - "<%s %s='%s'>\n" + "<option item='foo' selected>foo1</option>\n" - + "<option item='bar'>bar1</option>" - + "<option item='foobar' selected>foobar1</option></%s>", + String design = String.format("<%s %s='%s'>\n" + + "<option item='foo' selected>foo1</option>\n" + + "<option item='bar'>bar1</option>" + + "<option item='foobar' selected>foobar1</option></%s>", getComponentTag(), attribute, type, getComponentTag()); T component = getComponentClass().newInstance(); component.setItems(items); @@ -69,10 +69,10 @@ public abstract class AbstractMultiSelectDeclarativeTest<T extends AbstractMulti String type = "com.vaadin.SomeType"; String attribute = "data-type"; - String design = String.format( - "<%s %s='%s'>\n" + "<option item='foo' selected>foo1</option>\n" - + "<option item='bar'>bar1</option>" - + "<option item='foobar' selected>foobar1</option></%s>", + String design = String.format("<%s %s='%s'>\n" + + "<option item='foo' selected>foo1</option>\n" + + "<option item='bar'>bar1</option>" + + "<option item='foobar' selected>foobar1</option></%s>", getComponentTag(), attribute, type, getComponentTag()); T component = getComponentClass().newInstance(); component.setItems(items); diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/AddComponentsTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/AddComponentsTest.java index 7ea028a594..bf1df307e8 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/AddComponentsTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/AddComponentsTest.java @@ -18,8 +18,8 @@ import com.vaadin.ui.VerticalLayout; public class AddComponentsTest { - Component[] children = { new Label("A"), new Label("B"), - new Label("C"), new Label("D") }; + Component[] children = { new Label("A"), new Label("B"), new Label("C"), + new Label("D") }; @Test public void moveComponentsBetweenLayouts() { diff --git a/server/src/test/java/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java index 8487f7f7cd..d66de9961c 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java @@ -70,8 +70,7 @@ public class ButtonDeclarativeTest extends DeclarativeTestBase<Button> { designPlainText = designPlainText.replace("vaadin-button", "vaadin-native-button"); Button nativeButton = read(designPlainText); - assertEquals(expectedCaptionPlainText, - nativeButton.getCaption()); + assertEquals(expectedCaptionPlainText, nativeButton.getCaption()); String designHtml = "<vaadin-button>> One</vaadin-button>"; String expectedCaptionHtml = "> One"; diff --git a/server/src/test/java/com/vaadin/tests/server/component/checkboxgroup/CheckBoxGroupDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/checkboxgroup/CheckBoxGroupDeclarativeTest.java index b7a5d069ae..dcac4529ea 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/checkboxgroup/CheckBoxGroupDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/checkboxgroup/CheckBoxGroupDeclarativeTest.java @@ -75,4 +75,4 @@ public class CheckBoxGroupDeclarativeTest return null; } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxDeclarativeTest.java index 080f83cc36..6b21b0c463 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxDeclarativeTest.java @@ -74,10 +74,10 @@ public class ComboBoxDeclarativeTest IllegalAccessException, InvocationTargetException { List<String> items = Arrays.asList("foo", "bar", "foobar"); - String design = String.format( - "<%s>\n" + "<option item='foo' style='foo-style'>foo</option>\n" - + "<option item='bar' style='bar-style'>bar</option>" - + "<option item='foobar' style='foobar-style'>foobar</option></%s>", + String design = String.format("<%s>\n" + + "<option item='foo' style='foo-style'>foo</option>\n" + + "<option item='bar' style='bar-style'>bar</option>" + + "<option item='foobar' style='foobar-style'>foobar</option></%s>", getComponentTag(), getComponentTag()); ComboBox<String> comboBox = new ComboBox<>(); comboBox.setItems(items); diff --git a/server/src/test/java/com/vaadin/tests/server/component/csslayout/AddComponentsTest.java b/server/src/test/java/com/vaadin/tests/server/component/csslayout/AddComponentsTest.java index ac571fd7ac..c5b3cc9c87 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/csslayout/AddComponentsTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/csslayout/AddComponentsTest.java @@ -16,8 +16,8 @@ import com.vaadin.ui.Layout; public class AddComponentsTest { - private final Component[] children = { new Label("A"), - new Label("B"), new Label("C"), new Label("D") }; + private final Component[] children = { new Label("A"), new Label("B"), + new Label("C"), new Label("D") }; @Test public void moveComponentsBetweenLayouts() { diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java b/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java index b6a6ab548f..9de8ba5c98 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java +++ b/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java @@ -5,6 +5,7 @@ import com.vaadin.ui.Grid; /** * {@link Grid} class for testing purposes + * * @param <T> * the grid bean type */ diff --git a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutTest.java b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutTest.java index 414768d028..abf2e823d5 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutTest.java @@ -16,8 +16,8 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Layout; public class GridLayoutTest { - Component[] children = { new Label("A"), new Label("B"), - new Label("C"), new Label("D") }; + Component[] children = { new Label("A"), new Label("B"), new Label("C"), + new Label("D") }; @Test public void testConstructorWithComponents() { diff --git a/server/src/test/java/com/vaadin/tests/server/component/link/LinkDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/link/LinkDeclarativeTest.java index cb970e4ac9..315d016d89 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/link/LinkDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/link/LinkDeclarativeTest.java @@ -48,4 +48,4 @@ public class LinkDeclarativeTest extends DeclarativeTestBase<Link> { testWrite("<vaadin-link />", new Link()); } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/server/component/radiobuttongroup/RadioButtonGroupDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/radiobuttongroup/RadioButtonGroupDeclarativeTest.java index 20c5a5b265..fa9a2ccda9 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/radiobuttongroup/RadioButtonGroupDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/radiobuttongroup/RadioButtonGroupDeclarativeTest.java @@ -75,4 +75,4 @@ public class RadioButtonGroupDeclarativeTest return null; } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/server/component/treegrid/TreeGridDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/treegrid/TreeGridDeclarativeTest.java index c116c08146..a9dd11fc24 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/treegrid/TreeGridDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/treegrid/TreeGridDeclarativeTest.java @@ -77,7 +77,6 @@ public class TreeGridDeclarativeTest testWrite(design, grid, true); } - @Override public void valueSerialization() throws InstantiationException, IllegalAccessException, InvocationTargetException { diff --git a/server/src/test/java/com/vaadin/tests/server/component/twincolselect/TwinColSelectDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/twincolselect/TwinColSelectDeclarativeTest.java index 6b330077b3..76caf30f3a 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/twincolselect/TwinColSelectDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/twincolselect/TwinColSelectDeclarativeTest.java @@ -68,4 +68,4 @@ public class TwinColSelectDeclarativeTest return TwinColSelect.class; } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/server/component/window/AttachDetachWindowTest.java b/server/src/test/java/com/vaadin/tests/server/component/window/AttachDetachWindowTest.java index 9b20015b37..69b37ba1f8 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/window/AttachDetachWindowTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/window/AttachDetachWindowTest.java @@ -219,9 +219,8 @@ public class AttachDetachWindowTest { final Window window = new Window(); final boolean[] eventFired = new boolean[1]; - ui.addComponentAttachListener( - event -> eventFired[0] = event.getAttachedComponent() - .equals(window)); + ui.addComponentAttachListener(event -> eventFired[0] = event + .getAttachedComponent().equals(window)); ui.addWindow(window); assertTrue("Attach event is not fired for added window", eventFired[0]); } @@ -232,9 +231,8 @@ public class AttachDetachWindowTest { final Window window = new Window(); final boolean[] eventFired = new boolean[1]; - ui.addComponentDetachListener( - event -> eventFired[0] = event.getDetachedComponent() - .equals(window)); + ui.addComponentDetachListener(event -> eventFired[0] = event + .getDetachedComponent().equals(window)); ui.addWindow(window); ui.removeWindow(window); |