summaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-10-03 12:56:25 +0200
committerHenri Sara <henri.sara@gmail.com>2017-10-03 13:56:25 +0300
commitccad305464af83826de4a4bd25a383360fb356d0 (patch)
treed399448d2910c4cf373e64c690b053740dff43ba /server/src
parent28b52d687dade66154a4fcd545415bf0d01b0a53 (diff)
downloadvaadin-framework-ccad305464af83826de4a4bd25a383360fb356d0.tar.gz
vaadin-framework-ccad305464af83826de4a4bd25a383360fb356d0.zip
Use static import of Assert in tests (#10126)
Also removes dependency on junit.framework.TestCase .
Diffstat (limited to 'server/src')
-rw-r--r--server/src/test/java/com/vaadin/data/BeanBinderTest.java21
-rw-r--r--server/src/test/java/com/vaadin/data/BeanPropertySetTest.java27
-rw-r--r--server/src/test/java/com/vaadin/data/BinderBookOfVaadinTest.java262
-rw-r--r--server/src/test/java/com/vaadin/data/BinderComponentTest.java9
-rw-r--r--server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java79
-rw-r--r--server/src/test/java/com/vaadin/data/BinderCustomPropertySetTest.java17
-rw-r--r--server/src/test/java/com/vaadin/data/BinderInstanceFieldTest.java69
-rw-r--r--server/src/test/java/com/vaadin/data/BinderStatusChangeTest.java74
-rw-r--r--server/src/test/java/com/vaadin/data/BinderTest.java203
-rw-r--r--server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java189
-rw-r--r--server/src/test/java/com/vaadin/data/BinderValueChangeTest.java35
-rw-r--r--server/src/test/java/com/vaadin/data/HasValueTest.java13
-rw-r--r--server/src/test/java/com/vaadin/data/Jsr303Test.java7
-rw-r--r--server/src/test/java/com/vaadin/data/NotEmptyTest.java8
-rw-r--r--server/src/test/java/com/vaadin/data/ResultTest.java50
-rw-r--r--server/src/test/java/com/vaadin/data/ValidatorTest.java10
-rw-r--r--server/src/test/java/com/vaadin/data/ValueContextTest.java30
-rw-r--r--server/src/test/java/com/vaadin/data/provider/AbstractDataProviderTest.java13
-rw-r--r--server/src/test/java/com/vaadin/data/provider/ConfigurableFilterDataProviderWrapperTest.java19
-rw-r--r--server/src/test/java/com/vaadin/data/provider/DataCommunicatorTest.java30
-rw-r--r--server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java43
-rw-r--r--server/src/test/java/com/vaadin/data/provider/ListDataProviderTest.java56
-rw-r--r--server/src/test/java/com/vaadin/data/provider/ReplaceListDataProviderTest.java16
-rw-r--r--server/src/test/java/com/vaadin/data/provider/SortOrderBuildersTest.java10
-rw-r--r--server/src/test/java/com/vaadin/data/provider/TreeDataProviderTest.java125
-rw-r--r--server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchyMapperWithDataTest.java60
-rw-r--r--server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchyMapperWithNumerousDataTest.java25
-rw-r--r--server/src/test/java/com/vaadin/data/validator/NotEmptyValidatorTest.java17
-rw-r--r--server/src/test/java/com/vaadin/data/validator/ValidatorTestBase.java11
-rw-r--r--server/src/test/java/com/vaadin/event/selection/SelectionEventTest.java12
-rw-r--r--server/src/test/java/com/vaadin/server/AbstractClientConnectorProxyHandlingTest.java8
-rw-r--r--server/src/test/java/com/vaadin/server/AbstractClientConnectorTest.java19
-rw-r--r--server/src/test/java/com/vaadin/server/AbstractDeploymentConfigurationTest.java19
-rw-r--r--server/src/test/java/com/vaadin/server/BootstrapHandlerTest.java6
-rw-r--r--server/src/test/java/com/vaadin/server/BrowserWindowOpenerTest.java19
-rw-r--r--server/src/test/java/com/vaadin/server/ConnectorResourceHandlerTest.java5
-rw-r--r--server/src/test/java/com/vaadin/server/DedicatedStateTest.java14
-rw-r--r--server/src/test/java/com/vaadin/server/DefaultDeploymentConfigurationTest.java7
-rw-r--r--server/src/test/java/com/vaadin/server/DragAndDropServiceTest.java11
-rw-r--r--server/src/test/java/com/vaadin/server/JSONSerializerTest.java9
-rw-r--r--server/src/test/java/com/vaadin/server/JsonEqualsTest.java54
-rw-r--r--server/src/test/java/com/vaadin/server/LocaleServiceTest.java13
-rw-r--r--server/src/test/java/com/vaadin/server/PageTest.java9
-rw-r--r--server/src/test/java/com/vaadin/server/RemoveListenersDeprecatedTest.java18
-rw-r--r--server/src/test/java/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java12
-rw-r--r--server/src/test/java/com/vaadin/server/UIProviderTest.java21
-rw-r--r--server/src/test/java/com/vaadin/server/VaadinPortletServiceTest.java7
-rw-r--r--server/src/test/java/com/vaadin/server/VaadinServiceTest.java20
-rw-r--r--server/src/test/java/com/vaadin/server/VaadinServletConfigurationTest.java27
-rw-r--r--server/src/test/java/com/vaadin/server/VaadinServletServiceTest.java14
-rw-r--r--server/src/test/java/com/vaadin/server/VaadinServletTest.java76
-rw-r--r--server/src/test/java/com/vaadin/server/VaadinSessionTest.java50
-rw-r--r--server/src/test/java/com/vaadin/server/communication/AtmospherePushConnectionTest.java7
-rw-r--r--server/src/test/java/com/vaadin/server/communication/MetadataWriterTest.java16
-rw-r--r--server/src/test/java/com/vaadin/server/communication/ServletUIInitHandlerTest.java13
-rw-r--r--server/src/test/java/com/vaadin/tests/components/TreeTest.java10
-rw-r--r--server/src/test/java/com/vaadin/tests/components/grid/GridComponentRendererTest.java17
-rw-r--r--server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java86
-rw-r--r--server/src/test/java/com/vaadin/tests/components/grid/GridNoSelectionModelTest.java20
-rw-r--r--server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java5
-rw-r--r--server/src/test/java/com/vaadin/tests/components/grid/GridSelectionModeTest.java17
-rw-r--r--server/src/test/java/com/vaadin/tests/components/grid/GridSingleSelectionModelTest.java59
-rw-r--r--server/src/test/java/com/vaadin/tests/components/grid/GridValueProvider.java12
-rw-r--r--server/src/test/java/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java35
-rw-r--r--server/src/test/java/com/vaadin/tests/components/treegrid/TreeGridTest.java21
-rw-r--r--server/src/test/java/com/vaadin/tests/data/converter/AbstractConverterTest.java18
-rw-r--r--server/src/test/java/com/vaadin/tests/data/converter/AbstractStringConverterTest.java8
-rw-r--r--server/src/test/java/com/vaadin/tests/data/converter/ConverterTest.java7
-rw-r--r--server/src/test/java/com/vaadin/tests/data/converter/LocalDateTimeToDateConverterTest.java7
-rw-r--r--server/src/test/java/com/vaadin/tests/data/converter/LocalDateToDateConverterTest.java7
-rw-r--r--server/src/test/java/com/vaadin/tests/data/converter/StringToBigDecimalConverterTest.java9
-rw-r--r--server/src/test/java/com/vaadin/tests/data/converter/StringToBigIntegerConverterTest.java10
-rw-r--r--server/src/test/java/com/vaadin/tests/data/converter/StringToBooleanConverterTest.java28
-rw-r--r--server/src/test/java/com/vaadin/tests/data/converter/StringToDoubleConverterTest.java10
-rw-r--r--server/src/test/java/com/vaadin/tests/data/converter/StringToFloatConverterTest.java5
-rw-r--r--server/src/test/java/com/vaadin/tests/data/converter/StringToIntegerConverterTest.java18
-rw-r--r--server/src/test/java/com/vaadin/tests/data/converter/StringToLongConverterTest.java5
-rw-r--r--server/src/test/java/com/vaadin/tests/data/selection/AbstractStaleSelectionTest.java9
-rw-r--r--server/src/test/java/com/vaadin/tests/data/selection/GridStaleElementTest.java21
-rw-r--r--server/src/test/java/com/vaadin/tests/data/selection/StaleMultiSelectionTest.java10
-rw-r--r--server/src/test/java/com/vaadin/tests/data/selection/StaleSingleSelectionTest.java8
-rw-r--r--server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java14
-rw-r--r--server/src/test/java/com/vaadin/tests/design/ComponentMapperTest.java10
-rw-r--r--server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java5
-rw-r--r--server/src/test/java/com/vaadin/tests/design/DesignFormatterTest.java21
-rw-r--r--server/src/test/java/com/vaadin/tests/design/DesignReadInConstructorTest.java11
-rw-r--r--server/src/test/java/com/vaadin/tests/design/DesignTest.java13
-rw-r--r--server/src/test/java/com/vaadin/tests/design/FieldNameWhichConflictsWithGettersTest.java17
-rw-r--r--server/src/test/java/com/vaadin/tests/design/InvalidTagNamesTest.java13
-rw-r--r--server/src/test/java/com/vaadin/tests/design/designroot/CompositeDesignRootTest.java19
-rw-r--r--server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootTest.java18
-rw-r--r--server/src/test/java/com/vaadin/tests/design/designroot/DesignRootTest.java28
-rw-r--r--server/src/test/java/com/vaadin/tests/event/EventRouterTest.java8
-rw-r--r--server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java10
-rw-r--r--server/src/test/java/com/vaadin/tests/server/CsrfTokenMissingTest.java30
-rw-r--r--server/src/test/java/com/vaadin/tests/server/StreamResourceTest.java8
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java21
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/ComponentSizeParseTest.java9
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/DeclarativeMarginTestBase.java9
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/FinalMethodTest.java5
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/ItemCaptionGeneratorTest.java8
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/StateGetDoesNotMarkDirtyTest.java5
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/WriteEmptyDesignTest.java7
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/abstractlisting/AbstractListingDeclarativeTest.java2
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/abstractmultiselect/AbstractMultiSelectDeclarativeTest.java4
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/LayoutSettingsOnReplaceTest.java7
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/abstractsinglecomponentcontainer/RemoveFromParentLockingTest.java7
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/abstractsingleselect/AbstractSingleSelectDeclarativeTest.java4
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/audio/AudioStateTest.java11
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/button/ButtonClickTest.java11
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java8
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxFilteringTest.java22
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/customlayout/CustomLayoutTest.java11
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/grid/EditorImplTest.java47
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/grid/GridChildrenTest.java31
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/grid/GridCustomPropertySetTest.java17
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java202
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/grid/GridDetailsTest.java18
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java125
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/gridlayout/DefaultAlignmentTest.java12
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java18
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/label/LabelDeclarativeTest.java8
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/loginform/LoginFormTest.java33
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/menubar/MenuBarIdsTest.java9
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/orderedlayout/DefaultAlignmentTest.java14
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/tabsheet/TabSheetTest.java27
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/textarea/TextAreaDeclarativeTest.java4
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/tree/TreeDeclarativeTest.java33
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/treegrid/TreeGridDeclarativeTest.java8
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/upload/UploadDeclarativeTest.java9
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/upload/UploadTest.java17
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/window/AttachDetachWindowTest.java4
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/window/WindowDeclarativeTest.java5
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/window/WindowTest.java19
-rw-r--r--server/src/test/java/com/vaadin/tests/server/componentcontainer/AddRemoveComponentTest.java8
-rw-r--r--server/src/test/java/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java14
-rw-r--r--server/src/test/java/com/vaadin/tests/server/componentcontainer/HorizontalLayoutTest.java30
-rw-r--r--server/src/test/java/com/vaadin/tests/server/componentcontainer/VerticalLayoutTest.java30
-rw-r--r--server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java79
-rw-r--r--server/src/test/java/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java16
-rw-r--r--server/src/test/java/com/vaadin/tests/util/TestUtil.java23
-rw-r--r--server/src/test/java/com/vaadin/ui/AbstractListingTest.java40
-rw-r--r--server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java74
-rw-r--r--server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java27
-rw-r--r--server/src/test/java/com/vaadin/ui/CheckBoxTest.java18
-rw-r--r--server/src/test/java/com/vaadin/ui/ComponentTest.java7
-rw-r--r--server/src/test/java/com/vaadin/ui/CustomFieldTest.java14
-rw-r--r--server/src/test/java/com/vaadin/ui/DateFieldConstructorTest.java23
-rw-r--r--server/src/test/java/com/vaadin/ui/DateFieldTestCase.java11
-rw-r--r--server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java27
-rw-r--r--server/src/test/java/com/vaadin/ui/HorizontalSplitPanelTest.java5
-rw-r--r--server/src/test/java/com/vaadin/ui/InlineDateFieldConstructorTest.java24
-rw-r--r--server/src/test/java/com/vaadin/ui/InlineDateTimeFieldConstructorTest.java28
-rw-r--r--server/src/test/java/com/vaadin/ui/LabelTest.java9
-rw-r--r--server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java14
-rw-r--r--server/src/test/java/com/vaadin/ui/PushConfigurationTransportTest.java12
-rw-r--r--server/src/test/java/com/vaadin/ui/RadioButtonGroupTest.java13
-rw-r--r--server/src/test/java/com/vaadin/ui/RichTextAreaConstructorTest.java14
-rw-r--r--server/src/test/java/com/vaadin/ui/RichTextAreaTest.java20
-rw-r--r--server/src/test/java/com/vaadin/ui/TextAreaConstructorTest.java14
-rw-r--r--server/src/test/java/com/vaadin/ui/TextAreaTest.java10
-rw-r--r--server/src/test/java/com/vaadin/ui/TextFieldConstructorTest.java14
-rw-r--r--server/src/test/java/com/vaadin/ui/UIInitRefreshTest.java43
-rw-r--r--server/src/test/java/com/vaadin/ui/UITest.java15
-rw-r--r--server/src/test/java/com/vaadin/ui/VerticalSplitPanelTest.java5
-rw-r--r--server/src/test/java/com/vaadin/ui/components/grid/StaticSectionTest.java9
-rw-r--r--server/src/test/java/com/vaadin/ui/declarative/DesignTest.java9
-rw-r--r--server/src/test/java/com/vaadin/util/CurrentInstanceTest.java20
-rw-r--r--server/src/test/java/com/vaadin/util/EncodeUtilTest.java13
-rw-r--r--server/src/test/java/com/vaadin/util/ReflectToolsTest.java13
170 files changed, 2211 insertions, 2046 deletions
diff --git a/server/src/test/java/com/vaadin/data/BeanBinderTest.java b/server/src/test/java/com/vaadin/data/BeanBinderTest.java
index 35722405f7..45610754d5 100644
--- a/server/src/test/java/com/vaadin/data/BeanBinderTest.java
+++ b/server/src/test/java/com/vaadin/data/BeanBinderTest.java
@@ -1,7 +1,9 @@
package com.vaadin.data;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
import java.io.Serializable;
import java.time.LocalDate;
@@ -14,7 +16,6 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotEmpty;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -410,7 +411,7 @@ public class BeanBinderTest
binder.bind(field, "firstname");
binder.setBean(bean);
- Assert.assertTrue(field.isRequiredIndicatorVisible());
+ assertTrue(field.isRequiredIndicatorVisible());
testSerialization(binder);
}
@@ -424,7 +425,7 @@ public class BeanBinderTest
binder.bind(field, "age");
binder.setBean(bean);
- Assert.assertTrue(field.isRequiredIndicatorVisible());
+ assertTrue(field.isRequiredIndicatorVisible());
testSerialization(binder);
}
@@ -438,7 +439,7 @@ public class BeanBinderTest
binder.bind(field, "lastname");
binder.setBean(bean);
- Assert.assertTrue(field.isRequiredIndicatorVisible());
+ assertTrue(field.isRequiredIndicatorVisible());
testSerialization(binder);
}
@@ -453,7 +454,7 @@ public class BeanBinderTest
binder.bind(field, "subfield.name");
binder.setBean(bean);
- Assert.assertTrue(field.isRequiredIndicatorVisible());
+ assertTrue(field.isRequiredIndicatorVisible());
testSerialization(binder);
}
@@ -470,7 +471,7 @@ public class BeanBinderTest
binder.bind(field, "subfield.subsub.value");
binder.setBean(bean);
- Assert.assertTrue(field.isRequiredIndicatorVisible());
+ assertTrue(field.isRequiredIndicatorVisible());
testSerialization(binder);
}
@@ -484,9 +485,9 @@ public class BeanBinderTest
RequiredConstraints bean = new RequiredConstraints();
bean.setSubfield(new SubConstraint());
binder.setBean(bean);
- Assert.assertFalse(binder.validate().isOk());
+ assertFalse(binder.validate().isOk());
field.setValue("overfive");
- Assert.assertTrue(binder.validate().isOk());
+ assertTrue(binder.validate().isOk());
}
@Test
@@ -502,9 +503,9 @@ public class BeanBinderTest
subfield.setSubsub(new SubSubConstraint());
binder.setBean(bean);
- Assert.assertFalse(binder.validate().isOk());
+ assertFalse(binder.validate().isOk());
field.setValue("overtencharacters");
- Assert.assertTrue(binder.validate().isOk());
+ assertTrue(binder.validate().isOk());
}
private void assertInvalid(HasValue<?> field, String message) {
diff --git a/server/src/test/java/com/vaadin/data/BeanPropertySetTest.java b/server/src/test/java/com/vaadin/data/BeanPropertySetTest.java
index c577db6067..7b492ad012 100644
--- a/server/src/test/java/com/vaadin/data/BeanPropertySetTest.java
+++ b/server/src/test/java/com/vaadin/data/BeanPropertySetTest.java
@@ -15,6 +15,10 @@
*/
package com.vaadin.data;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
@@ -26,7 +30,6 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.provider.bov.Person;
@@ -45,8 +48,7 @@ public class BeanPropertySetTest {
PropertySet<Person> deserializedPropertySet = ClassesSerializableTest
.serializeAndDeserialize(originalPropertySet);
- Assert.assertSame(
- "Deserialized instance should be the same as the original",
+ assertSame("Deserialized instance should be the same as the original",
originalPropertySet, deserializedPropertySet);
}
@@ -74,10 +76,9 @@ public class BeanPropertySetTest {
PropertySet<Person> deserializedPropertySet = (PropertySet<Person>) in
.readObject();
- Assert.assertSame(
- "Deserialized instance should be the same as in the cache",
+ assertSame("Deserialized instance should be the same as in the cache",
BeanPropertySet.get(Person.class), deserializedPropertySet);
- Assert.assertNotSame(
+ assertNotSame(
"Deserialized instance should not be the same as the original",
originalPropertySet, deserializedPropertySet);
}
@@ -95,11 +96,10 @@ public class BeanPropertySetTest {
Person person = new Person("Milennial", 2000);
Integer age = (Integer) getter.apply(person);
- Assert.assertEquals("Deserialized definition should be functional",
+ assertEquals("Deserialized definition should be functional",
Integer.valueOf(2000), age);
- Assert.assertSame(
- "Deserialized instance should be the same as in the cache",
+ assertSame("Deserialized instance should be the same as in the cache",
BeanPropertySet.get(Person.class).getProperty("born")
.orElseThrow(RuntimeException::new),
deserializedDefinition);
@@ -125,11 +125,10 @@ public class BeanPropertySetTest {
Integer postalCode = (Integer) getter.apply(person);
- Assert.assertEquals("Deserialized definition should be functional",
+ assertEquals("Deserialized definition should be functional",
address.getPostalCode(), postalCode);
- Assert.assertSame(
- "Deserialized instance should be the same as in the cache",
+ assertSame("Deserialized instance should be the same as in the cache",
BeanPropertySet.get(com.vaadin.tests.data.bean.Person.class)
.getProperty("address.postalCode").orElseThrow(
RuntimeException::new),
@@ -153,7 +152,7 @@ public class BeanPropertySetTest {
String firstName = (String) getter.apply(son);
- Assert.assertEquals(grandFather.getFirstName(), firstName);
+ assertEquals(grandFather.getFirstName(), firstName);
}
@Test(expected = NullPointerException.class)
@@ -188,7 +187,7 @@ public class BeanPropertySetTest {
Set<String> propertyNames = propertySet.getProperties()
.map(PropertyDefinition::getName).collect(Collectors.toSet());
- Assert.assertEquals(new HashSet<>(Arrays.asList("name", "born")),
+ assertEquals(new HashSet<>(Arrays.asList("name", "born")),
propertyNames);
}
}
diff --git a/server/src/test/java/com/vaadin/data/BinderBookOfVaadinTest.java b/server/src/test/java/com/vaadin/data/BinderBookOfVaadinTest.java
index 89987d5f62..2d7c6631b0 100644
--- a/server/src/test/java/com/vaadin/data/BinderBookOfVaadinTest.java
+++ b/server/src/test/java/com/vaadin/data/BinderBookOfVaadinTest.java
@@ -15,6 +15,12 @@
*/
package com.vaadin.data;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.time.LocalDate;
import java.util.List;
import java.util.Locale;
@@ -22,7 +28,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -186,16 +191,16 @@ public class BinderBookOfVaadinTest {
field.setValue("not-email");
BinderValidationStatus<?> status = binder.validate();
- Assert.assertEquals(1, status.getFieldValidationErrors().size());
- Assert.assertEquals("This doesn't look like a valid email address",
+ assertEquals(1, status.getFieldValidationErrors().size());
+ assertEquals("This doesn't look like a valid email address",
status.getFieldValidationErrors().get(0).getMessage().get());
- Assert.assertEquals("This doesn't look like a valid email address",
+ assertEquals("This doesn't look like a valid email address",
((AbstractErrorMessage) field.getErrorMessage()).getMessage());
field.setValue("abc@vaadin.com");
status = binder.validate();
- Assert.assertEquals(0, status.getBeanValidationErrors().size());
- Assert.assertNull(field.getErrorMessage());
+ assertEquals(0, status.getBeanValidationErrors().size());
+ assertNull(field.getErrorMessage());
}
@Test
@@ -208,16 +213,16 @@ public class BinderBookOfVaadinTest {
field.setValue("a");
BinderValidationStatus<?> status = binder.validate();
- Assert.assertEquals(1, status.getFieldValidationErrors().size());
- Assert.assertEquals("Last name must contain at least three characters",
+ assertEquals(1, status.getFieldValidationErrors().size());
+ assertEquals("Last name must contain at least three characters",
status.getFieldValidationErrors().get(0).getMessage().get());
- Assert.assertEquals("Last name must contain at least three characters",
+ assertEquals("Last name must contain at least three characters",
((AbstractErrorMessage) field.getErrorMessage()).getMessage());
field.setValue("long last name");
status = binder.validate();
- Assert.assertEquals(0, status.getFieldValidationErrors().size());
- Assert.assertNull(field.getErrorMessage());
+ assertEquals(0, status.getFieldValidationErrors().size());
+ assertNull(field.getErrorMessage());
}
@Test
@@ -233,24 +238,24 @@ public class BinderBookOfVaadinTest {
field.setValue("not-email");
BinderValidationStatus<?> status = binder.validate();
// Only one error per field should be reported
- Assert.assertEquals(1, status.getFieldValidationErrors().size());
- Assert.assertEquals("This doesn't look like a valid email address",
+ assertEquals(1, status.getFieldValidationErrors().size());
+ assertEquals("This doesn't look like a valid email address",
status.getFieldValidationErrors().get(0).getMessage().get());
- Assert.assertEquals("This doesn't look like a valid email address",
+ assertEquals("This doesn't look like a valid email address",
((AbstractErrorMessage) field.getErrorMessage()).getMessage());
field.setValue("abc@vaadin.com");
status = binder.validate();
- Assert.assertEquals(1, status.getFieldValidationErrors().size());
- Assert.assertEquals("Only acme.com email addresses are allowed",
+ assertEquals(1, status.getFieldValidationErrors().size());
+ assertEquals("Only acme.com email addresses are allowed",
status.getFieldValidationErrors().get(0).getMessage().get());
- Assert.assertEquals("Only acme.com email addresses are allowed",
+ assertEquals("Only acme.com email addresses are allowed",
((AbstractErrorMessage) field.getErrorMessage()).getMessage());
field.setValue("abc@acme.com");
status = binder.validate();
- Assert.assertEquals(0, status.getFieldValidationErrors().size());
- Assert.assertNull(field.getErrorMessage());
+ assertEquals(0, status.getFieldValidationErrors().size());
+ assertNull(field.getErrorMessage());
}
@Test
@@ -276,20 +281,20 @@ public class BinderBookOfVaadinTest {
// Test that the book code works
BookPerson bookPerson = new BookPerson(1972, 4);
binder.setBean(bookPerson);
- Assert.assertEquals(4.0, salaryLevelField.getValue().doubleValue(), 0);
- Assert.assertEquals("1,972", yearOfBirthField.getValue());
+ assertEquals(4.0, salaryLevelField.getValue().doubleValue(), 0);
+ assertEquals("1,972", yearOfBirthField.getValue());
bookPerson.setSalaryLevel(8);
binder.readBean(bookPerson);
- Assert.assertEquals(8.0, salaryLevelField.getValue().doubleValue(), 0);
+ assertEquals(8.0, salaryLevelField.getValue().doubleValue(), 0);
bookPerson.setYearOfBirth(123);
binder.readBean(bookPerson);
- Assert.assertEquals("123", yearOfBirthField.getValue());
+ assertEquals("123", yearOfBirthField.getValue());
yearOfBirthField.setValue("2016");
salaryLevelField.setValue(1.0);
- Assert.assertEquals(2016, bookPerson.getYearOfBirth());
- Assert.assertEquals(1, bookPerson.getSalaryLevel());
+ assertEquals(2016, bookPerson.getYearOfBirth());
+ assertEquals(1, bookPerson.getSalaryLevel());
}
@Test
@@ -306,7 +311,7 @@ public class BinderBookOfVaadinTest {
binder.setBean(new BookPerson(1900, 5));
yearOfBirthField.setValue("abc");
binder.validate();
- Assert.assertEquals("Please&#32;enter&#32;a&#32;number",
+ assertEquals("Please&#32;enter&#32;a&#32;number",
yearOfBirthField.getComponentError().getFormattedHtmlMessage());
}
@@ -333,33 +338,33 @@ public class BinderBookOfVaadinTest {
returning.setValue(after);
BinderValidationStatus<Trip> status = binder.validate();
- Assert.assertTrue(status.getBeanValidationErrors().isEmpty());
- Assert.assertNull(departing.getComponentError());
- Assert.assertNull(returning.getComponentError());
+ assertTrue(status.getBeanValidationErrors().isEmpty());
+ assertNull(departing.getComponentError());
+ assertNull(returning.getComponentError());
// update returning => validation is done against this field
returning.setValue(past);
status = binder.validate();
- Assert.assertFalse(status.getFieldValidationErrors().isEmpty());
- Assert.assertNotNull(returning.getComponentError());
- Assert.assertNull(departing.getComponentError());
+ assertFalse(status.getFieldValidationErrors().isEmpty());
+ assertNotNull(returning.getComponentError());
+ assertNull(departing.getComponentError());
// set correct value back
returning.setValue(before);
status = binder.validate();
- Assert.assertTrue(status.getFieldValidationErrors().isEmpty());
- Assert.assertNull(departing.getComponentError());
- Assert.assertNull(returning.getComponentError());
+ assertTrue(status.getFieldValidationErrors().isEmpty());
+ assertNull(departing.getComponentError());
+ assertNull(returning.getComponentError());
// update departing => validation is done because of listener added
departing.setValue(after);
status = binder.validate();
- Assert.assertFalse(status.getFieldValidationErrors().isEmpty());
- Assert.assertNotNull(returning.getComponentError());
- Assert.assertNull(departing.getComponentError());
+ assertFalse(status.getFieldValidationErrors().isEmpty());
+ assertNotNull(returning.getComponentError());
+ assertNull(departing.getComponentError());
}
@@ -386,29 +391,29 @@ public class BinderBookOfVaadinTest {
returning.setValue(after);
BindingValidationStatus<LocalDate> result = returnBinding.validate();
- Assert.assertFalse(result.isError());
- Assert.assertNull(departing.getComponentError());
+ assertFalse(result.isError());
+ assertNull(departing.getComponentError());
// update returning => validation is done against this field
returning.setValue(past);
result = returnBinding.validate();
- Assert.assertTrue(result.isError());
- Assert.assertNotNull(returning.getComponentError());
+ assertTrue(result.isError());
+ assertNotNull(returning.getComponentError());
// set correct value back
returning.setValue(before);
result = returnBinding.validate();
- Assert.assertFalse(result.isError());
- Assert.assertNull(departing.getComponentError());
+ assertFalse(result.isError());
+ assertNull(departing.getComponentError());
// update departing => validation is done because of listener added
departing.setValue(after);
result = returnBinding.validate();
- Assert.assertTrue(result.isError());
- Assert.assertNotNull(returning.getComponentError());
+ assertTrue(result.isError());
+ assertNotNull(returning.getComponentError());
}
@Test
@@ -423,14 +428,14 @@ public class BinderBookOfVaadinTest {
field.setValue("foo");
binder.validate();
- Assert.assertTrue(emailStatus.isVisible());
- Assert.assertEquals(msg, emailStatus.getValue());
+ assertTrue(emailStatus.isVisible());
+ assertEquals(msg, emailStatus.getValue());
field.setValue("foo@vaadin.com");
binder.validate();
- Assert.assertFalse(emailStatus.isVisible());
- Assert.assertEquals("", emailStatus.getValue());
+ assertFalse(emailStatus.isVisible());
+ assertEquals("", emailStatus.getValue());
}
@Test
@@ -451,24 +456,24 @@ public class BinderBookOfVaadinTest {
field.setValue("aa");
binder.validate();
- Assert.assertTrue(nameStatus.isVisible());
- Assert.assertEquals(msg, nameStatus.getValue());
- Assert.assertNotNull(statusCapture.get());
+ assertTrue(nameStatus.isVisible());
+ assertEquals(msg, nameStatus.getValue());
+ assertNotNull(statusCapture.get());
BindingValidationStatus<?> status = statusCapture.get();
- Assert.assertEquals(Status.ERROR, status.getStatus());
- Assert.assertEquals(msg, status.getMessage().get());
- Assert.assertEquals(field, status.getField());
+ assertEquals(Status.ERROR, status.getStatus());
+ assertEquals(msg, status.getMessage().get());
+ assertEquals(field, status.getField());
field.setValue("foo");
binder.validate();
- Assert.assertFalse(nameStatus.isVisible());
- Assert.assertEquals("", nameStatus.getValue());
- Assert.assertNotNull(statusCapture.get());
+ assertFalse(nameStatus.isVisible());
+ assertEquals("", nameStatus.getValue());
+ assertNotNull(statusCapture.get());
status = statusCapture.get();
- Assert.assertEquals(Status.OK, status.getStatus());
- Assert.assertFalse(status.getMessage().isPresent());
- Assert.assertEquals(field, status.getField());
+ assertEquals(Status.OK, status.getStatus());
+ assertFalse(status.getMessage().isPresent());
+ assertEquals(field, status.getField());
}
@Test
@@ -501,14 +506,14 @@ public class BinderBookOfVaadinTest {
});
emailField.setValue("foo@bar.com");
- Assert.assertTrue(binder.writeBeanIfValid(person));
+ assertTrue(binder.writeBeanIfValid(person));
// Person updated
- Assert.assertEquals("foo@bar.com", person.getEmail());
+ assertEquals("foo@bar.com", person.getEmail());
emailField.setValue("");
- Assert.assertFalse(binder.writeBeanIfValid(person));
+ assertFalse(binder.writeBeanIfValid(person));
// Person updated because phone and email are both empty
- Assert.assertEquals("foo@bar.com", person.getEmail());
+ assertEquals("foo@bar.com", person.getEmail());
}
@Test
@@ -527,21 +532,21 @@ public class BinderBookOfVaadinTest {
.bind(BookPerson::getYearOfBirth, BookPerson::setYearOfBirth);
yearOfBirthField.setValue("abc");
- Assert.assertEquals("Doesn't look like a year", binder.validate()
+ assertEquals("Doesn't look like a year", binder.validate()
.getFieldValidationErrors().get(0).getMessage().get());
yearOfBirthField.setValue("abcd");
- Assert.assertEquals("Must enter a number", binder.validate()
+ assertEquals("Must enter a number", binder.validate()
.getFieldValidationErrors().get(0).getMessage().get());
yearOfBirthField.setValue("1200");
- Assert.assertEquals("Person must be born in the 20th century",
+ assertEquals("Person must be born in the 20th century",
binder.validate().getFieldValidationErrors().get(0).getMessage()
.get());
yearOfBirthField.setValue("1950");
- Assert.assertFalse(binder.validate().hasErrors());
+ assertFalse(binder.validate().hasErrors());
BookPerson person = new BookPerson(1500, 12);
binder.writeBean(person);
- Assert.assertEquals(1950, person.getYearOfBirth());
+ assertEquals(1950, person.getYearOfBirth());
}
class MyConverter implements Converter<String, Integer> {
@@ -580,17 +585,17 @@ public class BinderBookOfVaadinTest {
binder.setBean(p);
yearOfBirthField.setValue("abc");
- Assert.assertTrue(binder.validate().hasErrors());
- Assert.assertEquals("Please enter a number", binder.validate()
+ assertTrue(binder.validate().hasErrors());
+ assertEquals("Please enter a number", binder.validate()
.getFieldValidationErrors().get(0).getMessage().get());
yearOfBirthField.setValue("123");
- Assert.assertTrue(binder.validate().isOk());
+ assertTrue(binder.validate().isOk());
p.setYearOfBirth(12500);
binder.readBean(p);
- Assert.assertEquals("12500", yearOfBirthField.getValue());
- Assert.assertTrue(binder.validate().isOk());
+ assertEquals("12500", yearOfBirthField.getValue());
+ assertTrue(binder.validate().isOk());
}
@Test
@@ -617,31 +622,31 @@ public class BinderBookOfVaadinTest {
yearOfBirth.setValue("2001");
BinderValidationStatus<?> status = binder.validate();
- Assert.assertEquals(0, status.getFieldValidationErrors().size());
- Assert.assertEquals(1, status.getBeanValidationErrors().size());
- Assert.assertEquals(message,
+ assertEquals(0, status.getFieldValidationErrors().size());
+ assertEquals(1, status.getBeanValidationErrors().size());
+ assertEquals(message,
status.getBeanValidationErrors().get(0).getErrorMessage());
- Assert.assertEquals(message, formStatusLabel.getValue());
+ assertEquals(message, formStatusLabel.getValue());
// value is correct, status label is cleared
yearOfBirth.setValue("1999");
status = binder.validate();
- Assert.assertFalse(status.hasErrors());
+ assertFalse(status.hasErrors());
- Assert.assertEquals("", formStatusLabel.getValue());
+ assertEquals("", formStatusLabel.getValue());
// both bean validators fail, should be two error messages chained
yearOfBirth.setValue("2000");
status = binder.validate();
- Assert.assertEquals(2, status.getBeanValidationResults().size());
- Assert.assertEquals(0, status.getFieldValidationErrors().size());
- Assert.assertEquals(2, status.getBeanValidationErrors().size());
+ assertEquals(2, status.getBeanValidationResults().size());
+ assertEquals(0, status.getFieldValidationErrors().size());
+ assertEquals(2, status.getBeanValidationErrors().size());
// only first error is shown
- Assert.assertEquals(message, formStatusLabel.getValue());
+ assertEquals(message, formStatusLabel.getValue());
}
@Test
@@ -682,43 +687,42 @@ public class BinderBookOfVaadinTest {
// first binding validation fails, no bean level validation is done
yearOfBirth.setValue("2001");
BinderValidationStatus<?> status = binder.validate();
- Assert.assertEquals(1, status.getFieldValidationErrors().size());
- Assert.assertEquals(bindingMessage,
+ assertEquals(1, status.getFieldValidationErrors().size());
+ assertEquals(bindingMessage,
status.getFieldValidationErrors().get(0).getMessage().get());
- Assert.assertEquals("", formStatusLabel.getValue());
+ assertEquals("", formStatusLabel.getValue());
// first bean validator fails and passes error message to status label
yearOfBirth.setValue("2002");
status = binder.validate();
- Assert.assertEquals(0, status.getFieldValidationErrors().size());
- Assert.assertEquals(1, status.getBeanValidationErrors().size());
- Assert.assertEquals(message,
+ assertEquals(0, status.getFieldValidationErrors().size());
+ assertEquals(1, status.getBeanValidationErrors().size());
+ assertEquals(message,
status.getBeanValidationErrors().get(0).getErrorMessage());
- Assert.assertEquals(message, formStatusLabel.getValue());
+ assertEquals(message, formStatusLabel.getValue());
// value is correct, status label is cleared
yearOfBirth.setValue("1998");
status = binder.validate();
- Assert.assertTrue(status.isOk());
- Assert.assertFalse(status.hasErrors());
- Assert.assertEquals(0, status.getFieldValidationErrors().size());
- Assert.assertEquals(0, status.getBeanValidationErrors().size());
+ assertTrue(status.isOk());
+ assertFalse(status.hasErrors());
+ assertEquals(0, status.getFieldValidationErrors().size());
+ assertEquals(0, status.getBeanValidationErrors().size());
- Assert.assertEquals("", formStatusLabel.getValue());
+ assertEquals("", formStatusLabel.getValue());
// both bean validators fail, should be two error messages chained
yearOfBirth.setValue("2000");
status = binder.validate();
- Assert.assertEquals(0, status.getFieldValidationErrors().size());
- Assert.assertEquals(2, status.getBeanValidationErrors().size());
+ assertEquals(0, status.getFieldValidationErrors().size());
+ assertEquals(2, status.getBeanValidationErrors().size());
- Assert.assertEquals(message + "\n" + message2,
- formStatusLabel.getValue());
+ assertEquals(message + "\n" + message2, formStatusLabel.getValue());
}
@@ -741,43 +745,43 @@ public class BinderBookOfVaadinTest {
.withValidator(new StringLengthValidator("", 1, 3))
.bind(BookPerson::getLastName, BookPerson::setLastName);
// no changes
- Assert.assertFalse(saveButton.isEnabled());
- Assert.assertFalse(resetButton.isEnabled());
+ assertFalse(saveButton.isEnabled());
+ assertFalse(resetButton.isEnabled());
verifyEventIsFired(eventIsFired);
BookPerson person = new BookPerson(2000, 1);
binder.readBean(person);
// no changes
- Assert.assertFalse(saveButton.isEnabled());
- Assert.assertFalse(resetButton.isEnabled());
+ assertFalse(saveButton.isEnabled());
+ assertFalse(resetButton.isEnabled());
verifyEventIsFired(eventIsFired);
field.setValue("a");
// binder is not bound, no event fired
// no changes: see #375. There should be a change and enabled state
- Assert.assertTrue(saveButton.isEnabled());
- Assert.assertTrue(resetButton.isEnabled());
- Assert.assertTrue(eventIsFired.get());
+ assertTrue(saveButton.isEnabled());
+ assertTrue(resetButton.isEnabled());
+ assertTrue(eventIsFired.get());
binder.writeBeanIfValid(person);
// no changes
- Assert.assertFalse(saveButton.isEnabled());
- Assert.assertFalse(resetButton.isEnabled());
+ assertFalse(saveButton.isEnabled());
+ assertFalse(resetButton.isEnabled());
verifyEventIsFired(eventIsFired);
binder.validate();
// no changes
- Assert.assertFalse(saveButton.isEnabled());
- Assert.assertFalse(resetButton.isEnabled());
+ assertFalse(saveButton.isEnabled());
+ assertFalse(resetButton.isEnabled());
verifyEventIsFired(eventIsFired);
field.setValue("");
// binder is not bound, no event fired
// no changes: see #375. There should be a change and disabled state for
// save button because of failed validation
- Assert.assertFalse(saveButton.isEnabled());
- Assert.assertTrue(resetButton.isEnabled());
- Assert.assertTrue(eventIsFired.get());
+ assertFalse(saveButton.isEnabled());
+ assertTrue(resetButton.isEnabled());
+ assertTrue(eventIsFired.get());
}
@Test
@@ -799,15 +803,15 @@ public class BinderBookOfVaadinTest {
.withValidator(new StringLengthValidator("", 1, 3))
.bind(BookPerson::getLastName, BookPerson::setLastName);
// no changes
- Assert.assertFalse(saveButton.isEnabled());
- Assert.assertFalse(resetButton.isEnabled());
+ assertFalse(saveButton.isEnabled());
+ assertFalse(resetButton.isEnabled());
verifyEventIsFired(eventIsFired);
BookPerson person = new BookPerson(2000, 1);
binder.setBean(person);
// no changes
- Assert.assertFalse(saveButton.isEnabled());
- Assert.assertFalse(resetButton.isEnabled());
+ assertFalse(saveButton.isEnabled());
+ assertFalse(resetButton.isEnabled());
verifyEventIsFired(eventIsFired);
field.setValue("a");
@@ -816,8 +820,8 @@ public class BinderBookOfVaadinTest {
field.setValue("");
// there are invalid changes
- Assert.assertFalse(saveButton.isEnabled());
- Assert.assertTrue(resetButton.isEnabled());
+ assertFalse(saveButton.isEnabled());
+ assertTrue(resetButton.isEnabled());
verifyEventIsFired(eventIsFired);
// set valid value
@@ -825,8 +829,8 @@ public class BinderBookOfVaadinTest {
verifyEventIsFired(eventIsFired);
binder.writeBeanIfValid(person);
// there are no changes.
- Assert.assertFalse(saveButton.isEnabled());
- Assert.assertFalse(resetButton.isEnabled());
+ assertFalse(saveButton.isEnabled());
+ assertFalse(resetButton.isEnabled());
verifyEventIsFired(eventIsFired);
}
@@ -846,13 +850,13 @@ public class BinderBookOfVaadinTest {
binder.forField(emailField).asRequired("").bind(BookPerson::getEmail,
BookPerson::setEmail);
- Assert.assertFalse(saveButton.isEnabled());
+ assertFalse(saveButton.isEnabled());
field.setValue("not empty");
- Assert.assertFalse(saveButton.isEnabled());
+ assertFalse(saveButton.isEnabled());
emailField.setValue("not empty");
- Assert.assertTrue(saveButton.isEnabled());
+ assertTrue(saveButton.isEnabled());
field.clear();
- Assert.assertFalse(saveButton.isEnabled());
+ assertFalse(saveButton.isEnabled());
}
@Test
@@ -881,7 +885,7 @@ public class BinderBookOfVaadinTest {
}
private void verifyEventIsFired(AtomicBoolean flag) {
- Assert.assertTrue(flag.get());
+ assertTrue(flag.get());
flag.set(false);
}
}
diff --git a/server/src/test/java/com/vaadin/data/BinderComponentTest.java b/server/src/test/java/com/vaadin/data/BinderComponentTest.java
index bf3d1a5074..776816be5e 100644
--- a/server/src/test/java/com/vaadin/data/BinderComponentTest.java
+++ b/server/src/test/java/com/vaadin/data/BinderComponentTest.java
@@ -1,8 +1,9 @@
package com.vaadin.data;
+import static org.junit.Assert.assertEquals;
+
import java.util.Collections;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -66,14 +67,14 @@ public class BinderComponentTest
private <T> void testFieldNullRepresentation(T initialValue,
HasValue<T> field) {
binder.bind(field, t -> null, (str, val) -> {
- Assert.assertEquals("Value update with initial value failed.",
+ assertEquals("Value update with initial value failed.",
initialValue, field.getValue());
});
field.setValue(initialValue);
- Assert.assertEquals("Initial value of field unexpected", initialValue,
+ assertEquals("Initial value of field unexpected", initialValue,
field.getValue());
binder.setBean(item);
- Assert.assertEquals("Null representation for field failed",
+ assertEquals("Null representation for field failed",
field.getEmptyValue(), field.getValue());
field.setValue(initialValue);
}
diff --git a/server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java b/server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java
index 3ab4e962a0..4915bc9a5b 100644
--- a/server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java
+++ b/server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java
@@ -20,12 +20,12 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.Serializable;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -445,7 +445,7 @@ public class BinderConverterValidatorTest
binder.writeBean(person);
} finally {
// Bean should not have been updated
- Assert.assertEquals(firstName, person.getFirstName());
+ assertEquals(firstName, person.getFirstName());
}
}
@@ -463,7 +463,7 @@ public class BinderConverterValidatorTest
binder.writeBean(person);
} finally {
// Bean should have been updated for item validation but reverted
- Assert.assertNull(person.getFirstName());
+ assertNull(person.getFirstName());
}
}
@@ -479,8 +479,8 @@ public class BinderConverterValidatorTest
person.setLastName("bar");
nameField.setValue("foo");
binder.writeBean(person);
- Assert.assertEquals(nameField.getValue(), person.getFirstName());
- Assert.assertEquals("bar", person.getLastName());
+ assertEquals(nameField.getValue(), person.getFirstName());
+ assertEquals("bar", person.getLastName());
}
@Test
@@ -492,8 +492,8 @@ public class BinderConverterValidatorTest
Person person = new Person();
person.setFirstName("foo");
nameField.setValue("");
- Assert.assertFalse(binder.writeBeanIfValid(person));
- Assert.assertEquals("foo", person.getFirstName());
+ assertFalse(binder.writeBeanIfValid(person));
+ assertEquals("foo", person.getFirstName());
}
@Test
@@ -506,8 +506,8 @@ public class BinderConverterValidatorTest
person.setFirstName("foo");
nameField.setValue("bar");
- Assert.assertTrue(binder.writeBeanIfValid(person));
- Assert.assertEquals("bar", person.getFirstName());
+ assertTrue(binder.writeBeanIfValid(person));
+ assertEquals("bar", person.getFirstName());
}
@Test
@@ -524,9 +524,9 @@ public class BinderConverterValidatorTest
Person person = new Person();
person.setFirstName("foo");
nameField.setValue("");
- Assert.assertFalse(binder.writeBeanIfValid(person));
+ assertFalse(binder.writeBeanIfValid(person));
- Assert.assertEquals("foo", person.getFirstName());
+ assertEquals("foo", person.getFirstName());
}
@Test
@@ -549,7 +549,7 @@ public class BinderConverterValidatorTest
binder.writeBean(person);
- Assert.assertNull(person.getFirstName());
+ assertNull(person.getFirstName());
}
@Test
@@ -569,19 +569,18 @@ public class BinderConverterValidatorTest
ageField.setValue("-1");
try {
binder.writeBean(person);
- Assert.fail();
+ fail();
} catch (ValidationException exception) {
List<BindingValidationStatus<?>> validationErrors = exception
.getFieldValidationErrors();
- Assert.assertEquals(2, validationErrors.size());
+ assertEquals(2, validationErrors.size());
BindingValidationStatus<?> error = validationErrors.get(0);
- Assert.assertEquals(nameField, error.getField());
- Assert.assertEquals(msg, error.getMessage().get());
+ assertEquals(nameField, error.getField());
+ assertEquals(msg, error.getMessage().get());
error = validationErrors.get(1);
- Assert.assertEquals(ageField, error.getField());
- Assert.assertEquals(NEGATIVE_ERROR_MESSAGE,
- error.getMessage().get());
+ assertEquals(ageField, error.getField());
+ assertEquals(NEGATIVE_ERROR_MESSAGE, error.getMessage().get());
}
}
@@ -597,28 +596,28 @@ public class BinderConverterValidatorTest
binder.setBean(person);
// initial value is invalid but no error
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
// make error show
nameField.setValue("foo");
nameField.setValue("");
- Assert.assertNotNull(nameField.getComponentError());
+ assertNotNull(nameField.getComponentError());
// bind to another person to see that error is cleared
person = new Person();
person.setFirstName("");
binder.setBean(person);
// error has been cleared
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
// make show error
nameField.setValue("foo");
nameField.setValue("");
- Assert.assertNotNull(nameField.getComponentError());
+ assertNotNull(nameField.getComponentError());
// load should also clear error
binder.readBean(person);
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
// bind a new field that has invalid value in bean
TextField lastNameField = new TextField();
@@ -628,7 +627,7 @@ public class BinderConverterValidatorTest
binding2.bind(Person::getLastName, Person::setLastName);
// should not have error shown
- Assert.assertNull(lastNameField.getComponentError());
+ assertNull(lastNameField.getComponentError());
// add status label to show bean level error
Label statusLabel = new Label();
@@ -636,27 +635,27 @@ public class BinderConverterValidatorTest
nameField.setValue("error");
// no error shown yet because second field validation doesn't pass
- Assert.assertEquals("", statusLabel.getValue());
+ assertEquals("", statusLabel.getValue());
// make second field validation pass to get bean validation error
lastNameField.setValue("foo");
- Assert.assertEquals("error", statusLabel.getValue());
+ assertEquals("error", statusLabel.getValue());
// reload bean to clear error
binder.readBean(person);
- Assert.assertEquals("", statusLabel.getValue());
+ assertEquals("", statusLabel.getValue());
// reset() should clear all errors and status label
nameField.setValue("");
lastNameField.setValue("");
- Assert.assertNotNull(nameField.getComponentError());
- Assert.assertNotNull(lastNameField.getComponentError());
+ assertNotNull(nameField.getComponentError());
+ assertNotNull(lastNameField.getComponentError());
statusLabel.setComponentError(new UserError("ERROR"));
binder.removeBean();
- Assert.assertNull(nameField.getComponentError());
- Assert.assertNull(lastNameField.getComponentError());
- Assert.assertEquals("", statusLabel.getValue());
+ assertNull(nameField.getComponentError());
+ assertNull(lastNameField.getComponentError());
+ assertEquals("", statusLabel.getValue());
}
@Test
@@ -682,18 +681,18 @@ public class BinderConverterValidatorTest
Person person = new Person();
binder.setBean(person);
- Assert.assertNull(nameField.getComponentError());
- Assert.assertNull(lastNameField.getComponentError());
+ assertNull(nameField.getComponentError());
+ assertNull(lastNameField.getComponentError());
nameField.setValue("x");
- Assert.assertNotNull(nameField.getComponentError());
- Assert.assertNotNull(lastNameField.getComponentError());
+ assertNotNull(nameField.getComponentError());
+ assertNotNull(lastNameField.getComponentError());
binder.setBean(person);
- Assert.assertNull(nameField.getComponentError());
- Assert.assertNull(lastNameField.getComponentError());
+ assertNull(nameField.getComponentError());
+ assertNull(lastNameField.getComponentError());
}
protected void bindName() {
@@ -724,7 +723,7 @@ public class BinderConverterValidatorTest
binder.writeBean(person);
} finally {
// Bean should have been updated for item validation but reverted
- Assert.assertEquals(0, person.getAge());
+ assertEquals(0, person.getAge());
}
}
}
diff --git a/server/src/test/java/com/vaadin/data/BinderCustomPropertySetTest.java b/server/src/test/java/com/vaadin/data/BinderCustomPropertySetTest.java
index f9609aa47a..31c48447a6 100644
--- a/server/src/test/java/com/vaadin/data/BinderCustomPropertySetTest.java
+++ b/server/src/test/java/com/vaadin/data/BinderCustomPropertySetTest.java
@@ -15,13 +15,16 @@
*/
package com.vaadin.data;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.server.Setter;
@@ -59,8 +62,8 @@ public class BinderCustomPropertySetTest {
public Class<String> getType() {
return String.class;
}
-
- public Class<?> getPropertyHolderType(){
+
+ public Class<?> getPropertyHolderType() {
return Map.class;
}
@@ -116,7 +119,7 @@ public class BinderCustomPropertySetTest {
binder.setBean(map);
field.setValue("value");
- Assert.assertEquals(
+ assertEquals(
"Field value should propagate to the corresponding key in the map",
"value", map.get("key"));
}
@@ -130,17 +133,17 @@ public class BinderCustomPropertySetTest {
binder.bindInstanceFields(instanceFields);
- Assert.assertNotNull(
+ assertNotNull(
"Field corresponding to supported property name should be bound",
instanceFields.one);
- Assert.assertNull(
+ assertNull(
"Field corresponding to unsupported property name should be ignored",
instanceFields.another);
binder.setBean(map);
instanceFields.one.setValue("value");
- Assert.assertEquals(
+ assertEquals(
"Field value should propagate to the corresponding key in the map",
"value", map.get("one"));
}
diff --git a/server/src/test/java/com/vaadin/data/BinderInstanceFieldTest.java b/server/src/test/java/com/vaadin/data/BinderInstanceFieldTest.java
index 5b2e0a2490..a05f2eaae4 100644
--- a/server/src/test/java/com/vaadin/data/BinderInstanceFieldTest.java
+++ b/server/src/test/java/com/vaadin/data/BinderInstanceFieldTest.java
@@ -15,9 +15,12 @@
*/
package com.vaadin.data;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+
import java.time.LocalDate;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.annotations.PropertyId;
@@ -147,14 +150,14 @@ public class BinderInstanceFieldTest {
binder.setBean(person);
- Assert.assertEquals(person.getFirstName(), form.firstName.getValue());
- Assert.assertEquals(person.getBirthDate(), form.birthDate.getValue());
+ assertEquals(person.getFirstName(), form.firstName.getValue());
+ assertEquals(person.getBirthDate(), form.birthDate.getValue());
form.firstName.setValue("bar");
form.birthDate.setValue(person.getBirthDate().plusDays(345));
- Assert.assertEquals(form.firstName.getValue(), person.getFirstName());
- Assert.assertEquals(form.birthDate.getValue(), person.getBirthDate());
+ assertEquals(form.firstName.getValue(), person.getFirstName());
+ assertEquals(form.birthDate.getValue(), person.getBirthDate());
}
@Test(expected = IllegalStateException.class)
@@ -175,13 +178,13 @@ public class BinderInstanceFieldTest {
binder.setBean(person);
- Assert.assertEquals(person.getFirstName(), form.firstName.getValue());
+ assertEquals(person.getFirstName(), form.firstName.getValue());
- Assert.assertNull(form.noFieldInPerson);
+ assertNull(form.noFieldInPerson);
form.firstName.setValue("bar");
- Assert.assertEquals(form.firstName.getValue(), person.getFirstName());
+ assertEquals(form.firstName.getValue(), person.getFirstName());
}
@Test
@@ -195,7 +198,7 @@ public class BinderInstanceFieldTest {
binder.setBean(person);
- Assert.assertNull(form.firstName);
+ assertNull(form.firstName);
}
@Test
@@ -209,11 +212,11 @@ public class BinderInstanceFieldTest {
binder.setBean(person);
- Assert.assertEquals(person.getFirstName(), form.firstName.getValue());
+ assertEquals(person.getFirstName(), form.firstName.getValue());
form.firstName.setValue("bar");
- Assert.assertEquals(form.firstName.getValue(), person.getFirstName());
+ assertEquals(form.firstName.getValue(), person.getFirstName());
}
@Test(expected = IllegalStateException.class)
@@ -269,11 +272,11 @@ public class BinderInstanceFieldTest {
binder.setBean(person);
- Assert.assertEquals(person.getFirstName(), form.firstName.getValue());
+ assertEquals(person.getFirstName(), form.firstName.getValue());
form.firstName.setValue("bar");
- Assert.assertEquals(form.firstName.getValue(), person.getFirstName());
+ assertEquals(form.firstName.getValue(), person.getFirstName());
}
@Test
@@ -289,7 +292,7 @@ public class BinderInstanceFieldTest {
binder.setBean(person);
- Assert.assertEquals(name, form.firstName);
+ assertEquals(name, form.firstName);
}
@Test
@@ -304,16 +307,14 @@ public class BinderInstanceFieldTest {
binder.setBean(person);
- Assert.assertEquals(person.getFirstName(), form.nameField.getValue());
- Assert.assertEquals(person.getBirthDate(),
- form.birthDateField.getValue());
+ assertEquals(person.getFirstName(), form.nameField.getValue());
+ assertEquals(person.getBirthDate(), form.birthDateField.getValue());
form.nameField.setValue("bar");
form.birthDateField.setValue(person.getBirthDate().plusDays(345));
- Assert.assertEquals(form.nameField.getValue(), person.getFirstName());
- Assert.assertEquals(form.birthDateField.getValue(),
- person.getBirthDate());
+ assertEquals(form.nameField.getValue(), person.getFirstName());
+ assertEquals(form.birthDateField.getValue(), person.getBirthDate());
}
@Test
@@ -337,20 +338,20 @@ public class BinderInstanceFieldTest {
binder.setBean(person);
- Assert.assertEquals(person.getFirstName(), form.firstName.getValue());
- Assert.assertEquals(person.getBirthDate(), form.birthDate.getValue());
+ assertEquals(person.getFirstName(), form.firstName.getValue());
+ assertEquals(person.getBirthDate(), form.birthDate.getValue());
// the instance is not overridden
- Assert.assertEquals(name, form.firstName);
+ assertEquals(name, form.firstName);
// Test automatic binding
form.birthDate.setValue(person.getBirthDate().plusDays(345));
- Assert.assertEquals(form.birthDate.getValue(), person.getBirthDate());
+ assertEquals(form.birthDate.getValue(), person.getBirthDate());
// Test custom binding
form.firstName.setValue("aa");
- Assert.assertEquals(personName, person.getFirstName());
+ assertEquals(personName, person.getFirstName());
- Assert.assertFalse(binder.validate().isOk());
+ assertFalse(binder.validate().isOk());
}
@Test
@@ -380,24 +381,24 @@ public class BinderInstanceFieldTest {
binder.setBean(person);
- Assert.assertEquals(person.getFirstName(), form.firstName.getValue());
- Assert.assertEquals(String.valueOf(person.getAge()),
+ assertEquals(person.getFirstName(), form.firstName.getValue());
+ assertEquals(String.valueOf(person.getAge()),
form.noFieldInPerson.getValue());
// the instances are not overridden
- Assert.assertEquals(name, form.firstName);
- Assert.assertEquals(ageField, form.noFieldInPerson);
+ assertEquals(name, form.firstName);
+ assertEquals(ageField, form.noFieldInPerson);
// Test correct age
age += 56;
form.noFieldInPerson.setValue(String.valueOf(age));
- Assert.assertEquals(form.noFieldInPerson.getValue(),
+ assertEquals(form.noFieldInPerson.getValue(),
String.valueOf(person.getAge()));
// Test incorrect name
form.firstName.setValue("aa");
- Assert.assertEquals(personName, person.getFirstName());
+ assertEquals(personName, person.getFirstName());
- Assert.assertFalse(binder.validate().isOk());
+ assertFalse(binder.validate().isOk());
}
@Test
@@ -415,7 +416,7 @@ public class BinderInstanceFieldTest {
person.setFirstName("first");
person.setAge(45);
binder.setBean(person);
- Assert.assertEquals("90", form.age.getValue());
+ assertEquals("90", form.age.getValue());
}
@Test
diff --git a/server/src/test/java/com/vaadin/data/BinderStatusChangeTest.java b/server/src/test/java/com/vaadin/data/BinderStatusChangeTest.java
index 1ab39ee46f..f2cb147e70 100644
--- a/server/src/test/java/com/vaadin/data/BinderStatusChangeTest.java
+++ b/server/src/test/java/com/vaadin/data/BinderStatusChangeTest.java
@@ -15,9 +15,12 @@
*/
package com.vaadin.data;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import java.util.concurrent.atomic.AtomicReference;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -49,7 +52,7 @@ public class BinderStatusChangeTest
BindingBuilder<Person, String> binding = binder.forField(nameField);
nameField.setValue("");
- Assert.assertNull(event.get());
+ assertNull(event.get());
binding.bind(Person::getFirstName, Person::setFirstName);
verifyEvent();
@@ -59,7 +62,7 @@ public class BinderStatusChangeTest
public void bindBinder_unbound_singleEventWhenBound() {
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.setBean(item);
@@ -72,7 +75,7 @@ public class BinderStatusChangeTest
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.removeBean();
verifyEvent();
}
@@ -81,9 +84,9 @@ public class BinderStatusChangeTest
public void removeBean_unbound_noEventWhenUnBound() {
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.removeBean();
- Assert.assertNull(event.get());
+ assertNull(event.get());
}
@Test
@@ -94,7 +97,7 @@ public class BinderStatusChangeTest
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
nameField.setValue("foo");
verifyEvent();
}
@@ -110,7 +113,7 @@ public class BinderStatusChangeTest
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
nameField.setValue("foo");
verifyEvent();
}
@@ -123,7 +126,7 @@ public class BinderStatusChangeTest
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
nameField.setValue("foo");
verifyEvent(true);
}
@@ -138,7 +141,7 @@ public class BinderStatusChangeTest
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
nameField.setValue("foo");
verifyEvent(true);
}
@@ -148,7 +151,7 @@ public class BinderStatusChangeTest
binder.forField(nameField).bind(Person::getFirstName,
Person::setFirstName);
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.readBean(item);
verifyEvent();
}
@@ -161,7 +164,7 @@ public class BinderStatusChangeTest
.withConverter(new StringToIntegerConverter(""))
.bind(Person::getAge, Person::setAge);
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.readBean(item);
verifyEvent();
}
@@ -169,7 +172,7 @@ public class BinderStatusChangeTest
@Test
public void readBean_hasNoBindings_singleEvent() {
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.readBean(item);
verifyEvent();
}
@@ -178,7 +181,7 @@ public class BinderStatusChangeTest
public void writeBean_hasNoBindings_singleEvent()
throws ValidationException {
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.writeBean(item);
verifyEvent();
}
@@ -186,7 +189,7 @@ public class BinderStatusChangeTest
@Test
public void writeBeanIfValid_hasNoBindings_singleEvent() {
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.writeBeanIfValid(item);
verifyEvent();
}
@@ -198,7 +201,7 @@ public class BinderStatusChangeTest
binder.readBean(item);
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.writeBean(item);
verifyEvent();
}
@@ -214,7 +217,7 @@ public class BinderStatusChangeTest
binder.readBean(item);
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.writeBean(item);
verifyEvent();
}
@@ -226,7 +229,7 @@ public class BinderStatusChangeTest
binder.readBean(item);
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.writeBeanIfValid(item);
verifyEvent();
}
@@ -241,7 +244,7 @@ public class BinderStatusChangeTest
binder.readBean(item);
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.writeBeanIfValid(item);
verifyEvent();
}
@@ -253,7 +256,7 @@ public class BinderStatusChangeTest
binder.readBean(item);
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
try {
binder.writeBean(item);
} catch (ValidationException ignore) {
@@ -268,7 +271,7 @@ public class BinderStatusChangeTest
binder.readBean(item);
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.writeBeanIfValid(item);
verifyEvent(true);
}
@@ -283,7 +286,7 @@ public class BinderStatusChangeTest
binder.readBean(item);
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.writeBeanIfValid(item);
verifyEvent(true);
}
@@ -296,7 +299,7 @@ public class BinderStatusChangeTest
binder.withValidator(Validator.from(person -> false, ""));
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
try {
binder.writeBean(item);
} catch (ValidationException ignore) {
@@ -312,7 +315,7 @@ public class BinderStatusChangeTest
binder.withValidator(Validator.from(person -> false, ""));
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.writeBeanIfValid(item);
verifyEvent(true);
}
@@ -326,7 +329,7 @@ public class BinderStatusChangeTest
binder.withValidator(Validator.from(person -> true, ""));
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.writeBean(item);
verifyEvent();
}
@@ -339,7 +342,7 @@ public class BinderStatusChangeTest
binder.withValidator(Validator.from(person -> true, ""));
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.writeBeanIfValid(item);
verifyEvent();
}
@@ -354,7 +357,7 @@ public class BinderStatusChangeTest
binder.setBean(item);
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.validate();
verifyEvent();
@@ -370,7 +373,7 @@ public class BinderStatusChangeTest
binder.setBean(item);
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.validate();
verifyEvent(true);
@@ -386,7 +389,7 @@ public class BinderStatusChangeTest
binder.setBean(item);
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binding.validate();
verifyEvent();
@@ -403,7 +406,7 @@ public class BinderStatusChangeTest
binder.setBean(item);
binder.addStatusChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binding.validate();
verifyEvent(true);
@@ -415,15 +418,14 @@ public class BinderStatusChangeTest
private void verifyEvent(boolean validationErrors) {
StatusChangeEvent statusChangeEvent = event.get();
- Assert.assertNotNull(statusChangeEvent);
- Assert.assertEquals(binder, statusChangeEvent.getBinder());
- Assert.assertEquals(binder, statusChangeEvent.getSource());
- Assert.assertEquals(validationErrors,
- statusChangeEvent.hasValidationErrors());
+ assertNotNull(statusChangeEvent);
+ assertEquals(binder, statusChangeEvent.getBinder());
+ assertEquals(binder, statusChangeEvent.getSource());
+ assertEquals(validationErrors, statusChangeEvent.hasValidationErrors());
}
private void statusChanged(StatusChangeEvent evt) {
- Assert.assertNull(event.get());
+ assertNull(event.get());
event.set(evt);
}
}
diff --git a/server/src/test/java/com/vaadin/data/BinderTest.java b/server/src/test/java/com/vaadin/data/BinderTest.java
index 36d1692fcb..1169eb8a5d 100644
--- a/server/src/test/java/com/vaadin/data/BinderTest.java
+++ b/server/src/test/java/com/vaadin/data/BinderTest.java
@@ -1,7 +1,9 @@
package com.vaadin.data;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
@@ -12,7 +14,6 @@ import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Stream;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -232,7 +233,7 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
binder.writeBean(person);
- Assert.assertEquals(age, person.getAge());
+ assertEquals(age, person.getAge());
}
@Test
@@ -249,7 +250,7 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
binder.writeBean(person);
- Assert.assertEquals(fieldValue, person.getFirstName());
+ assertEquals(fieldValue, person.getFirstName());
}
@Test
@@ -262,7 +263,7 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
person.setFirstName(name);
binder.readBean(person);
- Assert.assertEquals(name, nameField.getValue());
+ assertEquals(name, nameField.getValue());
}
@Test
@@ -275,7 +276,7 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
person.setFirstName(name);
binder.readBean(person);
- Assert.assertEquals("", nameField.getValue());
+ assertEquals("", nameField.getValue());
}
protected void bindName() {
@@ -296,19 +297,19 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
// Bind a person with null value and check that null representation is
// used
binder.setBean(namelessPerson);
- Assert.assertEquals(
+ assertEquals(
"Null value from bean was not converted to explicit null representation",
nullRepresentation, nameField.getValue());
// Verify that changes are applied to bean
nameField.setValue(realName);
- Assert.assertEquals(
+ assertEquals(
"Bean was not correctly updated from a change in the field",
realName, namelessPerson.getFirstName());
// Verify conversion back to null
nameField.setValue(nullRepresentation);
- Assert.assertEquals(
+ assertEquals(
"Two-way null representation did not change value back to null",
null, namelessPerson.getFirstName());
}
@@ -328,19 +329,19 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
binder.setBean(namelessPerson);
assertTrue(nullTextField.isEmpty());
- Assert.assertEquals(null, namelessPerson.getFirstName());
+ assertEquals(null, namelessPerson.getFirstName());
// Change value, see that textfield is not empty and bean is updated.
nullTextField.setValue("");
assertFalse(nullTextField.isEmpty());
- Assert.assertEquals("First name of person was not properly updated", "",
+ assertEquals("First name of person was not properly updated", "",
namelessPerson.getFirstName());
// Verify that default null representation does not map back to null
nullTextField.setValue("null");
assertTrue(nullTextField.isEmpty());
- Assert.assertEquals("Default one-way null representation failed.",
- "null", namelessPerson.getFirstName());
+ assertEquals("Default one-way null representation failed.", "null",
+ namelessPerson.getFirstName());
}
@Test
@@ -354,8 +355,8 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
Objects.isNull(item.getFirstName()));
binder.setBean(item);
- Assert.assertEquals("Field value was not set correctly",
- item.getFirstName(), nameField.getValue());
+ assertEquals("Field value was not set correctly", item.getFirstName(),
+ nameField.getValue());
}
@Test
@@ -368,12 +369,11 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
.bind(Person::getSalary, Person::setSalary);
binder.setBean(item);
- Assert.assertEquals(customNullConverter.toString(),
- ageField.getValue());
+ assertEquals(customNullConverter.toString(), ageField.getValue());
Integer salary = 11;
ageField.setValue(salary.toString());
- Assert.assertEquals(11, salary.intValue());
+ assertEquals(11, salary.intValue());
}
@Test
@@ -384,7 +384,7 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
Person person = new Person();
binder.setBean(person);
- Assert.assertEquals("", nameField.getValue());
+ assertEquals("", nameField.getValue());
}
@Test
@@ -392,15 +392,15 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
String customNullPointerRepresentation = "foo";
Binder<Person> binder = new Binder<>(Person.class);
binder.forField(nameField)
- .withConverter(value -> value, value -> value == null
- ? customNullPointerRepresentation : value)
+ .withConverter(value -> value,
+ value -> value == null ? customNullPointerRepresentation
+ : value)
.bind("firstName");
Person person = new Person();
binder.setBean(person);
- Assert.assertEquals(customNullPointerRepresentation,
- nameField.getValue());
+ assertEquals(customNullPointerRepresentation, nameField.getValue());
}
@Test
@@ -412,11 +412,11 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
item.setFirstName(null);
binder.setBean(item);
- Assert.assertEquals(nullRepresentation, nameField.getValue());
+ assertEquals(nullRepresentation, nameField.getValue());
String newValue = "bar";
nameField.setValue(newValue);
- Assert.assertEquals(newValue, item.getFirstName());
+ assertEquals(newValue, item.getFirstName());
}
@Test
@@ -432,15 +432,15 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
binding.bind(Person::getFirstName, Person::setFirstName);
binder.setBean(item);
- Assert.assertNull(textField.getErrorMessage());
+ assertNull(textField.getErrorMessage());
textField.setValue(textField.getEmptyValue());
ErrorMessage errorMessage = textField.getErrorMessage();
- Assert.assertNotNull(errorMessage);
- Assert.assertEquals("foobar", errorMessage.getFormattedHtmlMessage());
+ assertNotNull(errorMessage);
+ assertEquals("foobar", errorMessage.getFormattedHtmlMessage());
textField.setValue("value");
- Assert.assertNull(textField.getErrorMessage());
+ assertNull(textField.getErrorMessage());
assertTrue(textField.isRequiredIndicatorVisible());
}
@@ -449,19 +449,19 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
TextField textField = new TextField();
binder.forField(textField).asRequired("foobar")
.bind(Person::getFirstName, Person::setFirstName);
- Assert.assertTrue(textField.isRequiredIndicatorVisible());
- Assert.assertNull(textField.getErrorMessage());
+ assertTrue(textField.isRequiredIndicatorVisible());
+ assertNull(textField.getErrorMessage());
binder.readBean(item);
- Assert.assertNull(textField.getErrorMessage());
+ assertNull(textField.getErrorMessage());
textField.setValue(textField.getEmptyValue());
- Assert.assertTrue(textField.isRequiredIndicatorVisible());
- Assert.assertNotNull(textField.getErrorMessage());
+ assertTrue(textField.isRequiredIndicatorVisible());
+ assertNotNull(textField.getErrorMessage());
binder.readBean(null);
assertTrue(textField.isRequiredIndicatorVisible());
- Assert.assertNull(textField.getErrorMessage());
+ assertNull(textField.getErrorMessage());
}
@Test
@@ -476,25 +476,25 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
binding.asRequired(context -> {
invokes.incrementAndGet();
- Assert.assertSame(Locale.CANADA, context.getLocale().get());
+ assertSame(Locale.CANADA, context.getLocale().get());
return "foobar";
});
assertTrue(textField.isRequiredIndicatorVisible());
binding.bind(Person::getFirstName, Person::setFirstName);
binder.setBean(item);
- Assert.assertNull(textField.getErrorMessage());
- Assert.assertEquals(0, invokes.get());
+ assertNull(textField.getErrorMessage());
+ assertEquals(0, invokes.get());
textField.setValue(textField.getEmptyValue());
ErrorMessage errorMessage = textField.getErrorMessage();
- Assert.assertNotNull(errorMessage);
- Assert.assertEquals("foobar", errorMessage.getFormattedHtmlMessage());
+ assertNotNull(errorMessage);
+ assertEquals("foobar", errorMessage.getFormattedHtmlMessage());
// validation is done for the whole bean at once.
- Assert.assertEquals(1, invokes.get());
+ assertEquals(1, invokes.get());
textField.setValue("value");
- Assert.assertNull(textField.getErrorMessage());
+ assertNull(textField.getErrorMessage());
assertTrue(textField.isRequiredIndicatorVisible());
}
@@ -516,13 +516,13 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
binder.setBean(item);
// setting the bean causes 2:
- Assert.assertEquals(2, invokes.get());
+ assertEquals(2, invokes.get());
lastNameField.setValue("");
- Assert.assertEquals(2, invokes.get());
+ assertEquals(2, invokes.get());
firstNameField.setValue("");
- Assert.assertEquals(3, invokes.get());
+ assertEquals(3, invokes.get());
binder.removeBean();
Person person = new Person();
@@ -530,13 +530,13 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
person.setLastName("a");
binder.readBean(person);
// reading from a bean causes 2:
- Assert.assertEquals(5, invokes.get());
+ assertEquals(5, invokes.get());
lastNameField.setValue("");
- Assert.assertEquals(5, invokes.get());
+ assertEquals(5, invokes.get());
firstNameField.setValue("");
- Assert.assertEquals(6, invokes.get());
+ assertEquals(6, invokes.get());
}
@Test(expected = IllegalStateException.class)
@@ -619,16 +619,16 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
binder.setBean(item);
- Assert.assertTrue(binder.isValid());
+ assertTrue(binder.isValid());
nameField.setValue("fail field validation");
- Assert.assertFalse(binder.isValid());
+ assertFalse(binder.isValid());
nameField.setValue("");
- Assert.assertTrue(binder.isValid());
+ assertTrue(binder.isValid());
nameField.setValue("fail bean validation");
- Assert.assertFalse(binder.isValid());
+ assertFalse(binder.isValid());
}
@Test
@@ -638,13 +638,13 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
name -> !name.equals("fail field validation"), ""))
.bind(Person::getFirstName, Person::setFirstName);
- Assert.assertTrue(binder.isValid());
+ assertTrue(binder.isValid());
nameField.setValue("fail field validation");
- Assert.assertFalse(binder.isValid());
+ assertFalse(binder.isValid());
nameField.setValue("");
- Assert.assertTrue(binder.isValid());
+ assertTrue(binder.isValid());
}
@Test(expected = IllegalStateException.class)
@@ -659,7 +659,7 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
@Test
public void getFields_returnsFields() {
- Assert.assertEquals(0, binder.getFields().count());
+ assertEquals(0, binder.getFields().count());
binder.forField(nameField).bind(Person::getFirstName,
Person::setFirstName);
assertStreamEquals(Stream.of(nameField), binder.getFields());
@@ -670,7 +670,7 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
}
private void assertStreamEquals(Stream<?> s1, Stream<?> s2) {
- Assert.assertArrayEquals(s1.toArray(), s2.toArray());
+ assertArrayEquals(s1.toArray(), s2.toArray());
}
@Test
@@ -691,23 +691,23 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
ageField.setValue("123123");
validation = bind.validate();
- Assert.assertTrue(validation.isError());
- Assert.assertEquals(stringLength, validation.getMessage().get());
+ assertTrue(validation.isError());
+ assertEquals(stringLength, validation.getMessage().get());
ageField.setValue("age");
validation = bind.validate();
- Assert.assertTrue(validation.isError());
- Assert.assertEquals(conversion, validation.getMessage().get());
+ assertTrue(validation.isError());
+ assertEquals(conversion, validation.getMessage().get());
ageField.setValue("256");
validation = bind.validate();
- Assert.assertTrue(validation.isError());
- Assert.assertEquals(ageLimit, validation.getMessage().get());
+ assertTrue(validation.isError());
+ assertEquals(ageLimit, validation.getMessage().get());
ageField.setValue("30");
validation = bind.validate();
- Assert.assertFalse(validation.isError());
- Assert.assertEquals(30, item.getAge());
+ assertFalse(validation.isError());
+ assertEquals(30, item.getAge());
}
@Test
@@ -717,19 +717,19 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
.bind(Person::getAge, Person::setAge);
// Test that the binding does work
- Assert.assertTrue("Field not initially empty", ageField.isEmpty());
+ assertTrue("Field not initially empty", ageField.isEmpty());
binder.setBean(item);
- Assert.assertEquals("Binding did not work",
- String.valueOf(item.getAge()), ageField.getValue());
+ assertEquals("Binding did not work", String.valueOf(item.getAge()),
+ ageField.getValue());
binder.setBean(null);
- Assert.assertTrue("Field not cleared", ageField.isEmpty());
+ assertTrue("Field not cleared", ageField.isEmpty());
// Remove the binding
binder.removeBinding(ageField);
// Test that it does not work anymore
binder.setBean(item);
- Assert.assertNotEquals("Binding was not removed",
+ assertNotEquals("Binding was not removed",
String.valueOf(item.getAge()), ageField.getValue());
}
@@ -741,19 +741,19 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
binder.bind(nameField, "firstName");
// Test that the binding does work
- Assert.assertTrue("Field not initially empty", nameField.isEmpty());
+ assertTrue("Field not initially empty", nameField.isEmpty());
binder.setBean(item);
- Assert.assertEquals("Binding did not work", item.getFirstName(),
+ assertEquals("Binding did not work", item.getFirstName(),
nameField.getValue());
binder.setBean(null);
- Assert.assertTrue("Field not cleared", nameField.isEmpty());
+ assertTrue("Field not cleared", nameField.isEmpty());
// Remove the binding
binder.removeBinding("firstName");
// Test that it does not work anymore
binder.setBean(item);
- Assert.assertNotEquals("Binding was not removed", item.getFirstName(),
+ assertNotEquals("Binding was not removed", item.getFirstName(),
nameField.getValue());
}
@@ -764,19 +764,19 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
.bind(Person::getAge, Person::setAge);
// Test that the binding does work
- Assert.assertTrue("Field not initially empty", ageField.isEmpty());
+ assertTrue("Field not initially empty", ageField.isEmpty());
binder.setBean(item);
- Assert.assertEquals("Binding did not work",
- String.valueOf(item.getAge()), ageField.getValue());
+ assertEquals("Binding did not work", String.valueOf(item.getAge()),
+ ageField.getValue());
binder.setBean(null);
- Assert.assertTrue("Field not cleared", ageField.isEmpty());
+ assertTrue("Field not cleared", ageField.isEmpty());
// Remove the binding
binder.removeBinding(binding);
// Test that it does not work anymore
binder.setBean(item);
- Assert.assertNotEquals("Binding was not removed",
+ assertNotEquals("Binding was not removed",
String.valueOf(item.getAge()), ageField.getValue());
}
@@ -788,38 +788,33 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
item.setLastName("Valid");
binder.setBean(item);
- Assert.assertFalse("Should not have changes initially",
- binder.hasChanges());
- Assert.assertTrue("Should be ok initially", binder.validate().isOk());
- Assert.assertNotEquals(
- "First name and last name are not same initially",
+ assertFalse("Should not have changes initially", binder.hasChanges());
+ assertTrue("Should be ok initially", binder.validate().isOk());
+ assertNotEquals("First name and last name are not same initially",
item.getFirstName(), item.getLastName());
nameField.setValue("Invalid");
- Assert.assertFalse("First name change not handled",
- binder.hasChanges());
- Assert.assertTrue(
+ assertFalse("First name change not handled", binder.hasChanges());
+ assertTrue(
"Changing first name to something else than last name should be ok",
binder.validate().isOk());
lastNameField.setValue("Invalid");
- Assert.assertTrue("Last name should not be saved yet",
- binder.hasChanges());
- Assert.assertFalse(
- "Binder validation should fail with pending illegal value",
+ assertTrue("Last name should not be saved yet", binder.hasChanges());
+ assertFalse("Binder validation should fail with pending illegal value",
binder.validate().isOk());
- Assert.assertNotEquals("Illegal last name should not be stored to bean",
+ assertNotEquals("Illegal last name should not be stored to bean",
item.getFirstName(), item.getLastName());
nameField.setValue("Valid");
- Assert.assertFalse("With new first name both changes should be saved",
+ assertFalse("With new first name both changes should be saved",
binder.hasChanges());
- Assert.assertTrue("Everything should be ok for 'Valid Invalid'",
+ assertTrue("Everything should be ok for 'Valid Invalid'",
binder.validate().isOk());
- Assert.assertNotEquals("First name and last name should never match.",
+ assertNotEquals("First name and last name should never match.",
item.getFirstName(), item.getLastName());
}
@@ -831,8 +826,8 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
item.setLastName(item.getFirstName());
binder.setBean(item);
- Assert.assertFalse(binder.isValid());
- Assert.assertFalse(binder.validate().isOk());
+ assertFalse(binder.isValid());
+ assertFalse(binder.validate().isOk());
}
@Test(expected = IllegalStateException.class)
@@ -842,7 +837,7 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
binder.readBean(item);
- Assert.assertTrue(binder.isValid());
+ assertTrue(binder.isValid());
}
@Test(expected = IllegalStateException.class)
@@ -852,7 +847,7 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
binder.readBean(item);
- Assert.assertTrue(binder.validate().isOk());
+ assertTrue(binder.validate().isOk());
}
protected void setBeanValidationFirstNameNotEqualsLastName(
@@ -876,9 +871,9 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
public void statusChange(BindingValidationStatus<?> statusChange) {
++callCount;
if (expectingError) {
- Assert.assertTrue("Expecting error", statusChange.isError());
+ assertTrue("Expecting error", statusChange.isError());
} else {
- Assert.assertFalse("Unexpected error", statusChange.isError());
+ assertFalse("Unexpected error", statusChange.isError());
}
}
}
@@ -911,20 +906,20 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
// Test default error handling.
ageField.setValue("foo");
- Assert.assertTrue("Component error does not contain error message",
+ assertTrue("Component error does not contain error message",
ageField.getComponentError().getFormattedHtmlMessage()
.contains(ageError));
// Restore values and test no errors.
ageField.setValue(String.valueOf(initialAge));
- Assert.assertNull("There should be no component error",
+ assertNull("There should be no component error",
ageField.getComponentError());
bindingHandler.expectingError = false;
nameField.setValue(initialName);
// Assert that the handler was called.
- Assert.assertEquals(
+ assertEquals(
"Unexpected callCount to binding validation status handler", 6,
bindingHandler.callCount);
}
@@ -944,7 +939,7 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> {
ageField.setValue(modifiedAge);
- Assert.assertEquals("Binding still affects bean even after unbind",
+ assertEquals("Binding still affects bean even after unbind",
ageBeforeUnbind, String.valueOf(item.getAge()));
}
}
diff --git a/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java b/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java
index 6e1f7614bb..dcf568cafc 100644
--- a/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java
+++ b/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java
@@ -15,10 +15,17 @@
*/
package com.vaadin.data;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -51,7 +58,7 @@ public class BinderValidationStatusTest
AtomicReference<BindingValidationStatus<?>> statusCapture = new AtomicReference<>();
BindingBuilder<Person, String> binding = binder.forField(nameField)
.withValidator(notEmpty).withValidationStatusHandler(evt -> {
- Assert.assertNull(statusCapture.get());
+ assertNull(statusCapture.get());
statusCapture.set(evt);
});
binding.bind(Person::getFirstName, Person::setFirstName);
@@ -62,11 +69,11 @@ public class BinderValidationStatusTest
// message
binder.validate();
- Assert.assertNotNull(statusCapture.get());
+ assertNotNull(statusCapture.get());
BindingValidationStatus<?> evt = statusCapture.get();
- Assert.assertEquals(Status.ERROR, evt.getStatus());
- Assert.assertEquals(EMPTY_ERROR_MESSAGE, evt.getMessage().get());
- Assert.assertEquals(nameField, evt.getField());
+ assertEquals(Status.ERROR, evt.getStatus());
+ assertEquals(EMPTY_ERROR_MESSAGE, evt.getMessage().get());
+ assertEquals(nameField, evt.getField());
statusCapture.set(null);
nameField.setValue("foo");
@@ -77,10 +84,10 @@ public class BinderValidationStatusTest
binder.validate();
evt = statusCapture.get();
- Assert.assertNotNull(evt);
- Assert.assertEquals(Status.OK, evt.getStatus());
- Assert.assertFalse(evt.getMessage().isPresent());
- Assert.assertEquals(nameField, evt.getField());
+ assertNotNull(evt);
+ assertEquals(Status.OK, evt.getStatus());
+ assertFalse(evt.getMessage().isPresent());
+ assertEquals(nameField, evt.getField());
}
@Test
@@ -89,7 +96,7 @@ public class BinderValidationStatusTest
.withValidator(notEmpty).withValidationStatusHandler(evt -> {
}).bind(Person::getFirstName, Person::setFirstName);
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
nameField.setValue("");
@@ -98,7 +105,7 @@ public class BinderValidationStatusTest
binding.validate();
// default behavior should update component error for the nameField
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
}
@Test
@@ -115,8 +122,8 @@ public class BinderValidationStatusTest
// message
binding.validate();
- Assert.assertTrue(label.isVisible());
- Assert.assertEquals(EMPTY_ERROR_MESSAGE, label.getValue());
+ assertTrue(label.isVisible());
+ assertEquals(EMPTY_ERROR_MESSAGE, label.getValue());
nameField.setValue("foo");
@@ -124,8 +131,8 @@ public class BinderValidationStatusTest
// no message
binding.validate();
- Assert.assertFalse(label.isVisible());
- Assert.assertEquals("", label.getValue());
+ assertFalse(label.isVisible());
+ assertEquals("", label.getValue());
}
@Test
@@ -136,7 +143,7 @@ public class BinderValidationStatusTest
.withValidator(notEmpty).withStatusLabel(label)
.bind(Person::getFirstName, Person::setFirstName);
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
nameField.setValue("");
@@ -145,7 +152,7 @@ public class BinderValidationStatusTest
binding.validate();
// default behavior should update component error for the nameField
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
}
@Test(expected = IllegalStateException.class)
@@ -154,7 +161,7 @@ public class BinderValidationStatusTest
.withValidator(notEmpty);
binding.bind(Person::getFirstName, Person::setFirstName);
- binding.withValidationStatusHandler(evt -> Assert.fail());
+ binding.withValidationStatusHandler(evt -> fail());
}
@Test(expected = IllegalStateException.class)
@@ -209,20 +216,18 @@ public class BinderValidationStatusTest
AtomicReference<BinderValidationStatus<?>> statusCapture = new AtomicReference<>();
binder.forField(nameField).withValidator(notEmpty)
.withValidationStatusHandler(evt -> {
- Assert.fail(
- "Using a custom status change handler so no change should end up here");
+ fail("Using a custom status change handler so no change should end up here");
}).bind(Person::getFirstName, Person::setFirstName);
binder.forField(ageField).withConverter(stringToInteger)
.withValidator(notNegative).withValidationStatusHandler(evt -> {
- Assert.fail(
- "Using a custom status change handler so no change should end up here");
+ fail("Using a custom status change handler so no change should end up here");
}).bind(Person::getAge, Person::setAge);
binder.setValidationStatusHandler(r -> {
statusCapture.set(r);
});
binder.setBean(item);
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
nameField.setValue("");
ageField.setValue("5");
@@ -231,28 +236,28 @@ public class BinderValidationStatusTest
// and message
BinderValidationStatus<Person> status2 = binder.validate();
BinderValidationStatus<?> status = statusCapture.get();
- Assert.assertSame(status2, status);
+ assertSame(status2, status);
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
List<BindingValidationStatus<?>> bindingStatuses = status
.getFieldValidationStatuses();
- Assert.assertNotNull(bindingStatuses);
- Assert.assertEquals(1, status.getFieldValidationErrors().size());
- Assert.assertEquals(2, bindingStatuses.size());
+ assertNotNull(bindingStatuses);
+ assertEquals(1, status.getFieldValidationErrors().size());
+ assertEquals(2, bindingStatuses.size());
BindingValidationStatus<?> r = bindingStatuses.get(0);
- Assert.assertTrue(r.isError());
- Assert.assertEquals(EMPTY_ERROR_MESSAGE, r.getMessage().get());
- Assert.assertEquals(nameField, r.getField());
+ assertTrue(r.isError());
+ assertEquals(EMPTY_ERROR_MESSAGE, r.getMessage().get());
+ assertEquals(nameField, r.getField());
r = bindingStatuses.get(1);
- Assert.assertFalse(r.isError());
- Assert.assertFalse(r.getMessage().isPresent());
- Assert.assertEquals(ageField, r.getField());
+ assertFalse(r.isError());
+ assertFalse(r.getMessage().isPresent());
+ assertEquals(ageField, r.getField());
- Assert.assertEquals(0, status.getBeanValidationResults().size());
- Assert.assertEquals(0, status.getBeanValidationErrors().size());
+ assertEquals(0, status.getBeanValidationResults().size());
+ assertEquals(0, status.getBeanValidationErrors().size());
nameField.setValue("foo");
ageField.setValue("");
@@ -264,21 +269,21 @@ public class BinderValidationStatusTest
status = statusCapture.get();
bindingStatuses = status.getFieldValidationStatuses();
- Assert.assertEquals(1, status.getFieldValidationErrors().size());
- Assert.assertEquals(2, bindingStatuses.size());
+ assertEquals(1, status.getFieldValidationErrors().size());
+ assertEquals(2, bindingStatuses.size());
r = bindingStatuses.get(0);
- Assert.assertFalse(r.isError());
- Assert.assertFalse(r.getMessage().isPresent());
- Assert.assertEquals(nameField, r.getField());
+ assertFalse(r.isError());
+ assertFalse(r.getMessage().isPresent());
+ assertEquals(nameField, r.getField());
r = bindingStatuses.get(1);
- Assert.assertTrue(r.isError());
- Assert.assertEquals("Value must be a number", r.getMessage().get());
- Assert.assertEquals(ageField, r.getField());
+ assertTrue(r.isError());
+ assertEquals("Value must be a number", r.getMessage().get());
+ assertEquals(ageField, r.getField());
- Assert.assertEquals(0, status.getBeanValidationResults().size());
- Assert.assertEquals(0, status.getBeanValidationErrors().size());
+ assertEquals(0, status.getBeanValidationResults().size());
+ assertEquals(0, status.getBeanValidationErrors().size());
statusCapture.set(null);
// binding validations pass, binder validation fails
@@ -287,11 +292,11 @@ public class BinderValidationStatusTest
status = statusCapture.get();
bindingStatuses = status.getFieldValidationStatuses();
- Assert.assertEquals(0, status.getFieldValidationErrors().size());
- Assert.assertEquals(2, bindingStatuses.size());
+ assertEquals(0, status.getFieldValidationErrors().size());
+ assertEquals(2, bindingStatuses.size());
- Assert.assertEquals(0, status.getBeanValidationResults().size());
- Assert.assertEquals(0, status.getBeanValidationErrors().size());
+ assertEquals(0, status.getBeanValidationResults().size());
+ assertEquals(0, status.getBeanValidationErrors().size());
}
@Test
@@ -299,13 +304,11 @@ public class BinderValidationStatusTest
AtomicReference<BinderValidationStatus<?>> statusCapture = new AtomicReference<>();
binder.forField(nameField).withValidator(notEmpty)
.withValidationStatusHandler(evt -> {
- Assert.fail(
- "Using a custom status change handler so no change should end up here");
+ fail("Using a custom status change handler so no change should end up here");
}).bind(Person::getFirstName, Person::setFirstName);
binder.forField(ageField).withConverter(stringToInteger)
.withValidator(notNegative).withValidationStatusHandler(evt -> {
- Assert.fail(
- "Using a custom status change handler so no change should end up here");
+ fail("Using a custom status change handler so no change should end up here");
}).bind(Person::getAge, Person::setAge);
binder.withValidator(
bean -> !bean.getFirstName().isEmpty() && bean.getAge() > 0,
@@ -315,7 +318,7 @@ public class BinderValidationStatusTest
statusCapture.set(r);
});
binder.setBean(item);
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
nameField.setValue("");
ageField.setValue("5");
@@ -324,28 +327,28 @@ public class BinderValidationStatusTest
// and message
BinderValidationStatus<Person> status2 = binder.validate();
BinderValidationStatus<?> status = statusCapture.get();
- Assert.assertSame(status2, status);
+ assertSame(status2, status);
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
List<BindingValidationStatus<?>> bindingStatuses = status
.getFieldValidationStatuses();
- Assert.assertNotNull(bindingStatuses);
- Assert.assertEquals(1, status.getFieldValidationErrors().size());
- Assert.assertEquals(2, bindingStatuses.size());
+ assertNotNull(bindingStatuses);
+ assertEquals(1, status.getFieldValidationErrors().size());
+ assertEquals(2, bindingStatuses.size());
BindingValidationStatus<?> r = bindingStatuses.get(0);
- Assert.assertTrue(r.isError());
- Assert.assertEquals(EMPTY_ERROR_MESSAGE, r.getMessage().get());
- Assert.assertEquals(nameField, r.getField());
+ assertTrue(r.isError());
+ assertEquals(EMPTY_ERROR_MESSAGE, r.getMessage().get());
+ assertEquals(nameField, r.getField());
r = bindingStatuses.get(1);
- Assert.assertFalse(r.isError());
- Assert.assertFalse(r.getMessage().isPresent());
- Assert.assertEquals(ageField, r.getField());
+ assertFalse(r.isError());
+ assertFalse(r.getMessage().isPresent());
+ assertEquals(ageField, r.getField());
- Assert.assertEquals(0, status.getBeanValidationResults().size());
- Assert.assertEquals(0, status.getBeanValidationErrors().size());
+ assertEquals(0, status.getBeanValidationResults().size());
+ assertEquals(0, status.getBeanValidationErrors().size());
nameField.setValue("foo");
ageField.setValue("");
@@ -357,21 +360,21 @@ public class BinderValidationStatusTest
status = statusCapture.get();
bindingStatuses = status.getFieldValidationStatuses();
- Assert.assertEquals(1, status.getFieldValidationErrors().size());
- Assert.assertEquals(2, bindingStatuses.size());
+ assertEquals(1, status.getFieldValidationErrors().size());
+ assertEquals(2, bindingStatuses.size());
r = bindingStatuses.get(0);
- Assert.assertFalse(r.isError());
- Assert.assertFalse(r.getMessage().isPresent());
- Assert.assertEquals(nameField, r.getField());
+ assertFalse(r.isError());
+ assertFalse(r.getMessage().isPresent());
+ assertEquals(nameField, r.getField());
r = bindingStatuses.get(1);
- Assert.assertTrue(r.isError());
- Assert.assertEquals("Value must be a number", r.getMessage().get());
- Assert.assertEquals(ageField, r.getField());
+ assertTrue(r.isError());
+ assertEquals("Value must be a number", r.getMessage().get());
+ assertEquals(ageField, r.getField());
- Assert.assertEquals(0, status.getBeanValidationResults().size());
- Assert.assertEquals(0, status.getBeanValidationErrors().size());
+ assertEquals(0, status.getBeanValidationResults().size());
+ assertEquals(0, status.getBeanValidationErrors().size());
statusCapture.set(null);
// binding validations pass, binder validation fails
@@ -380,13 +383,13 @@ public class BinderValidationStatusTest
status = statusCapture.get();
bindingStatuses = status.getFieldValidationStatuses();
- Assert.assertEquals(0, status.getFieldValidationErrors().size());
- Assert.assertEquals(2, bindingStatuses.size());
+ assertEquals(0, status.getFieldValidationErrors().size());
+ assertEquals(2, bindingStatuses.size());
- Assert.assertEquals(1, status.getBeanValidationResults().size());
- Assert.assertEquals(1, status.getBeanValidationErrors().size());
+ assertEquals(1, status.getBeanValidationResults().size());
+ assertEquals(1, status.getBeanValidationErrors().size());
- Assert.assertEquals("Need first name and age",
+ assertEquals("Need first name and age",
status.getBeanValidationErrors().get(0).getErrorMessage());
}
@@ -396,7 +399,7 @@ public class BinderValidationStatusTest
.withValidator(notEmpty).withValidationStatusHandler(evt -> {
}).bind(Person::getFirstName, Person::setFirstName);
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
nameField.setValue("");
@@ -405,7 +408,7 @@ public class BinderValidationStatusTest
binding.validate();
// no component error since default handler is replaced
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
}
@Test
@@ -416,7 +419,7 @@ public class BinderValidationStatusTest
.withValidator(notEmpty).withStatusLabel(label)
.bind(Person::getFirstName, Person::setFirstName);
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
nameField.setValue("");
@@ -425,7 +428,7 @@ public class BinderValidationStatusTest
binding.validate();
// default behavior should update component error for the nameField
- Assert.assertNull(nameField.getComponentError());
+ assertNull(nameField.getComponentError());
}
@Test(expected = IllegalStateException.class)
@@ -434,7 +437,7 @@ public class BinderValidationStatusTest
.withValidator(notEmpty);
binding.bind(Person::getFirstName, Person::setFirstName);
- binding.withValidationStatusHandler(evt -> Assert.fail());
+ binding.withValidationStatusHandler(evt -> fail());
}
@Test(expected = IllegalStateException.class)
@@ -487,7 +490,7 @@ public class BinderValidationStatusTest
binding.bind(Person::getFirstName, Person::setFirstName);
binder.setValidationStatusHandler(results -> {
- Assert.fail();
+ fail();
});
binder.setValidationStatusHandler(results -> {
@@ -499,8 +502,8 @@ public class BinderValidationStatusTest
List<BindingValidationStatus<?>> results = capture.get()
.getFieldValidationStatuses();
- Assert.assertNotNull(results);
- Assert.assertEquals(1, results.size());
- Assert.assertFalse(results.get(0).isError());
+ assertNotNull(results);
+ assertEquals(1, results.size());
+ assertFalse(results.get(0).isError());
}
}
diff --git a/server/src/test/java/com/vaadin/data/BinderValueChangeTest.java b/server/src/test/java/com/vaadin/data/BinderValueChangeTest.java
index 985d0cc650..fbe1ee1d1f 100644
--- a/server/src/test/java/com/vaadin/data/BinderValueChangeTest.java
+++ b/server/src/test/java/com/vaadin/data/BinderValueChangeTest.java
@@ -15,9 +15,12 @@
*/
package com.vaadin.data;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import java.util.concurrent.atomic.AtomicReference;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -57,32 +60,32 @@ public class BinderValueChangeTest
BindingBuilder<Person, String> binding = binder.forField(nameField);
nameField.setValue("");
- Assert.assertNull(event.get());
+ assertNull(event.get());
binding.bind(Person::getFirstName, Person::setFirstName);
- Assert.assertNull(event.get());
+ assertNull(event.get());
}
@Test
public void setBean_unbound_noEvents() {
binder.addValueChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.setBean(item);
- Assert.assertNull(event.get());
+ assertNull(event.get());
}
@Test
public void readBean_unbound_noEvents() {
binder.addValueChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
binder.readBean(item);
- Assert.assertNull(event.get());
+ assertNull(event.get());
}
@Test
@@ -95,7 +98,7 @@ public class BinderValueChangeTest
binder.addValueChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
nameField.setValue("foo");
verifyEvent(nameField);
}
@@ -111,7 +114,7 @@ public class BinderValueChangeTest
binder.addValueChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
nameField.setValue("foo");
verifyEvent(nameField);
}
@@ -127,7 +130,7 @@ public class BinderValueChangeTest
binder.addValueChangeListener(this::statusChanged);
- Assert.assertNull(event.get());
+ assertNull(event.get());
field.setValue("foo", true);
verifyEvent(field, true);
}
@@ -143,7 +146,7 @@ public class BinderValueChangeTest
.bind(Person::getAge, Person::setAge);
binder.setBean(item);
- Assert.assertNull(event.get());
+ assertNull(event.get());
ageField.setValue(String.valueOf(1));
verifyEvent(ageField);
}
@@ -154,14 +157,14 @@ public class BinderValueChangeTest
private void verifyEvent(HasValue<?> field, boolean isUserOriginated) {
ValueChangeEvent<?> changeEvent = event.get();
- Assert.assertNotNull(changeEvent);
- Assert.assertEquals(field, changeEvent.getSource());
- Assert.assertEquals(field, changeEvent.getComponent());
- Assert.assertEquals(isUserOriginated, changeEvent.isUserOriginated());
+ assertNotNull(changeEvent);
+ assertEquals(field, changeEvent.getSource());
+ assertEquals(field, changeEvent.getComponent());
+ assertEquals(isUserOriginated, changeEvent.isUserOriginated());
}
private void statusChanged(ValueChangeEvent<?> evt) {
- Assert.assertNull(event.get());
+ assertNull(event.get());
event.set(evt);
}
}
diff --git a/server/src/test/java/com/vaadin/data/HasValueTest.java b/server/src/test/java/com/vaadin/data/HasValueTest.java
index 5f255454c9..5b3a996740 100644
--- a/server/src/test/java/com/vaadin/data/HasValueTest.java
+++ b/server/src/test/java/com/vaadin/data/HasValueTest.java
@@ -15,9 +15,11 @@
*/
package com.vaadin.data;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+
import java.time.LocalDate;
-import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
@@ -58,14 +60,13 @@ public class HasValueTest {
assert nullable.isEmpty();
assert nullable.getValue() == null;
- Assert.assertFalse(nullable.getOptionalValue().isPresent());
+ assertFalse(nullable.getOptionalValue().isPresent());
nullable.setValue(LocalDate.now());
assert !nullable.isEmpty();
- Assert.assertSame(nullable.getValue(),
- nullable.getOptionalValue().get());
+ assertSame(nullable.getValue(), nullable.getOptionalValue().get());
}
@Test
@@ -77,13 +78,13 @@ public class HasValueTest {
assert nonNullable.isEmpty();
assert nonNullable.getValue() != null;
- Assert.assertFalse(nonNullable.getOptionalValue().isPresent());
+ assertFalse(nonNullable.getOptionalValue().isPresent());
nonNullable.setValue("foo");
assert !nonNullable.isEmpty();
- Assert.assertSame(nonNullable.getValue(),
+ assertSame(nonNullable.getValue(),
nonNullable.getOptionalValue().get());
}
}
diff --git a/server/src/test/java/com/vaadin/data/Jsr303Test.java b/server/src/test/java/com/vaadin/data/Jsr303Test.java
index c907bd2af0..7463e0198a 100644
--- a/server/src/test/java/com/vaadin/data/Jsr303Test.java
+++ b/server/src/test/java/com/vaadin/data/Jsr303Test.java
@@ -16,6 +16,8 @@
package com.vaadin.data;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
import java.io.IOException;
import java.io.InputStream;
@@ -26,7 +28,6 @@ import java.net.URLClassLoader;
import javax.validation.Validation;
import org.apache.commons.io.IOUtils;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.util.BeanUtil;
@@ -82,7 +83,7 @@ public class Jsr303Test {
@Override
public void execute() {
- Assert.assertFalse(BeanUtil.checkBeanValidationAvailable());
+ assertFalse(BeanUtil.checkBeanValidationAvailable());
Binder<BeanToValidate> binder = new Binder<>(BeanToValidate.class);
BeanToValidate item = new BeanToValidate();
@@ -102,7 +103,7 @@ public class Jsr303Test {
try {
BeanValidationBinder<BeanToValidate> beanValidationBinder = new BeanValidationBinder<>(
BeanToValidate.class);
- Assert.fail();
+ fail();
} catch (IllegalStateException ignore) {
// an exception has to be thrown
}
diff --git a/server/src/test/java/com/vaadin/data/NotEmptyTest.java b/server/src/test/java/com/vaadin/data/NotEmptyTest.java
index 6b13825455..adda12f71d 100644
--- a/server/src/test/java/com/vaadin/data/NotEmptyTest.java
+++ b/server/src/test/java/com/vaadin/data/NotEmptyTest.java
@@ -15,6 +15,9 @@
*/
package com.vaadin.data;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
@@ -23,7 +26,6 @@ import java.net.URLClassLoader;
import org.apache.commons.io.IOUtils;
import org.hibernate.validator.constraints.NotEmpty;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.tests.data.bean.BeanToValidate;
@@ -82,7 +84,7 @@ public class NotEmptyTest {
try {
Class.forName(NOT_EMPTY);
// The NotEmpty class must not be in the classpath
- Assert.fail();
+ fail();
} catch (ClassNotFoundException e) {
}
BeanValidationBinder<BeanToValidate> binder = new BeanValidationBinder<>(
@@ -96,7 +98,7 @@ public class NotEmptyTest {
binder.bind(nameField, "firstname");
binder.setBean(item);
- Assert.assertTrue(nameField.isRequiredIndicatorVisible());
+ assertTrue(nameField.isRequiredIndicatorVisible());
}
}
diff --git a/server/src/test/java/com/vaadin/data/ResultTest.java b/server/src/test/java/com/vaadin/data/ResultTest.java
index 8f594c1300..69c5a86c04 100644
--- a/server/src/test/java/com/vaadin/data/ResultTest.java
+++ b/server/src/test/java/com/vaadin/data/ResultTest.java
@@ -15,7 +15,11 @@
*/
package com.vaadin.data;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.junit.Test;
import com.vaadin.server.SerializableFunction;
@@ -30,28 +34,28 @@ public class ResultTest {
public void testOk() {
String value = "foo";
Result<String> ok = Result.ok(value);
- Assert.assertFalse(ok.isError());
- Assert.assertFalse(ok.getMessage().isPresent());
- ok.ifOk(v -> Assert.assertEquals(value, v));
- ok.ifError(msg -> Assert.fail());
+ assertFalse(ok.isError());
+ assertFalse(ok.getMessage().isPresent());
+ ok.ifOk(v -> assertEquals(value, v));
+ ok.ifError(msg -> fail());
}
@Test
public void testError() {
String message = "foo";
Result<String> error = Result.error(message);
- Assert.assertTrue(error.isError());
- Assert.assertTrue(error.getMessage().isPresent());
- error.ifOk(v -> Assert.fail());
- error.ifError(msg -> Assert.assertEquals(message, msg));
- Assert.assertEquals(message, error.getMessage().get());
+ assertTrue(error.isError());
+ assertTrue(error.getMessage().isPresent());
+ error.ifOk(v -> fail());
+ error.ifError(msg -> assertEquals(message, msg));
+ assertEquals(message, error.getMessage().get());
}
@Test
public void of_noException() {
Result<String> result = Result.of(() -> "", exception -> null);
- Assert.assertTrue(result instanceof SimpleResult);
- Assert.assertFalse(result.isError());
+ assertTrue(result instanceof SimpleResult);
+ assertFalse(result.isError());
}
@Test
@@ -60,9 +64,9 @@ public class ResultTest {
Result<String> result = Result.of(() -> {
throw new RuntimeException();
}, exception -> message);
- Assert.assertTrue(result instanceof SimpleResult);
- Assert.assertTrue(result.isError());
- Assert.assertEquals(message, result.getMessage().get());
+ assertTrue(result instanceof SimpleResult);
+ assertTrue(result.isError());
+ assertEquals(message, result.getMessage().get());
}
@SuppressWarnings("serial")
@@ -77,12 +81,12 @@ public class ResultTest {
}
};
Result<String> mapResult = result.map(value -> {
- Assert.assertEquals("foo", value);
+ assertEquals("foo", value);
return "bar";
});
- Assert.assertTrue(mapResult instanceof SimpleResult);
- Assert.assertFalse(mapResult.isError());
- mapResult.ifOk(v -> Assert.assertEquals("bar", v));
+ assertTrue(mapResult instanceof SimpleResult);
+ assertFalse(mapResult.isError());
+ mapResult.ifOk(v -> assertEquals("bar", v));
}
@SuppressWarnings("serial")
@@ -97,11 +101,11 @@ public class ResultTest {
}
};
Result<String> mapResult = result.map(value -> {
- Assert.assertEquals("foo", value);
+ assertEquals("foo", value);
return "somevalue";
});
- Assert.assertTrue(mapResult instanceof SimpleResult);
- Assert.assertTrue(mapResult.isError());
- mapResult.ifError(msg -> Assert.assertEquals("bar", msg));
+ assertTrue(mapResult instanceof SimpleResult);
+ assertTrue(mapResult.isError());
+ mapResult.ifError(msg -> assertEquals("bar", msg));
}
}
diff --git a/server/src/test/java/com/vaadin/data/ValidatorTest.java b/server/src/test/java/com/vaadin/data/ValidatorTest.java
index 75ac1fcf5a..7d29b6941e 100644
--- a/server/src/test/java/com/vaadin/data/ValidatorTest.java
+++ b/server/src/test/java/com/vaadin/data/ValidatorTest.java
@@ -15,10 +15,12 @@
*/
package com.vaadin.data;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.Locale;
import java.util.Objects;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.validator.ValidatorTestBase;
@@ -33,7 +35,7 @@ public class ValidatorTest extends ValidatorTestBase {
public void alwaysPass() {
Validator<String> alwaysPass = Validator.alwaysPass();
ValidationResult result = alwaysPass.apply("foo", new ValueContext());
- Assert.assertFalse(result.isError());
+ assertFalse(result.isError());
}
@Test
@@ -41,10 +43,10 @@ public class ValidatorTest extends ValidatorTestBase {
Validator<String> validator = Validator.from(Objects::nonNull,
"Cannot be null");
ValidationResult result = validator.apply(null, new ValueContext());
- Assert.assertTrue(result.isError());
+ assertTrue(result.isError());
result = validator.apply("", new ValueContext());
- Assert.assertFalse(result.isError());
+ assertFalse(result.isError());
}
@Test
diff --git a/server/src/test/java/com/vaadin/data/ValueContextTest.java b/server/src/test/java/com/vaadin/data/ValueContextTest.java
index b96f7463cb..9dd0e90b69 100644
--- a/server/src/test/java/com/vaadin/data/ValueContextTest.java
+++ b/server/src/test/java/com/vaadin/data/ValueContextTest.java
@@ -1,14 +1,15 @@
package com.vaadin.data;
+import static org.junit.Assert.assertEquals;
+
import java.util.Locale;
import java.util.Objects;
-import com.vaadin.ui.CheckBox;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.CheckBox;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
@@ -24,8 +25,8 @@ public class ValueContextTest extends UI {
ValueContext fromComponent = new ValueContext(textField);
Locale locale = fromComponent.getLocale().orElse(null);
Objects.requireNonNull(locale);
- Assert.assertEquals("Unexpected locale from component",
- COMPONENT_LOCALE, locale);
+ assertEquals("Unexpected locale from component", COMPONENT_LOCALE,
+ locale);
}
@Test
@@ -33,8 +34,7 @@ public class ValueContextTest extends UI {
ValueContext fromComponent = new ValueContext(textField);
Locale locale = fromComponent.getLocale().orElse(null);
Objects.requireNonNull(locale);
- Assert.assertEquals("Unexpected locale from component", UI_LOCALE,
- locale);
+ assertEquals("Unexpected locale from component", UI_LOCALE, locale);
}
@Test
@@ -43,30 +43,32 @@ public class ValueContextTest extends UI {
ValueContext fromComponent = new ValueContext(textField);
Locale locale = fromComponent.getLocale().orElse(null);
Objects.requireNonNull(locale);
- Assert.assertEquals("Unexpected locale from component",
- Locale.getDefault(), locale);
+ assertEquals("Unexpected locale from component", Locale.getDefault(),
+ locale);
}
@Test
public void testHasValue1() {
setLocale(null);
ValueContext fromComponent = new ValueContext(textField);
- Assert.assertEquals(textField, fromComponent.getHasValue().get());
+ assertEquals(textField, fromComponent.getHasValue().get());
}
@Test
public void testHasValue2() {
setLocale(null);
- ValueContext fromComponent = new ValueContext(new CheckBox(), textField);
- Assert.assertEquals(textField, fromComponent.getHasValue().get());
+ ValueContext fromComponent = new ValueContext(new CheckBox(),
+ textField);
+ assertEquals(textField, fromComponent.getHasValue().get());
}
@Test
public void testHasValue3() {
setLocale(null);
- ValueContext fromComponent = new ValueContext(new CheckBox(), textField, Locale.CANADA);
- Assert.assertEquals(textField, fromComponent.getHasValue().get());
- Assert.assertEquals(Locale.CANADA, fromComponent.getLocale().get());
+ ValueContext fromComponent = new ValueContext(new CheckBox(), textField,
+ Locale.CANADA);
+ assertEquals(textField, fromComponent.getHasValue().get());
+ assertEquals(Locale.CANADA, fromComponent.getLocale().get());
}
@Before
diff --git a/server/src/test/java/com/vaadin/data/provider/AbstractDataProviderTest.java b/server/src/test/java/com/vaadin/data/provider/AbstractDataProviderTest.java
index 3cd368944d..6e94d94b50 100644
--- a/server/src/test/java/com/vaadin/data/provider/AbstractDataProviderTest.java
+++ b/server/src/test/java/com/vaadin/data/provider/AbstractDataProviderTest.java
@@ -15,10 +15,13 @@
*/
package com.vaadin.data.provider;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Stream;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.shared.Registration;
@@ -53,12 +56,12 @@ public class AbstractDataProviderTest {
TestDataProvider dataProvider = new TestDataProvider();
AtomicReference<DataChangeEvent<Object>> event = new AtomicReference<>();
dataProvider.addDataProviderListener(ev -> {
- Assert.assertNull(event.get());
+ assertNull(event.get());
event.set(ev);
});
dataProvider.refreshAll();
- Assert.assertNotNull(event.get());
- Assert.assertEquals(dataProvider, event.get().getSource());
+ assertNotNull(event.get());
+ assertEquals(dataProvider, event.get().getSource());
}
@Test
@@ -69,6 +72,6 @@ public class AbstractDataProviderTest {
.addDataProviderListener(ev -> event.set(ev));
registration.remove();
dataProvider.refreshAll();
- Assert.assertNull(event.get());
+ assertNull(event.get());
}
}
diff --git a/server/src/test/java/com/vaadin/data/provider/ConfigurableFilterDataProviderWrapperTest.java b/server/src/test/java/com/vaadin/data/provider/ConfigurableFilterDataProviderWrapperTest.java
index b2be27bd8d..5d31dcb150 100644
--- a/server/src/test/java/com/vaadin/data/provider/ConfigurableFilterDataProviderWrapperTest.java
+++ b/server/src/test/java/com/vaadin/data/provider/ConfigurableFilterDataProviderWrapperTest.java
@@ -15,7 +15,8 @@
*/
package com.vaadin.data.provider;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
import com.vaadin.data.provider.BackendDataProviderTest.StrBeanBackEndDataProvider;
@@ -48,12 +49,12 @@ public class ConfigurableFilterDataProviderWrapperTest {
public void void_setFilter() {
configurableVoid.setFilter(xyzFilter);
- Assert.assertEquals("Set filter should be used", 1,
+ assertEquals("Set filter should be used", 1,
configurableVoid.size(new Query<>()));
configurableVoid.setFilter(null);
- Assert.assertEquals("null filter should return all items", 100,
+ assertEquals("null filter should return all items", 100,
configurableVoid.size(new Query<>()));
}
@@ -68,21 +69,21 @@ public class ConfigurableFilterDataProviderWrapperTest {
public void predicate_setFilter() {
configurablePredicate.setFilter(Integer.valueOf(50));
- Assert.assertEquals("Set filter should be used", 49,
+ assertEquals("Set filter should be used", 49,
configurablePredicate.size(new Query<>()));
configurablePredicate.setFilter(null);
- Assert.assertEquals("null filter should return all items", 100,
+ assertEquals("null filter should return all items", 100,
configurablePredicate.size(new Query<>()));
}
@Test
public void predicate_queryFilter() {
- Assert.assertEquals("Query filter should be used", 1,
+ assertEquals("Query filter should be used", 1,
configurablePredicate.size(new Query<>("Xyz")));
- Assert.assertEquals("null query filter should return all items", 100,
+ assertEquals("null query filter should return all items", 100,
configurablePredicate.size(new Query<>()));
}
@@ -90,12 +91,12 @@ public class ConfigurableFilterDataProviderWrapperTest {
public void predicate_combinedFilters() {
configurablePredicate.setFilter(Integer.valueOf(50));
- Assert.assertEquals("Both filters should be used", 0,
+ assertEquals("Both filters should be used", 0,
configurablePredicate.size(new Query<>("Xyz")));
configurablePredicate.setFilter(null);
- Assert.assertEquals("Only zyz filter should be used", 1,
+ assertEquals("Only zyz filter should be used", 1,
configurablePredicate.size(new Query<>("Xyz")));
}
diff --git a/server/src/test/java/com/vaadin/data/provider/DataCommunicatorTest.java b/server/src/test/java/com/vaadin/data/provider/DataCommunicatorTest.java
index 53913325a5..d3b4add32b 100644
--- a/server/src/test/java/com/vaadin/data/provider/DataCommunicatorTest.java
+++ b/server/src/test/java/com/vaadin/data/provider/DataCommunicatorTest.java
@@ -15,12 +15,13 @@
*/
package com.vaadin.data.provider;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.Collections;
import java.util.concurrent.Future;
-import elemental.json.Json;
-import elemental.json.JsonArray;
-import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
@@ -31,10 +32,10 @@ import com.vaadin.server.VaadinSession;
import com.vaadin.shared.Registration;
import com.vaadin.ui.UI;
+import elemental.json.Json;
+import elemental.json.JsonArray;
import elemental.json.JsonObject;
-import static org.junit.Assert.assertFalse;
-
/**
* @author Vaadin Ltd
*
@@ -134,7 +135,7 @@ public class DataCommunicatorTest {
communicator.extend(ui);
- Assert.assertTrue(dataProvider.isListenerAdded());
+ assertTrue(dataProvider.isListenerAdded());
}
@Test
@@ -150,7 +151,7 @@ public class DataCommunicatorTest {
communicator.extend(ui);
- Assert.assertTrue(dataProvider.isListenerAdded());
+ assertTrue(dataProvider.isListenerAdded());
communicator.detach();
@@ -174,25 +175,25 @@ public class DataCommunicatorTest {
// Generate initial data.
communicator.beforeClientResponse(true);
- Assert.assertEquals("DataGenerator generate was not called",
- TEST_OBJECT, generator.generated);
+ assertEquals("DataGenerator generate was not called", TEST_OBJECT,
+ generator.generated);
generator.generated = null;
// Make sure data does not get re-generated
communicator.beforeClientResponse(false);
- Assert.assertEquals("DataGenerator generate was called again", null,
+ assertEquals("DataGenerator generate was called again", null,
generator.generated);
// Refresh a data object to trigger an update.
dataProvider.refreshItem(TEST_OBJECT);
- Assert.assertEquals("DataGenerator refresh was not called", TEST_OBJECT,
+ assertEquals("DataGenerator refresh was not called", TEST_OBJECT,
generator.refreshed);
// Test refreshed data generation
communicator.beforeClientResponse(false);
- Assert.assertEquals("DataGenerator generate was not called",
- TEST_OBJECT, generator.generated);
+ assertEquals("DataGenerator generate was not called", TEST_OBJECT,
+ generator.generated);
}
@Test
@@ -213,7 +214,8 @@ public class DataCommunicatorTest {
keys.set(0, key);
communicator.onDropRows(keys);
// Replace everything
- communicator.setDataProvider(new ListDataProvider<>(Collections.singleton(new Object())));
+ communicator.setDataProvider(
+ new ListDataProvider<>(Collections.singleton(new Object())));
// The communicator does not have to throw exceptions during
// request finalization
communicator.beforeClientResponse(false);
diff --git a/server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java b/server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java
index 2fea57ae80..20513674d9 100644
--- a/server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java
+++ b/server/src/test/java/com/vaadin/data/provider/DataProviderTestBase.java
@@ -1,5 +1,7 @@
package com.vaadin.data.provider;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import java.util.Comparator;
@@ -7,7 +9,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -87,16 +88,15 @@ public abstract class DataProviderTestBase<D extends DataProvider<StrBean, Seria
.collect(Collectors.toList());
// First value in data is { Xyz, 10, 100 } which should be last in list
- Assert.assertNotEquals("First value should not match", data.get(0),
+ assertNotEquals("First value should not match", data.get(0),
list.get(0));
- Assert.assertEquals("Sorted data and original data sizes don't match",
+ assertEquals("Sorted data and original data sizes don't match",
data.size(), list.size());
data.sort(comp);
for (int i = 0; i < data.size(); ++i) {
- Assert.assertEquals("Sorting result differed", data.get(i),
- list.get(i));
+ assertEquals("Sorting result differed", data.get(i), list.get(i));
}
}
@@ -111,24 +111,23 @@ public abstract class DataProviderTestBase<D extends DataProvider<StrBean, Seria
Comparator.comparing(StrBean::getRandomNumber)))
.collect(Collectors.toList());
- Assert.assertEquals("Sorted data and original data sizes don't match",
+ assertEquals("Sorted data and original data sizes don't match",
data.size(), list.size());
for (int i = 1; i < list.size(); ++i) {
StrBean prev = list.get(i - 1);
StrBean cur = list.get(i);
// Test specific sort
- Assert.assertTrue(
+ assertTrue(
"Failure: " + prev.getRandomNumber() + " > "
+ cur.getRandomNumber(),
prev.getRandomNumber() <= cur.getRandomNumber());
if (prev.getRandomNumber() == cur.getRandomNumber()) {
// Test default sort
- Assert.assertTrue(
- prev.getValue().compareTo(cur.getValue()) <= 0);
+ assertTrue(prev.getValue().compareTo(cur.getValue()) <= 0);
if (prev.getValue().equals(cur.getValue())) {
- Assert.assertTrue(prev.getId() > cur.getId());
+ assertTrue(prev.getId() > cur.getId());
}
}
}
@@ -142,7 +141,7 @@ public abstract class DataProviderTestBase<D extends DataProvider<StrBean, Seria
List<StrBean> list = dataProvider.fetch(new Query<>())
.collect(Collectors.toList());
- Assert.assertEquals("Sorted data and original data sizes don't match",
+ assertEquals("Sorted data and original data sizes don't match",
data.size(), list.size());
for (int i = 1; i < list.size(); ++i) {
@@ -150,7 +149,7 @@ public abstract class DataProviderTestBase<D extends DataProvider<StrBean, Seria
StrBean cur = list.get(i);
// Test default sort
- Assert.assertTrue(prev.getValue().compareTo(cur.getValue()) <= 0);
+ assertTrue(prev.getValue().compareTo(cur.getValue()) <= 0);
}
}
@@ -159,25 +158,24 @@ public abstract class DataProviderTestBase<D extends DataProvider<StrBean, Seria
DataProvider<StrBean, String> strFilterDataProvider = dataProvider
.withConvertedFilter(
text -> strBean -> strBean.getValue().contains(text));
- Assert.assertEquals("Only one item should match 'Xyz'", 1,
+ assertEquals("Only one item should match 'Xyz'", 1,
strFilterDataProvider.size(new Query<>("Xyz")));
- Assert.assertEquals("No item should match 'Zyx'", 0,
+ assertEquals("No item should match 'Zyx'", 0,
strFilterDataProvider.size(new Query<>("Zyx")));
- Assert.assertEquals("Unexpected number of matches for 'Foo'", 36,
+ assertEquals("Unexpected number of matches for 'Foo'", 36,
strFilterDataProvider.size(new Query<>("Foo")));
- Assert.assertEquals("No items should've been filtered out", data.size(),
+ assertEquals("No items should've been filtered out", data.size(),
strFilterDataProvider.size(new Query<>()));
}
@Test
public void filteringListDataProvider_defaultFilterType() {
- Assert.assertEquals("Only one item should match 'Xyz'", 1,
- dataProvider.size(new Query<>(
- strBean -> strBean.getValue().contains("Xyz"))));
- Assert.assertEquals("No item should match 'Zyx'", 0, dataProvider.size(
+ assertEquals("Only one item should match 'Xyz'", 1, dataProvider.size(
+ new Query<>(strBean -> strBean.getValue().contains("Xyz"))));
+ assertEquals("No item should match 'Zyx'", 0, dataProvider.size(
new Query<>(strBean -> strBean.getValue().contains("Zyx"))));
- Assert.assertEquals("Unexpected number of matches for 'Foo'", 36,
+ assertEquals("Unexpected number of matches for 'Foo'", 36,
dataProvider.size(new Query<>(fooFilter)));
}
@@ -187,8 +185,7 @@ public abstract class DataProviderTestBase<D extends DataProvider<StrBean, Seria
protected static <F> void assertSizeWithFilter(int expectedSize,
DataProvider<?, F> dataProvider, F filterValue) {
- Assert.assertEquals(expectedSize,
- dataProvider.size(new Query<>(filterValue)));
+ assertEquals(expectedSize, dataProvider.size(new Query<>(filterValue)));
}
}
diff --git a/server/src/test/java/com/vaadin/data/provider/ListDataProviderTest.java b/server/src/test/java/com/vaadin/data/provider/ListDataProviderTest.java
index 1ffa444f50..8b1792689a 100644
--- a/server/src/test/java/com/vaadin/data/provider/ListDataProviderTest.java
+++ b/server/src/test/java/com/vaadin/data/provider/ListDataProviderTest.java
@@ -1,11 +1,14 @@
package com.vaadin.data.provider;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.server.SerializableComparator;
@@ -28,7 +31,7 @@ public class ListDataProviderTest
int[] threeFirstIds = dataProvider.fetch(new Query<>())
.mapToInt(StrBean::getId).limit(3).toArray();
- Assert.assertArrayEquals(new int[] { 0, 1, 2 }, threeFirstIds);
+ assertArrayEquals(new int[] { 0, 1, 2 }, threeFirstIds);
}
@Test
@@ -40,7 +43,7 @@ public class ListDataProviderTest
int[] threeFirstIds = dataProvider.fetch(new Query<>())
.mapToInt(StrBean::getId).limit(3).toArray();
- Assert.assertArrayEquals(new int[] { 98, 97, 96 }, threeFirstIds);
+ assertArrayEquals(new int[] { 98, 97, 96 }, threeFirstIds);
}
@Test
@@ -54,54 +57,51 @@ public class ListDataProviderTest
.limit(3).collect(Collectors.toList());
// First one is Xyz
- Assert.assertEquals(new StrBean("Xyz", 10, 100),
- threeFirstItems.get(0));
+ assertEquals(new StrBean("Xyz", 10, 100), threeFirstItems.get(0));
// The following are Foos ordered by id
- Assert.assertEquals(new StrBean("Foo", 93, 2), threeFirstItems.get(1));
- Assert.assertEquals(new StrBean("Foo", 91, 2), threeFirstItems.get(2));
+ assertEquals(new StrBean("Foo", 93, 2), threeFirstItems.get(1));
+ assertEquals(new StrBean("Foo", 91, 2), threeFirstItems.get(2));
}
@Test
public void setFilter() {
dataProvider.setFilter(item -> item.getValue().equals("Foo"));
- Assert.assertEquals(36, sizeWithUnfilteredQuery());
+ assertEquals(36, sizeWithUnfilteredQuery());
dataProvider.setFilter(item -> !item.getValue().equals("Foo"));
- Assert.assertEquals(
- "Previous filter should be reset when setting a new one", 64,
- sizeWithUnfilteredQuery());
+ assertEquals("Previous filter should be reset when setting a new one",
+ 64, sizeWithUnfilteredQuery());
dataProvider.setFilter(null);
- Assert.assertEquals("Setting filter to null should remove all filters",
- 100, sizeWithUnfilteredQuery());
+ assertEquals("Setting filter to null should remove all filters", 100,
+ sizeWithUnfilteredQuery());
}
@Test
public void setFilter_valueProvider() {
dataProvider.setFilter(StrBean::getValue, "Foo"::equals);
- Assert.assertEquals(36, sizeWithUnfilteredQuery());
+ assertEquals(36, sizeWithUnfilteredQuery());
dataProvider.setFilter(StrBean::getValue,
value -> !value.equals("Foo"));
- Assert.assertEquals(
- "Previous filter should be reset when setting a new one", 64,
- sizeWithUnfilteredQuery());
+ assertEquals("Previous filter should be reset when setting a new one",
+ 64, sizeWithUnfilteredQuery());
}
@Test
public void setFilterEquals() {
dataProvider.setFilterByValue(StrBean::getValue, "Foo");
- Assert.assertEquals(36, sizeWithUnfilteredQuery());
+ assertEquals(36, sizeWithUnfilteredQuery());
dataProvider.setFilterByValue(StrBean::getValue, "Bar");
- Assert.assertEquals(23, sizeWithUnfilteredQuery());
+ assertEquals(23, sizeWithUnfilteredQuery());
}
@Test
@@ -110,7 +110,7 @@ public class ListDataProviderTest
dataProvider.addFilter(item -> item.getId() > 50);
- Assert.assertEquals("Both filters should be used", 17,
+ assertEquals("Both filters should be used", 17,
sizeWithUnfilteredQuery());
}
@@ -118,7 +118,7 @@ public class ListDataProviderTest
public void addFilter_noPreviousFilter() {
dataProvider.addFilter(item -> item.getId() > 50);
- Assert.assertEquals(48, sizeWithUnfilteredQuery());
+ assertEquals(48, sizeWithUnfilteredQuery());
}
@Test
@@ -127,7 +127,7 @@ public class ListDataProviderTest
dataProvider.addFilter(StrBean::getValue, "Foo"::equals);
- Assert.assertEquals("Both filters should be used", 17,
+ assertEquals("Both filters should be used", 17,
sizeWithUnfilteredQuery());
}
@@ -137,7 +137,7 @@ public class ListDataProviderTest
dataProvider.addFilterByValue(StrBean::getValue, "Foo");
- Assert.assertEquals("Both filters should be used", 17,
+ assertEquals("Both filters should be used", 17,
sizeWithUnfilteredQuery());
}
@@ -145,11 +145,11 @@ public class ListDataProviderTest
public void addFilter_firstAddedUsedFirst() {
dataProvider.addFilter(item -> false);
dataProvider.addFilter(item -> {
- Assert.fail("This filter should never be invoked");
+ fail("This filter should never be invoked");
return true;
});
- Assert.assertEquals(0, sizeWithUnfilteredQuery());
+ assertEquals(0, sizeWithUnfilteredQuery());
}
@Test
@@ -158,7 +158,7 @@ public class ListDataProviderTest
int size = dataProvider.size(new Query<>(item -> item.getId() > 50));
- Assert.assertEquals("Both filters should be used", 17, size);
+ assertEquals("Both filters should be used", 17, size);
}
@Test
@@ -166,11 +166,11 @@ public class ListDataProviderTest
dataProvider.setFilter(item -> false);
int size = dataProvider.size(new Query<>(item -> {
- Assert.fail("This filter should never be invoked");
+ fail("This filter should never be invoked");
return true;
}));
- Assert.assertEquals(0, size);
+ assertEquals(0, size);
}
@Test
diff --git a/server/src/test/java/com/vaadin/data/provider/ReplaceListDataProviderTest.java b/server/src/test/java/com/vaadin/data/provider/ReplaceListDataProviderTest.java
index 5c7448d17e..d2181fdb34 100644
--- a/server/src/test/java/com/vaadin/data/provider/ReplaceListDataProviderTest.java
+++ b/server/src/test/java/com/vaadin/data/provider/ReplaceListDataProviderTest.java
@@ -1,9 +1,13 @@
package com.vaadin.data.provider;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
import java.util.ArrayList;
import java.util.Arrays;
-import org.junit.Assert;
import org.junit.Test;
/**
@@ -21,13 +25,13 @@ public class ReplaceListDataProviderTest {
public void testGetIdOfItem() {
Object id = dataProvider.fetch(new Query<>()).findFirst()
.map(dataProvider::getId).get();
- Assert.assertEquals("DataProvider not using correct identifier getter",
+ assertEquals("DataProvider not using correct identifier getter",
TEST_OBJECT.getId(), id);
}
@Test
public void testGetIdOfReplacementItem() {
- Assert.assertFalse("Test object was stale before making any changes.",
+ assertFalse("Test object was stale before making any changes.",
dataProvider.isStale(TEST_OBJECT));
dataProvider.refreshItem(new StrBean("Replacement TestObject", 10, -2));
@@ -36,13 +40,13 @@ public class ReplaceListDataProviderTest {
.get();
Object id = dataProvider.getId(fromDataProvider);
- Assert.assertNotEquals("DataProvider did not return the replacement",
+ assertNotEquals("DataProvider did not return the replacement",
TEST_OBJECT, fromDataProvider);
- Assert.assertEquals("DataProvider not using correct identifier getter",
+ assertEquals("DataProvider not using correct identifier getter",
TEST_OBJECT.getId(), id);
- Assert.assertTrue("Old test object should be stale",
+ assertTrue("Old test object should be stale",
dataProvider.isStale(TEST_OBJECT));
}
}
diff --git a/server/src/test/java/com/vaadin/data/provider/SortOrderBuildersTest.java b/server/src/test/java/com/vaadin/data/provider/SortOrderBuildersTest.java
index e289686040..7939217969 100644
--- a/server/src/test/java/com/vaadin/data/provider/SortOrderBuildersTest.java
+++ b/server/src/test/java/com/vaadin/data/provider/SortOrderBuildersTest.java
@@ -1,10 +1,11 @@
package com.vaadin.data.provider;
+import static org.junit.Assert.assertEquals;
+
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.shared.data.sort.SortDirection;
@@ -55,12 +56,11 @@ public class SortOrderBuildersTest {
private <T extends SortOrder<?>> void verifySortOrders(List<T> order1,
List<T> order2) {
- Assert.assertEquals(order1.size(), order2.size());
+ assertEquals(order1.size(), order2.size());
for (int i = 0; i < order1.size(); i++) {
- Assert.assertEquals(order1.get(i).getDirection(),
+ assertEquals(order1.get(i).getDirection(),
order2.get(i).getDirection());
- Assert.assertEquals(order1.get(i).getSorted(),
- order1.get(i).getSorted());
+ assertEquals(order1.get(i).getSorted(), order1.get(i).getSorted());
}
}
}
diff --git a/server/src/test/java/com/vaadin/data/provider/TreeDataProviderTest.java b/server/src/test/java/com/vaadin/data/provider/TreeDataProviderTest.java
index 87b3ec0715..7d5f1c0909 100644
--- a/server/src/test/java/com/vaadin/data/provider/TreeDataProviderTest.java
+++ b/server/src/test/java/com/vaadin/data/provider/TreeDataProviderTest.java
@@ -1,5 +1,10 @@
package com.vaadin.data.provider;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
@@ -7,7 +12,6 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.TreeData;
@@ -64,78 +68,78 @@ public class TreeDataProviderTest
@Test
public void treeData_remove_root_item() {
data.removeItem(null);
- Assert.assertTrue(data.getChildren(null).isEmpty());
+ assertTrue(data.getChildren(null).isEmpty());
}
@Test
public void treeData_clear() {
data.clear();
- Assert.assertTrue(data.getChildren(null).isEmpty());
+ assertTrue(data.getChildren(null).isEmpty());
}
@Test
public void treeData_re_add_removed_item() {
StrBean item = rootData.get(0);
data.removeItem(item).addItem(null, item);
- Assert.assertTrue(data.getChildren(null).contains(item));
+ assertTrue(data.getChildren(null).contains(item));
}
@Test
public void treeData_get_parent() {
StrBean root = rootData.get(0);
StrBean firstChild = data.getChildren(root).get(0);
- Assert.assertNull(data.getParent(root));
- Assert.assertEquals(root, data.getParent(firstChild));
+ assertNull(data.getParent(root));
+ assertEquals(root, data.getParent(firstChild));
}
@Test
public void treeData_set_parent() {
StrBean item1 = rootData.get(0);
StrBean item2 = rootData.get(1);
- Assert.assertEquals(0, data.getChildren(item2).size());
- Assert.assertEquals(10, data.getRootItems().size());
+ assertEquals(0, data.getChildren(item2).size());
+ assertEquals(10, data.getRootItems().size());
// Move item1 as item2's child
data.setParent(item1, item2);
- Assert.assertEquals(1, data.getChildren(item2).size());
- Assert.assertEquals(9, data.getRootItems().size());
- Assert.assertEquals(item1, data.getChildren(item2).get(0));
+ assertEquals(1, data.getChildren(item2).size());
+ assertEquals(9, data.getRootItems().size());
+ assertEquals(item1, data.getChildren(item2).get(0));
// Move back to root
data.setParent(item1, null);
- Assert.assertEquals(0, data.getChildren(item2).size());
- Assert.assertEquals(10, data.getRootItems().size());
+ assertEquals(0, data.getChildren(item2).size());
+ assertEquals(10, data.getRootItems().size());
}
@Test
public void treeData_move_after_sibling() {
StrBean root0 = rootData.get(0);
StrBean root9 = rootData.get(9);
- Assert.assertEquals(root0, data.getRootItems().get(0));
- Assert.assertEquals(root9, data.getRootItems().get(9));
+ assertEquals(root0, data.getRootItems().get(0));
+ assertEquals(root9, data.getRootItems().get(9));
// Move to last position
data.moveAfterSibling(root0, root9);
- Assert.assertEquals(root0, data.getRootItems().get(9));
- Assert.assertEquals(root9, data.getRootItems().get(8));
+ assertEquals(root0, data.getRootItems().get(9));
+ assertEquals(root9, data.getRootItems().get(8));
// Move back to first position
data.moveAfterSibling(root0, null);
- Assert.assertEquals(root0, data.getRootItems().get(0));
- Assert.assertEquals(root9, data.getRootItems().get(9));
+ assertEquals(root0, data.getRootItems().get(0));
+ assertEquals(root9, data.getRootItems().get(9));
StrBean child0 = data.getChildren(root0).get(0);
StrBean child2 = data.getChildren(root0).get(2);
// Move first child to different position
data.moveAfterSibling(child0, child2);
- Assert.assertEquals(2, data.getChildren(root0).indexOf(child0));
- Assert.assertEquals(1, data.getChildren(root0).indexOf(child2));
+ assertEquals(2, data.getChildren(root0).indexOf(child0));
+ assertEquals(1, data.getChildren(root0).indexOf(child2));
// Move child back to first position
data.moveAfterSibling(child0, null);
- Assert.assertEquals(0, data.getChildren(root0).indexOf(child0));
- Assert.assertEquals(2, data.getChildren(root0).indexOf(child2));
+ assertEquals(0, data.getChildren(root0).indexOf(child0));
+ assertEquals(2, data.getChildren(root0).indexOf(child2));
}
@Test(expected = IllegalArgumentException.class)
@@ -158,9 +162,9 @@ public class TreeDataProviderTest
dataCollection.addRootItems(Arrays.asList("a", "b", "c"));
dataStream.addRootItems(Arrays.asList("a", "b", "c").stream());
- Assert.assertEquals(data.getRootItems(), dataVarargs.getRootItems());
- Assert.assertEquals(data.getRootItems(), dataCollection.getRootItems());
- Assert.assertEquals(data.getRootItems(), dataStream.getRootItems());
+ assertEquals(data.getRootItems(), dataVarargs.getRootItems());
+ assertEquals(data.getRootItems(), dataCollection.getRootItems());
+ assertEquals(data.getRootItems(), dataStream.getRootItems());
}
@Test
@@ -173,12 +177,12 @@ public class TreeDataProviderTest
}
return Arrays.asList(item + "/a", item + "/b", item + "/c");
});
- Assert.assertEquals(stringData.getChildren("a"),
+ assertEquals(stringData.getChildren("a"),
Arrays.asList("a/a", "a/b", "a/c"));
- Assert.assertEquals(stringData.getChildren("b"),
+ assertEquals(stringData.getChildren("b"),
Arrays.asList("b/a", "b/b", "b/c"));
- Assert.assertEquals(stringData.getChildren("c"), Arrays.asList());
- Assert.assertEquals(stringData.getChildren("a/b"), Arrays.asList());
+ assertEquals(stringData.getChildren("c"), Arrays.asList());
+ assertEquals(stringData.getChildren("a/b"), Arrays.asList());
}
@Test
@@ -191,12 +195,12 @@ public class TreeDataProviderTest
}
return Stream.of(item + "/a", item + "/b", item + "/c");
});
- Assert.assertEquals(stringData.getChildren("a"),
+ assertEquals(stringData.getChildren("a"),
Arrays.asList("a/a", "a/b", "a/c"));
- Assert.assertEquals(stringData.getChildren("b"),
+ assertEquals(stringData.getChildren("b"),
Arrays.asList("b/a", "b/b", "b/c"));
- Assert.assertEquals(stringData.getChildren("c"), Arrays.asList());
- Assert.assertEquals(stringData.getChildren("a/b"), Arrays.asList());
+ assertEquals(stringData.getChildren("c"), Arrays.asList());
+ assertEquals(stringData.getChildren("a/b"), Arrays.asList());
}
@Test
@@ -204,26 +208,26 @@ public class TreeDataProviderTest
getDataProvider().setFilter(item -> item.getValue().equals("Xyz")
|| item.getValue().equals("Baz"));
- Assert.assertEquals(10, sizeWithUnfilteredQuery());
+ assertEquals(10, sizeWithUnfilteredQuery());
getDataProvider().setFilter(item -> !item.getValue().equals("Foo")
&& !item.getValue().equals("Xyz"));
- Assert.assertEquals(
+ assertEquals(
"Previous filter should be replaced when setting a new one", 6,
sizeWithUnfilteredQuery());
getDataProvider().setFilter(null);
- Assert.assertEquals("Setting filter to null should remove all filters",
- 20, sizeWithUnfilteredQuery());
+ assertEquals("Setting filter to null should remove all filters", 20,
+ sizeWithUnfilteredQuery());
}
@Test
public void addFilter() {
getDataProvider().addFilter(item -> item.getId() <= 10);
getDataProvider().addFilter(item -> item.getId() >= 5);
- Assert.assertEquals(5, sizeWithUnfilteredQuery());
+ assertEquals(5, sizeWithUnfilteredQuery());
}
@Override
@@ -231,29 +235,28 @@ public class TreeDataProviderTest
DataProvider<StrBean, String> strFilterDataProvider = getDataProvider()
.withConvertedFilter(
text -> strBean -> strBean.getValue().contains(text));
- Assert.assertEquals("Only one item should match 'Xyz'", 1,
+ assertEquals("Only one item should match 'Xyz'", 1,
strFilterDataProvider
.size(new HierarchicalQuery<>("Xyz", null)));
- Assert.assertEquals("No item should match 'Zyx'", 0,
- strFilterDataProvider
- .size(new HierarchicalQuery<>("Zyx", null)));
- Assert.assertEquals("Unexpected number of matches for 'Foo'", 3,
+ assertEquals("No item should match 'Zyx'", 0, strFilterDataProvider
+ .size(new HierarchicalQuery<>("Zyx", null)));
+ assertEquals("Unexpected number of matches for 'Foo'", 3,
strFilterDataProvider
.size(new HierarchicalQuery<>("Foo", null)));
- Assert.assertEquals("No items should've been filtered out",
- rootData.size(), strFilterDataProvider
+ assertEquals("No items should've been filtered out", rootData.size(),
+ strFilterDataProvider
.size(new HierarchicalQuery<>(null, null)));
}
@Override
public void filteringListDataProvider_defaultFilterType() {
- Assert.assertEquals("Only one item should match 'Xyz'", 1,
+ assertEquals("Only one item should match 'Xyz'", 1,
getDataProvider().size(new HierarchicalQuery<>(
strBean -> strBean.getValue().contains("Xyz"), null)));
- Assert.assertEquals("No item should match 'Zyx'", 0,
+ assertEquals("No item should match 'Zyx'", 0,
dataProvider.size(new HierarchicalQuery<>(
strBean -> strBean.getValue().contains("Zyx"), null)));
- Assert.assertEquals("Unexpected number of matches for 'Foo'", 3,
+ assertEquals("Unexpected number of matches for 'Foo'", 3,
getDataProvider()
.size(new HierarchicalQuery<>(fooFilter, null)));
}
@@ -270,7 +273,7 @@ public class TreeDataProviderTest
null))
.collect(Collectors.toList());
- Assert.assertEquals("Sorted data and original data sizes don't match",
+ assertEquals("Sorted data and original data sizes don't match",
getDataProvider().fetch(new HierarchicalQuery<>(null, null))
.count(),
list.size());
@@ -279,17 +282,16 @@ public class TreeDataProviderTest
StrBean prev = list.get(i - 1);
StrBean cur = list.get(i);
// Test specific sort
- Assert.assertTrue(
+ assertTrue(
"Failure: " + prev.getRandomNumber() + " > "
+ cur.getRandomNumber(),
prev.getRandomNumber() <= cur.getRandomNumber());
if (prev.getRandomNumber() == cur.getRandomNumber()) {
// Test default sort
- Assert.assertTrue(
- prev.getValue().compareTo(cur.getValue()) <= 0);
+ assertTrue(prev.getValue().compareTo(cur.getValue()) <= 0);
if (prev.getValue().equals(cur.getValue())) {
- Assert.assertTrue(prev.getId() > cur.getId());
+ assertTrue(prev.getId() > cur.getId());
}
}
}
@@ -304,7 +306,7 @@ public class TreeDataProviderTest
.fetch(new HierarchicalQuery<>(null, null))
.collect(Collectors.toList());
- Assert.assertEquals("Sorted data and original data sizes don't match",
+ assertEquals("Sorted data and original data sizes don't match",
rootData.size(), list.size());
for (int i = 1; i < list.size(); ++i) {
@@ -312,7 +314,7 @@ public class TreeDataProviderTest
StrBean cur = list.get(i);
// Test default sort
- Assert.assertTrue(prev.getValue().compareTo(cur.getValue()) <= 0);
+ assertTrue(prev.getValue().compareTo(cur.getValue()) <= 0);
}
}
@@ -332,15 +334,15 @@ public class TreeDataProviderTest
.thenAsc("id").build(), comp, null, null))
.collect(Collectors.toList());
- Assert.assertNotEquals("First value should not match", rootData.get(0),
+ assertNotEquals("First value should not match", rootData.get(0),
list.get(0));
- Assert.assertEquals("Sorted data and original data sizes don't match",
+ assertEquals("Sorted data and original data sizes don't match",
rootData.size(), list.size());
rootData.sort(comp);
for (int i = 0; i < rootData.size(); ++i) {
- Assert.assertEquals("Sorting result differed", rootData.get(i),
+ assertEquals("Sorting result differed", rootData.get(i),
list.get(i));
}
}
@@ -362,9 +364,8 @@ public class TreeDataProviderTest
}
private void assertHierarchyCorrect() {
- Assert.assertEquals(flattenedData,
- getFlattenedData(new ArrayList<>(), null));
- Assert.assertEquals(flattenedData,
+ assertEquals(flattenedData, getFlattenedData(new ArrayList<>(), null));
+ assertEquals(flattenedData,
getFlattenedDataFromProvider(new ArrayList<>(), null));
}
diff --git a/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchyMapperWithDataTest.java b/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchyMapperWithDataTest.java
index 4cfc8a8598..80d6a70cfd 100644
--- a/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchyMapperWithDataTest.java
+++ b/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchyMapperWithDataTest.java
@@ -1,5 +1,8 @@
package com.vaadin.data.provider.hierarchical;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@@ -7,7 +10,6 @@ import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -50,58 +52,57 @@ public class HierarchyMapperWithDataTest {
@Test
public void expandRootNode() {
- Assert.assertEquals("Map size should be equal to root node count",
- ROOT_COUNT, mapper.getTreeSize());
+ assertEquals("Map size should be equal to root node count", ROOT_COUNT,
+ mapper.getTreeSize());
expand(testData.get(0));
- Assert.assertEquals("Should be root count + once parent count",
+ assertEquals("Should be root count + once parent count",
ROOT_COUNT + PARENT_COUNT, mapper.getTreeSize());
checkMapSize();
}
@Test
public void expandAndCollapseLastRootNode() {
- Assert.assertEquals("Map size should be equal to root node count",
- ROOT_COUNT, mapper.getTreeSize());
+ assertEquals("Map size should be equal to root node count", ROOT_COUNT,
+ mapper.getTreeSize());
expand(roots.get(roots.size() - 1));
- Assert.assertEquals("Should be root count + once parent count",
+ assertEquals("Should be root count + once parent count",
ROOT_COUNT + PARENT_COUNT, mapper.getTreeSize());
checkMapSize();
collapse(roots.get(roots.size() - 1));
- Assert.assertEquals("Map size should be equal to root node count again",
+ assertEquals("Map size should be equal to root node count again",
ROOT_COUNT, mapper.getTreeSize());
checkMapSize();
}
@Test
public void expandHiddenNode() {
- Assert.assertEquals("Map size should be equal to root node count",
- ROOT_COUNT, mapper.getTreeSize());
+ assertEquals("Map size should be equal to root node count", ROOT_COUNT,
+ mapper.getTreeSize());
expand(testData.get(1));
- Assert.assertEquals(
- "Map size should not change when expanding a hidden node",
+ assertEquals("Map size should not change when expanding a hidden node",
ROOT_COUNT, mapper.getTreeSize());
checkMapSize();
expand(roots.get(0));
- Assert.assertEquals("Hidden node should now be expanded as well",
+ assertEquals("Hidden node should now be expanded as well",
ROOT_COUNT + PARENT_COUNT + LEAF_COUNT, mapper.getTreeSize());
checkMapSize();
collapse(roots.get(0));
- Assert.assertEquals("Map size should be equal to root node count",
- ROOT_COUNT, mapper.getTreeSize());
+ assertEquals("Map size should be equal to root node count", ROOT_COUNT,
+ mapper.getTreeSize());
checkMapSize();
}
@Test
public void expandLeafNode() {
- Assert.assertEquals("Map size should be equal to root node count",
- ROOT_COUNT, mapper.getTreeSize());
+ assertEquals("Map size should be equal to root node count", ROOT_COUNT,
+ mapper.getTreeSize());
expand(testData.get(0));
expand(testData.get(1));
- Assert.assertEquals("Root and parent node expanded",
+ assertEquals("Root and parent node expanded",
ROOT_COUNT + PARENT_COUNT + LEAF_COUNT, mapper.getTreeSize());
checkMapSize();
expand(testData.get(2));
- Assert.assertEquals("Expanding a leaf node should have no effect",
+ assertEquals("Expanding a leaf node should have no effect",
ROOT_COUNT + PARENT_COUNT + LEAF_COUNT, mapper.getTreeSize());
checkMapSize();
}
@@ -109,12 +110,12 @@ public class HierarchyMapperWithDataTest {
@Test
public void findParentIndexOfLeaf() {
expand(testData.get(0));
- Assert.assertEquals("Could not find the root node of a parent",
+ assertEquals("Could not find the root node of a parent",
Integer.valueOf(0), mapper.getParentIndex(testData.get(1)));
expand(testData.get(1));
- Assert.assertEquals("Could not find the parent of a leaf",
- Integer.valueOf(1), mapper.getParentIndex(testData.get(2)));
+ assertEquals("Could not find the parent of a leaf", Integer.valueOf(1),
+ mapper.getParentIndex(testData.get(2)));
}
@Test
@@ -219,12 +220,13 @@ public class HierarchyMapperWithDataTest {
List<Node> collect = mapper.fetchItems(range)
.collect(Collectors.toList());
for (int i = 0; i < range.length(); ++i) {
- Assert.assertEquals("Unexpected fetch results.",
+ assertEquals("Unexpected fetch results.",
expectedResult.get(i + range.getStart()), collect.get(i));
}
}
- static List<Node> generateTestData(int rootCount, int parentCount, int leafCount) {
+ static List<Node> generateTestData(int rootCount, int parentCount,
+ int leafCount) {
List<Node> nodes = new ArrayList<>();
for (int i = 0; i < rootCount; ++i) {
Node root = new Node();
@@ -241,20 +243,20 @@ public class HierarchyMapperWithDataTest {
}
private void checkMapSize() {
- Assert.assertEquals("Map size not properly updated",
- mapper.getTreeSize(), mapSize);
+ assertEquals("Map size not properly updated", mapper.getTreeSize(),
+ mapSize);
}
public void removeRows(Range range) {
- Assert.assertTrue("Index not in range",
+ assertTrue("Index not in range",
0 <= range.getStart() && range.getStart() < mapSize);
- Assert.assertTrue("Removing more items than in map",
+ assertTrue("Removing more items than in map",
range.getEnd() <= mapSize);
mapSize -= range.length();
}
public void insertRows(Range range) {
- Assert.assertTrue("Index not in range",
+ assertTrue("Index not in range",
0 <= range.getStart() && range.getStart() <= mapSize);
mapSize += range.length();
}
diff --git a/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchyMapperWithNumerousDataTest.java b/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchyMapperWithNumerousDataTest.java
index 611d15a2ac..6c0091f8bf 100644
--- a/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchyMapperWithNumerousDataTest.java
+++ b/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchyMapperWithNumerousDataTest.java
@@ -1,10 +1,12 @@
package com.vaadin.data.provider.hierarchical;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -29,7 +31,8 @@ public class HierarchyMapperWithNumerousDataTest {
@BeforeClass
public static void setupData() {
- testData = HierarchyMapperWithDataTest.generateTestData(ROOT_COUNT, PARENT_COUNT, 0);
+ testData = HierarchyMapperWithDataTest.generateTestData(ROOT_COUNT,
+ PARENT_COUNT, 0);
roots = testData.stream().filter(item -> item.getParent() == null)
.collect(Collectors.toList());
data.addItems(roots,
@@ -45,16 +48,16 @@ public class HierarchyMapperWithNumerousDataTest {
}
/**
- * Test for non-logarithmic {@code getParentOfItem} implementations
- * 100000 entries and 1 second should be enought to make it run even
- * on slow machines and weed out linear solutions
+ * Test for non-logarithmic {@code getParentOfItem} implementations 100000
+ * entries and 1 second should be enought to make it run even on slow
+ * machines and weed out linear solutions
*/
@Test(timeout = 1000)
public void expandRootNode() {
- Assert.assertEquals("Map size should be equal to root node count",
- ROOT_COUNT, mapper.getTreeSize());
+ assertEquals("Map size should be equal to root node count", ROOT_COUNT,
+ mapper.getTreeSize());
expand(testData.get(0));
- Assert.assertEquals("Should be root count + once parent count",
+ assertEquals("Should be root count + once parent count",
ROOT_COUNT + PARENT_COUNT, mapper.getTreeSize());
checkMapSize();
}
@@ -64,13 +67,13 @@ public class HierarchyMapperWithNumerousDataTest {
}
public void insertRows(Range range) {
- Assert.assertTrue("Index not in range",
+ assertTrue("Index not in range",
0 <= range.getStart() && range.getStart() <= mapSize);
mapSize += range.length();
}
private void checkMapSize() {
- Assert.assertEquals("Map size not properly updated",
- mapper.getTreeSize(), mapSize);
+ assertEquals("Map size not properly updated", mapper.getTreeSize(),
+ mapSize);
}
}
diff --git a/server/src/test/java/com/vaadin/data/validator/NotEmptyValidatorTest.java b/server/src/test/java/com/vaadin/data/validator/NotEmptyValidatorTest.java
index edd500a8a1..f238f67f11 100644
--- a/server/src/test/java/com/vaadin/data/validator/NotEmptyValidatorTest.java
+++ b/server/src/test/java/com/vaadin/data/validator/NotEmptyValidatorTest.java
@@ -15,7 +15,10 @@
*/
package com.vaadin.data.validator;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import com.vaadin.data.ValidationResult;
@@ -31,16 +34,16 @@ public class NotEmptyValidatorTest {
public void nullValueIsDisallowed() {
NotEmptyValidator<String> validator = new NotEmptyValidator<>("foo");
ValidationResult result = validator.apply(null, new ValueContext());
- Assert.assertTrue(result.isError());
- Assert.assertEquals("foo", result.getErrorMessage());
+ assertTrue(result.isError());
+ assertEquals("foo", result.getErrorMessage());
}
@Test
public void emptyValueIsDisallowed() {
NotEmptyValidator<String> validator = new NotEmptyValidator<>("foo");
ValidationResult result = validator.apply("", new ValueContext());
- Assert.assertTrue(result.isError());
- Assert.assertEquals("foo", result.getErrorMessage());
+ assertTrue(result.isError());
+ assertEquals("foo", result.getErrorMessage());
}
@Test
@@ -48,7 +51,7 @@ public class NotEmptyValidatorTest {
NotEmptyValidator<Object> validator = new NotEmptyValidator<>("foo");
Object value = new Object();
ValidationResult result = validator.apply(value, new ValueContext());
- Assert.assertFalse(result.isError());
- Assert.assertFalse(result.isError());
+ assertFalse(result.isError());
+ assertFalse(result.isError());
}
}
diff --git a/server/src/test/java/com/vaadin/data/validator/ValidatorTestBase.java b/server/src/test/java/com/vaadin/data/validator/ValidatorTestBase.java
index a0bdd2964b..80ed1b26f1 100644
--- a/server/src/test/java/com/vaadin/data/validator/ValidatorTestBase.java
+++ b/server/src/test/java/com/vaadin/data/validator/ValidatorTestBase.java
@@ -1,8 +1,11 @@
package com.vaadin.data.validator;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.util.Locale;
-import org.junit.Assert;
import org.junit.Before;
import com.vaadin.data.ValidationResult;
@@ -23,7 +26,7 @@ public class ValidatorTestBase {
protected <T> void assertPasses(T value, Validator<? super T> validator) {
ValidationResult result = validator.apply(value, new ValueContext());
if (result.isError()) {
- Assert.fail(value + " should pass " + validator + " but got "
+ fail(value + " should pass " + validator + " but got "
+ result.getErrorMessage());
}
}
@@ -32,8 +35,8 @@ public class ValidatorTestBase {
Validator<? super T> validator) {
ValidationResult result = validator.apply(value,
new ValueContext(localeContext));
- Assert.assertTrue(result.isError());
- Assert.assertEquals(errorMessage, result.getErrorMessage());
+ assertTrue(result.isError());
+ assertEquals(errorMessage, result.getErrorMessage());
}
protected <T> void assertFails(T value, AbstractValidator<? super T> v) {
diff --git a/server/src/test/java/com/vaadin/event/selection/SelectionEventTest.java b/server/src/test/java/com/vaadin/event/selection/SelectionEventTest.java
index 5328ae9336..8418121c92 100644
--- a/server/src/test/java/com/vaadin/event/selection/SelectionEventTest.java
+++ b/server/src/test/java/com/vaadin/event/selection/SelectionEventTest.java
@@ -15,12 +15,14 @@
*/
package com.vaadin.event.selection;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Optional;
-import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
@@ -42,10 +44,10 @@ public class SelectionEventTest {
Optional<?> selected = event.getFirstSelectedItem();
Mockito.verify(event).getValue();
- Assert.assertEquals("foo", selected.get());
+ assertEquals("foo", selected.get());
Mockito.when(event.getValue()).thenReturn(Collections.emptySet());
- Assert.assertFalse(event.getFirstSelectedItem().isPresent());
+ assertFalse(event.getFirstSelectedItem().isPresent());
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@@ -59,10 +61,10 @@ public class SelectionEventTest {
Optional<?> selected = event.getSelectedItem();
Mockito.verify(event).getSelectedItem();
- Assert.assertEquals("foo", selected.get());
+ assertEquals("foo", selected.get());
Mockito.when(event.getSelectedItem()).thenReturn(Optional.empty());
- Assert.assertFalse(event.getFirstSelectedItem().isPresent());
+ assertFalse(event.getFirstSelectedItem().isPresent());
}
}
diff --git a/server/src/test/java/com/vaadin/server/AbstractClientConnectorProxyHandlingTest.java b/server/src/test/java/com/vaadin/server/AbstractClientConnectorProxyHandlingTest.java
index b3eb006e0d..e952c01340 100644
--- a/server/src/test/java/com/vaadin/server/AbstractClientConnectorProxyHandlingTest.java
+++ b/server/src/test/java/com/vaadin/server/AbstractClientConnectorProxyHandlingTest.java
@@ -15,10 +15,11 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.fail;
+
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import org.junit.Assert;
import org.junit.Test;
/**
@@ -38,13 +39,12 @@ public class AbstractClientConnectorProxyHandlingTest {
int modifiers = method.getModifiers();
if (Modifier.isFinal(modifiers) || !Modifier.isProtected(modifiers)
|| Modifier.isStatic(modifiers)) {
- Assert.fail(
- "isThis has invalid modifiers, CDI proxies will not work.");
+ fail("isThis has invalid modifiers, CDI proxies will not work.");
}
} catch (SecurityException e) {
// Ignore, no can do
} catch (NoSuchMethodException e) {
- Assert.fail("isThis is missing, CDI proxies will not work.");
+ fail("isThis is missing, CDI proxies will not work.");
}
}
diff --git a/server/src/test/java/com/vaadin/server/AbstractClientConnectorTest.java b/server/src/test/java/com/vaadin/server/AbstractClientConnectorTest.java
index 4a6a2f5647..b4e4f95194 100644
--- a/server/src/test/java/com/vaadin/server/AbstractClientConnectorTest.java
+++ b/server/src/test/java/com/vaadin/server/AbstractClientConnectorTest.java
@@ -15,6 +15,11 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -27,7 +32,6 @@ import java.net.URL;
import java.util.Map;
import org.apache.commons.io.IOUtils;
-import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
@@ -51,9 +55,9 @@ public class AbstractClientConnectorTest {
Mockito.doCallRealMethod().when(mock).registerRpc(implementation);
try {
mock.registerRpc(implementation);
- Assert.fail("expected exception");
+ fail("expected exception");
} catch (Exception expected) {
- Assert.assertEquals(
+ assertEquals(
"Use registerRpc(T implementation, Class<T> rpcInterfaceType) "
+ "if the Rpc implementation implements more than one interface",
expected.getMessage());
@@ -93,7 +97,7 @@ public class AbstractClientConnectorTest {
"com.vaadin.server.AbstractClientConnector");
stateTypeCache.put(classRef.get(), null);
int size = stateTypeCache.size();
- Assert.assertNotNull("Class should not yet be garbage collected",
+ assertNotNull("Class should not yet be garbage collected",
classRef.get());
for (int i = 0; i < 100; ++i) {
@@ -103,8 +107,8 @@ public class AbstractClientConnectorTest {
}
Thread.sleep(100);
}
- Assert.assertTrue(stateTypeCache.size() < size);
- Assert.assertNull("Class should be garbage collected", classRef.get());
+ assertTrue(stateTypeCache.size() < size);
+ assertNull("Class should be garbage collected", classRef.get());
}
private WeakReference<Class<?>> loadClass(String name)
@@ -161,8 +165,7 @@ public class AbstractClientConnectorTest {
if (!name.startsWith("com.vaadin.")) {
return super.loadClass(name);
}
- String path = name.replace('.', '/')
- .concat(".class");
+ String path = name.replace('.', '/').concat(".class");
URL resource = Thread.currentThread().getContextClassLoader()
.getResource(path);
try (InputStream stream = resource.openStream()) {
diff --git a/server/src/test/java/com/vaadin/server/AbstractDeploymentConfigurationTest.java b/server/src/test/java/com/vaadin/server/AbstractDeploymentConfigurationTest.java
index 2d4e7fad0a..97918d27dc 100644
--- a/server/src/test/java/com/vaadin/server/AbstractDeploymentConfigurationTest.java
+++ b/server/src/test/java/com/vaadin/server/AbstractDeploymentConfigurationTest.java
@@ -15,10 +15,11 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.assertEquals;
+
import java.util.Properties;
import java.util.UUID;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.shared.communication.PushMode;
@@ -35,8 +36,8 @@ public class AbstractDeploymentConfigurationTest {
String ui = UUID.randomUUID().toString();
DeploymentConfiguration config = getConfig(VaadinSession.UI_PARAMETER,
ui);
- Assert.assertEquals("Unexpected UI class configuration option value",
- ui, config.getUIClassName());
+ assertEquals("Unexpected UI class configuration option value", ui,
+ config.getUIClassName());
}
@Test
@@ -44,8 +45,7 @@ public class AbstractDeploymentConfigurationTest {
String uiProvider = UUID.randomUUID().toString();
DeploymentConfiguration config = getConfig(
Constants.SERVLET_PARAMETER_UI_PROVIDER, uiProvider);
- Assert.assertEquals(
- "Unexpected UI providerclass configuration option value",
+ assertEquals("Unexpected UI providerclass configuration option value",
uiProvider, config.getUIProviderClassName());
}
@@ -54,7 +54,7 @@ public class AbstractDeploymentConfigurationTest {
String widgetset = UUID.randomUUID().toString();
DeploymentConfiguration config = getConfig(
Constants.PARAMETER_WIDGETSET, widgetset);
- Assert.assertEquals("Unexpected widgetset configuration option value",
+ assertEquals("Unexpected widgetset configuration option value",
widgetset, config.getWidgetset(null));
}
@@ -62,7 +62,7 @@ public class AbstractDeploymentConfigurationTest {
public void getWidgetset_noWidgetsetPropertyValue_returnsProvidedDefaultValue() {
DeploymentConfiguration config = getConfig(null, null);
String widgetset = UUID.randomUUID().toString();
- Assert.assertEquals("Unexpected widgetset configuration option value",
+ assertEquals("Unexpected widgetset configuration option value",
widgetset, config.getWidgetset(widgetset));
}
@@ -71,8 +71,7 @@ public class AbstractDeploymentConfigurationTest {
String resources = UUID.randomUUID().toString();
DeploymentConfiguration config = getConfig(
Constants.PARAMETER_VAADIN_RESOURCES, resources);
- Assert.assertEquals(
- "Unexpected resources path configuration option value",
+ assertEquals("Unexpected resources path configuration option value",
resources, config.getResourcesPath());
}
@@ -80,7 +79,7 @@ public class AbstractDeploymentConfigurationTest {
public void getClassLoader_returnsClassloaderPropertyValue() {
String classLoader = UUID.randomUUID().toString();
DeploymentConfiguration config = getConfig("ClassLoader", classLoader);
- Assert.assertEquals("Unexpected classLoader configuration option value",
+ assertEquals("Unexpected classLoader configuration option value",
classLoader, config.getClassLoaderName());
}
diff --git a/server/src/test/java/com/vaadin/server/BootstrapHandlerTest.java b/server/src/test/java/com/vaadin/server/BootstrapHandlerTest.java
index 3530d105a3..2f96fad56f 100644
--- a/server/src/test/java/com/vaadin/server/BootstrapHandlerTest.java
+++ b/server/src/test/java/com/vaadin/server/BootstrapHandlerTest.java
@@ -15,9 +15,10 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.assertEquals;
+
import java.util.Properties;
-import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
@@ -105,7 +106,6 @@ public class BootstrapHandlerTest {
Mockito.when(session.getBrowser()).thenReturn(browser);
Mockito.when(session.getConfiguration()).thenReturn(configuration);
- Assert.assertEquals(expectedUrl,
- resolver.resolveVaadinUri(frontendUrl));
+ assertEquals(expectedUrl, resolver.resolveVaadinUri(frontendUrl));
}
}
diff --git a/server/src/test/java/com/vaadin/server/BrowserWindowOpenerTest.java b/server/src/test/java/com/vaadin/server/BrowserWindowOpenerTest.java
index 726f4ea549..ef8420655f 100644
--- a/server/src/test/java/com/vaadin/server/BrowserWindowOpenerTest.java
+++ b/server/src/test/java/com/vaadin/server/BrowserWindowOpenerTest.java
@@ -16,9 +16,11 @@
package com.vaadin.server;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import org.easymock.EasyMock;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.shared.communication.URLReference;
@@ -39,14 +41,14 @@ public class BrowserWindowOpenerTest {
assertEquals("Unexpected resource is got on getResource() method",
resource, opener.getResource());
- Assert.assertNull("Unexpected resource is got on getUrl() method",
+ assertNull("Unexpected resource is got on getUrl() method",
opener.getUrl());
URLReference ref = opener.getState(false).resources
.get(BrowserWindowOpenerState.locationResource);
- Assert.assertTrue("Url reference in the state is not ResourceReference",
+ assertTrue("Url reference in the state is not ResourceReference",
ref instanceof ResourceReference);
- Assert.assertEquals("Unexpected resource saved in state", resource,
+ assertEquals("Unexpected resource saved in state", resource,
((ResourceReference) ref).getResource());
}
@@ -59,18 +61,17 @@ public class BrowserWindowOpenerTest {
assertEquals("Unexpected URL is got on getURL() method", url,
opener.getUrl());
- Assert.assertNotNull(
- "Unexpected resource is got on getResource() method",
+ assertNotNull("Unexpected resource is got on getResource() method",
opener.getResource());
URLReference ref = opener.getState(false).resources
.get(BrowserWindowOpenerState.locationResource);
- Assert.assertTrue("Url reference in the state is not ResourceReference",
+ assertTrue("Url reference in the state is not ResourceReference",
ref instanceof ResourceReference);
Resource resource = ((ResourceReference) ref).getResource();
- Assert.assertTrue("Resource reference is not ExternalResource",
+ assertTrue("Resource reference is not ExternalResource",
resource instanceof ExternalResource);
- Assert.assertEquals("Unexpected URL in resource saved in state", url,
+ assertEquals("Unexpected URL in resource saved in state", url,
((ExternalResource) resource).getURL());
}
diff --git a/server/src/test/java/com/vaadin/server/ConnectorResourceHandlerTest.java b/server/src/test/java/com/vaadin/server/ConnectorResourceHandlerTest.java
index 57b8ed8ff4..72eb5ec26e 100644
--- a/server/src/test/java/com/vaadin/server/ConnectorResourceHandlerTest.java
+++ b/server/src/test/java/com/vaadin/server/ConnectorResourceHandlerTest.java
@@ -15,11 +15,12 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import org.easymock.EasyMock;
import org.easymock.IMocksControl;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -95,7 +96,7 @@ public class ConnectorResourceHandlerTest {
}
ConnectorResourceHandler handler = new ConnectorResourceHandler();
- Assert.assertTrue(handler.handleRequest(session, request, response));
+ assertTrue(handler.handleRequest(session, request, response));
EasyMock.verify(errorHandler);
}
diff --git a/server/src/test/java/com/vaadin/server/DedicatedStateTest.java b/server/src/test/java/com/vaadin/server/DedicatedStateTest.java
index 3a21d136f7..009682ae88 100644
--- a/server/src/test/java/com/vaadin/server/DedicatedStateTest.java
+++ b/server/src/test/java/com/vaadin/server/DedicatedStateTest.java
@@ -15,11 +15,14 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.fail;
+
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.navigator.Navigator;
@@ -58,7 +61,7 @@ public class DedicatedStateTest {
Class<?> superclass = clazz.getSuperclass();
if (!clazz.equals(AbstractClientConnector.class)
&& !superclass.equals(AbstractExtension.class)) {
- Assert.assertNotEquals(
+ assertNotEquals(
"Class " + clazz
+ " has the same state type as its super class "
+ clazz.getSuperclass(),
@@ -67,9 +70,9 @@ public class DedicatedStateTest {
try {
Method getStateOneArg = clazz.getDeclaredMethod("getState",
boolean.class);
- Assert.assertEquals(stateType, getStateOneArg.getReturnType());
+ assertEquals(stateType, getStateOneArg.getReturnType());
} catch (NoSuchMethodException e) {
- Assert.fail("Class " + clazz
+ fail("Class " + clazz
+ " doesn't have its own getState(boolean) method");
} catch (SecurityException e) {
throw new RuntimeException(e);
@@ -80,8 +83,7 @@ public class DedicatedStateTest {
try {
return clazz.getDeclaredMethod("getState");
} catch (NoSuchMethodException e) {
- Assert.fail("Class " + clazz
- + " doesn't have its own getState() method");
+ fail("Class " + clazz + " doesn't have its own getState() method");
return null;
} catch (SecurityException e) {
throw new RuntimeException(e);
diff --git a/server/src/test/java/com/vaadin/server/DefaultDeploymentConfigurationTest.java b/server/src/test/java/com/vaadin/server/DefaultDeploymentConfigurationTest.java
index 41fc4f0077..4bbf165770 100644
--- a/server/src/test/java/com/vaadin/server/DefaultDeploymentConfigurationTest.java
+++ b/server/src/test/java/com/vaadin/server/DefaultDeploymentConfigurationTest.java
@@ -15,9 +15,10 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.assertEquals;
+
import java.util.Properties;
-import org.junit.Assert;
import org.junit.Test;
/**
@@ -37,7 +38,7 @@ public class DefaultDeploymentConfigurationTest {
System.setProperty(prop, value);
DefaultDeploymentConfiguration config = new DefaultDeploymentConfiguration(
clazz, new Properties());
- Assert.assertEquals(value, config.getSystemProperty(prop));
+ assertEquals(value, config.getSystemProperty(prop));
}
@Test
@@ -50,6 +51,6 @@ public class DefaultDeploymentConfigurationTest {
value);
DefaultDeploymentConfiguration config = new DefaultDeploymentConfiguration(
DefaultDeploymentConfigurationTest.class, new Properties());
- Assert.assertEquals(value, config.getSystemProperty(prop));
+ assertEquals(value, config.getSystemProperty(prop));
}
}
diff --git a/server/src/test/java/com/vaadin/server/DragAndDropServiceTest.java b/server/src/test/java/com/vaadin/server/DragAndDropServiceTest.java
index 71e3782fcd..370bb490aa 100644
--- a/server/src/test/java/com/vaadin/server/DragAndDropServiceTest.java
+++ b/server/src/test/java/com/vaadin/server/DragAndDropServiceTest.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.assertTrue;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -25,7 +27,6 @@ import java.util.logging.Logger;
import java.util.logging.StreamHandler;
import org.easymock.EasyMock;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.event.dd.DropHandler;
@@ -64,9 +65,9 @@ public class DragAndDropServiceTest {
EasyMock.createMock(VaadinSession.class));
service.changeVariables(null, variables);
- Assert.assertTrue("isConnectorEnabled() method is not called",
+ assertTrue("isConnectorEnabled() method is not called",
isConnectorEnabledCalled[0]);
- Assert.assertTrue("No warning on drop from disabled source",
+ assertTrue("No warning on drop from disabled source",
levels.contains(Level.WARNING));
}
@@ -89,9 +90,9 @@ public class DragAndDropServiceTest {
EasyMock.createMock(VaadinSession.class));
service.changeVariables(null, variables);
- Assert.assertTrue("isConnectorEnabled() method is not called",
+ assertTrue("isConnectorEnabled() method is not called",
target.isConnectorEnabledCalled());
- Assert.assertTrue("No warning on drop to disabled target",
+ assertTrue("No warning on drop to disabled target",
levels.contains(Level.WARNING));
}
diff --git a/server/src/test/java/com/vaadin/server/JSONSerializerTest.java b/server/src/test/java/com/vaadin/server/JSONSerializerTest.java
index 250d6831f4..406b798193 100644
--- a/server/src/test/java/com/vaadin/server/JSONSerializerTest.java
+++ b/server/src/test/java/com/vaadin/server/JSONSerializerTest.java
@@ -15,12 +15,14 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.server.JsonCodec.BeanProperty;
@@ -90,7 +92,7 @@ public class JSONSerializerTest {
inputArray.set(1, Json.createNull());
UidlValue decodedObject = (UidlValue) JsonCodec
.decodeInternalType(UidlValue.class, true, inputArray, null);
- Assert.assertNull(decodedObject.getValue());
+ assertNull(decodedObject.getValue());
}
@Test(expected = JsonException.class)
@@ -106,8 +108,7 @@ public class JSONSerializerTest {
Type type) throws Exception {
Object serverSideDecoded = JsonCodec.decodeInternalOrCustomType(type,
encoded, null);
- Assert.assertTrue("Server decoded",
- equals(original, serverSideDecoded));
+ assertTrue("Server decoded", equals(original, serverSideDecoded));
}
diff --git a/server/src/test/java/com/vaadin/server/JsonEqualsTest.java b/server/src/test/java/com/vaadin/server/JsonEqualsTest.java
index e92254921f..833c20e496 100644
--- a/server/src/test/java/com/vaadin/server/JsonEqualsTest.java
+++ b/server/src/test/java/com/vaadin/server/JsonEqualsTest.java
@@ -15,7 +15,9 @@
*/
package com.vaadin.server;
-import org.junit.Assert;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import elemental.json.Json;
@@ -29,7 +31,7 @@ public class JsonEqualsTest {
public void differentTypes_notEqual() {
boolean equals = JsonCodec.jsonEquals(Json.create(5), Json.create("5"));
- Assert.assertFalse("Different types should not be equal", equals);
+ assertFalse("Different types should not be equal", equals);
}
@Test
@@ -37,7 +39,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(Json.createNull(),
Json.createNull());
- Assert.assertTrue("Null and null should be equal", equals);
+ assertTrue("Null and null should be equal", equals);
}
@Test
@@ -45,7 +47,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(Json.create(true),
Json.create(false));
- Assert.assertFalse("Different booleans should not be equal", equals);
+ assertFalse("Different booleans should not be equal", equals);
}
@Test
@@ -53,14 +55,14 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(Json.create(false),
Json.create(false));
- Assert.assertTrue("Same booleans should be equal", equals);
+ assertTrue("Same booleans should be equal", equals);
}
@Test
public void differentNumbers_notEqual() {
boolean equals = JsonCodec.jsonEquals(Json.create(2), Json.create(5.6));
- Assert.assertFalse("Different numbers should not be equal", equals);
+ assertFalse("Different numbers should not be equal", equals);
}
@Test
@@ -68,7 +70,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(Json.create(3.14),
Json.create(3.14));
- Assert.assertTrue("Same numbers should be equal", equals);
+ assertTrue("Same numbers should be equal", equals);
}
@Test
@@ -76,7 +78,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(Json.create("abc"),
Json.create("def"));
- Assert.assertFalse("Different strings should not be equal", equals);
+ assertFalse("Different strings should not be equal", equals);
}
@Test
@@ -84,7 +86,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(Json.create("abc"),
Json.create("abc"));
- Assert.assertTrue("Same strings should be equal", equals);
+ assertTrue("Same strings should be equal", equals);
}
@Test
@@ -96,8 +98,8 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(o1, o2);
- Assert.assertFalse(
- "Object with different key counts should not be equal", equals);
+ assertFalse("Object with different key counts should not be equal",
+ equals);
}
@Test
@@ -110,8 +112,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(o1, o2);
- Assert.assertFalse("Object with different keys should not be equal",
- equals);
+ assertFalse("Object with different keys should not be equal", equals);
}
@Test
@@ -124,8 +125,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(o1, o2);
- Assert.assertFalse(
- "Object with different child values should not be equal",
+ assertFalse("Object with different child values should not be equal",
equals);
}
@@ -136,7 +136,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(o1, o2);
- Assert.assertTrue("Empty objects should be equal", equals);
+ assertTrue("Empty objects should be equal", equals);
}
@Test
@@ -149,7 +149,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(o1, o2);
- Assert.assertTrue("Same objects should be equal", equals);
+ assertTrue("Same objects should be equal", equals);
}
@Test
@@ -162,7 +162,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(o1, o2);
- Assert.assertTrue("Same objects should be equal", equals);
+ assertTrue("Same objects should be equal", equals);
}
@Test
@@ -174,8 +174,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(a1, a2);
- Assert.assertFalse("Arrays with different sizes should not be equal",
- equals);
+ assertFalse("Arrays with different sizes should not be equal", equals);
}
@Test
@@ -188,7 +187,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(a1, a2);
- Assert.assertFalse("Arrays with different content should not be equal",
+ assertFalse("Arrays with different content should not be equal",
equals);
}
@@ -204,8 +203,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(a1, a2);
- Assert.assertFalse("Arrays with different order should not be equal",
- equals);
+ assertFalse("Arrays with different order should not be equal", equals);
}
@Test
@@ -215,7 +213,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(a1, a2);
- Assert.assertTrue("Empty arrays should be equal", equals);
+ assertTrue("Empty arrays should be equal", equals);
}
@Test
@@ -230,7 +228,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(a1, a2);
- Assert.assertTrue("Same arrays should be equal", equals);
+ assertTrue("Same arrays should be equal", equals);
}
@Test
@@ -243,7 +241,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(a1, a2);
- Assert.assertTrue("Same arrays should be equal", equals);
+ assertTrue("Same arrays should be equal", equals);
}
@Test
@@ -251,7 +249,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(createDeeplyNestedValue(1),
createDeeplyNestedValue(2));
- Assert.assertFalse("Values should not be equal", equals);
+ assertFalse("Values should not be equal", equals);
}
@Test
@@ -259,7 +257,7 @@ public class JsonEqualsTest {
boolean equals = JsonCodec.jsonEquals(createDeeplyNestedValue(1),
createDeeplyNestedValue(1));
- Assert.assertTrue("Values should be equal", equals);
+ assertTrue("Values should be equal", equals);
}
private static JsonValue createDeeplyNestedValue(int leafValue) {
diff --git a/server/src/test/java/com/vaadin/server/LocaleServiceTest.java b/server/src/test/java/com/vaadin/server/LocaleServiceTest.java
index 7742c2ae30..ec028aa5cd 100644
--- a/server/src/test/java/com/vaadin/server/LocaleServiceTest.java
+++ b/server/src/test/java/com/vaadin/server/LocaleServiceTest.java
@@ -1,12 +1,13 @@
package com.vaadin.server;
+import static org.junit.Assert.assertEquals;
+
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -956,16 +957,16 @@ public class LocaleServiceTest {
@Test
public void localeDateTimeFormat() {
for (Locale l : expectedLocaleData.keySet()) {
- Assert.assertEquals("Error verifying locale " + l,
+ assertEquals("Error verifying locale " + l,
expectedLocaleData.get(l).dateFormat,
localeService.createLocaleData(l).dateFormat);
- Assert.assertEquals("Error verifying locale " + l,
+ assertEquals("Error verifying locale " + l,
expectedLocaleData.get(l).twelveHourClock,
localeService.createLocaleData(l).twelveHourClock);
- Assert.assertEquals("Error verifying locale " + l,
+ assertEquals("Error verifying locale " + l,
expectedLocaleData.get(l).am,
localeService.createLocaleData(l).am);
- Assert.assertEquals("Error verifying locale " + l,
+ assertEquals("Error verifying locale " + l,
expectedLocaleData.get(l).pm,
localeService.createLocaleData(l).pm);
}
@@ -1023,4 +1024,4 @@ public class LocaleServiceTest {
+ id.replaceAll("_", "\",\"") + "\"), " + field + ");");
}
-} \ No newline at end of file
+}
diff --git a/server/src/test/java/com/vaadin/server/PageTest.java b/server/src/test/java/com/vaadin/server/PageTest.java
index 3a8c5a0ba1..42ab59dc51 100644
--- a/server/src/test/java/com/vaadin/server/PageTest.java
+++ b/server/src/test/java/com/vaadin/server/PageTest.java
@@ -15,8 +15,9 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.assertFalse;
+
import org.easymock.EasyMock;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.server.Page.BrowserWindowResizeEvent;
@@ -43,8 +44,7 @@ public class PageTest {
page.updateBrowserWindowSize(0, 0, true);
- Assert.assertFalse("Listener is called after removal",
- listener.isCalled());
+ assertFalse("Listener is called after removal", listener.isCalled());
}
@Test
@@ -56,8 +56,7 @@ public class PageTest {
.createMock(BrowserWindowResizeListener.class);
page.removeBrowserWindowResizeListener(listener);
- Assert.assertFalse(
- "Page state 'hasResizeListeners' property has wrong value",
+ assertFalse("Page state 'hasResizeListeners' property has wrong value",
page.getState(false).hasResizeListeners);
}
diff --git a/server/src/test/java/com/vaadin/server/RemoveListenersDeprecatedTest.java b/server/src/test/java/com/vaadin/server/RemoveListenersDeprecatedTest.java
index d597ab3539..0e7426232d 100644
--- a/server/src/test/java/com/vaadin/server/RemoveListenersDeprecatedTest.java
+++ b/server/src/test/java/com/vaadin/server/RemoveListenersDeprecatedTest.java
@@ -1,5 +1,9 @@
package com.vaadin.server;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
@@ -7,7 +11,6 @@ import java.util.List;
import java.util.function.Predicate;
import java.util.regex.Pattern;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.provider.AbstractDataProvider;
@@ -47,11 +50,10 @@ public class RemoveListenersDeprecatedTest {
if (addPattern.matcher(method.getName()).matches()
&& method.getAnnotation(Deprecated.class) == null) {
Class<?> returnType = method.getReturnType();
- Assert.assertEquals(
- "Method " + method.getName()
- + " is not deprectated in class "
- + serverClass.getName()
- + " and doesn't return a Registration object",
+ assertEquals("Method " + method.getName()
+ + " is not deprectated in class "
+ + serverClass.getName()
+ + " and doesn't return a Registration object",
Registration.class, returnType);
}
if (ALLOW_REMOVE_LISTENER.stream()
@@ -60,7 +62,7 @@ public class RemoveListenersDeprecatedTest {
}
if (removePattern.matcher(method.getName()).matches()) {
- Assert.assertNotNull(
+ assertNotNull(
"Method " + method.getName() + " in class "
+ serverClass.getName()
+ " has not been marked as deprecated.",
@@ -68,7 +70,7 @@ public class RemoveListenersDeprecatedTest {
}
}
}
- Assert.assertTrue(count > 0);
+ assertTrue(count > 0);
}
private static boolean acceptMethodEventSource(Method method) {
diff --git a/server/src/test/java/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java b/server/src/test/java/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java
index 3017bc3e37..08ad5a9bac 100644
--- a/server/src/test/java/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java
+++ b/server/src/test/java/com/vaadin/server/TestAbstractApplicationServletStaticFilesLocation.java
@@ -3,13 +3,13 @@ package com.vaadin.server;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
+import static org.junit.Assert.assertEquals;
import java.net.MalformedURLException;
import java.net.URL;
import javax.servlet.http.HttpServletRequest;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -34,30 +34,30 @@ public class TestAbstractApplicationServletStaticFilesLocation {
// should return . (relative url resolving to /contextpath)
location = testLocation("http://dummy.host:8080", "/contextpath",
"/servlet", "");
- Assert.assertEquals(".", location);
+ assertEquals(".", location);
// http://dummy.host:8080/contextpath/servlet/
// should return ./.. (relative url resolving to /contextpath)
location = testLocation("http://dummy.host:8080", "/contextpath",
"/servlet", "/");
- Assert.assertEquals("./..", location);
+ assertEquals("./..", location);
// http://dummy.host:8080/servlet
// should return "."
location = testLocation("http://dummy.host:8080", "", "/servlet", "");
- Assert.assertEquals(".", location);
+ assertEquals(".", location);
// http://dummy.host/contextpath/servlet/extra/stuff
// should return ./../.. (relative url resolving to /contextpath)
location = testLocation("http://dummy.host", "/contextpath", "/servlet",
"/extra/stuff");
- Assert.assertEquals("./../..", location);
+ assertEquals("./../..", location);
// http://dummy.host/context/path/servlet/extra/stuff
// should return ./../.. (relative url resolving to /context/path)
location = testLocation("http://dummy.host", "/context/path",
"/servlet", "/extra/stuff");
- Assert.assertEquals("./../..", location);
+ assertEquals("./../..", location);
/* Include requests */
// Include request support dropped with support for portlet1
diff --git a/server/src/test/java/com/vaadin/server/UIProviderTest.java b/server/src/test/java/com/vaadin/server/UIProviderTest.java
index f55e489c0a..92b37fed2f 100644
--- a/server/src/test/java/com/vaadin/server/UIProviderTest.java
+++ b/server/src/test/java/com/vaadin/server/UIProviderTest.java
@@ -15,12 +15,14 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.annotations.Theme;
@@ -35,43 +37,40 @@ public class UIProviderTest {
@Test
public void getAnnotationFor_widgetsetAnnotationForSubclass_annotationFound() {
- Assert.assertNotNull("Widgetset annotation is not found for subclass",
+ assertNotNull("Widgetset annotation is not found for subclass",
UIProvider.getAnnotationFor(TestClass.class, Widgetset.class));
}
@Test
public void getAnnotationFor_themeAnnotationForSubclass_annotationFound() {
- Assert.assertNotNull("Theme annotation is not found for subclass",
+ assertNotNull("Theme annotation is not found for subclass",
UIProvider.getAnnotationFor(TestClass.class, Theme.class));
}
@Test
public void getAnnotationFor_themeAnnotationForSubclass_annotationOverridden() {
- Assert.assertEquals(
- "Theme annotation is not overridden correctly in subclass", "c",
- UIProvider.getAnnotationFor(TestClass.class, Theme.class)
+ assertEquals("Theme annotation is not overridden correctly in subclass",
+ "c", UIProvider.getAnnotationFor(TestClass.class, Theme.class)
.value());
}
@Test
public void getAnnotationFor_notInheritedAnnotationForSubclass_annotationFound() {
- Assert.assertNotNull(
- "TestAnnotation annotation is not found for subclass",
+ assertNotNull("TestAnnotation annotation is not found for subclass",
UIProvider.getAnnotationFor(TestClass.class,
TestAnnotation.class));
}
@Test
public void getAnnotationFor_directAnnotationForSubclass_annotationFound() {
- Assert.assertNotNull(
- "TestAnnotation1 annotation is not found for subclass",
+ assertNotNull("TestAnnotation1 annotation is not found for subclass",
UIProvider.getAnnotationFor(TestClass.class,
TestAnnotation1.class));
}
@Test
public void getAnnotationFor_annotationInheritedFromInterface_annotationFound() {
- Assert.assertNotNull("Theme annotation is not inherited from interface",
+ assertNotNull("Theme annotation is not inherited from interface",
UIProvider.getAnnotationFor(ClassImplementingInterface.class,
Theme.class));
}
diff --git a/server/src/test/java/com/vaadin/server/VaadinPortletServiceTest.java b/server/src/test/java/com/vaadin/server/VaadinPortletServiceTest.java
index c109a62a79..ccd6aba6e5 100644
--- a/server/src/test/java/com/vaadin/server/VaadinPortletServiceTest.java
+++ b/server/src/test/java/com/vaadin/server/VaadinPortletServiceTest.java
@@ -17,12 +17,13 @@ package com.vaadin.server;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.concurrent.locks.ReentrantLock;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -211,9 +212,9 @@ public class VaadinPortletServiceTest {
.thenReturn(emptyWrappedSession);
UI ui = sut.findUI(requestWithUIIDSet);
- Assert.assertNull("Unset session did not return null", ui);
+ assertNull("Unset session did not return null", ui);
} catch (NullPointerException e) {
- Assert.fail("findUI threw a NullPointerException");
+ fail("findUI threw a NullPointerException");
}
}
}
diff --git a/server/src/test/java/com/vaadin/server/VaadinServiceTest.java b/server/src/test/java/com/vaadin/server/VaadinServiceTest.java
index 7d6cc70146..6219be0a29 100644
--- a/server/src/test/java/com/vaadin/server/VaadinServiceTest.java
+++ b/server/src/test/java/com/vaadin/server/VaadinServiceTest.java
@@ -17,13 +17,13 @@ package com.vaadin.server;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpSessionBindingEvent;
import org.easymock.EasyMock;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.shared.Registration;
@@ -72,20 +72,20 @@ public class VaadinServiceTest {
MockVaadinSession vaadinSession = new MockVaadinSession(service);
service.fireSessionDestroy(vaadinSession);
- Assert.assertEquals(
+ assertEquals(
"'fireSessionDestroy' method doesn't call 'close' for the session",
1, vaadinSession.getCloseCount());
vaadinSession.valueUnbound(
EasyMock.createMock(HttpSessionBindingEvent.class));
- Assert.assertEquals(
+ assertEquals(
"'fireSessionDestroy' method may not call 'close' "
+ "method for closing session",
1, vaadinSession.getCloseCount());
- Assert.assertEquals("SessionDestroyListeners not called exactly once",
- 1, listener.callCount);
+ assertEquals("SessionDestroyListeners not called exactly once", 1,
+ listener.callCount);
}
@Test
@@ -164,7 +164,7 @@ public class VaadinServiceTest {
CurrentInstance.set(String.class, "Original value");
service.runPendingAccessTasks(session);
- Assert.assertEquals(
+ assertEquals(
"Original CurrentInstance should be set after the task has been run",
"Original value", CurrentInstance.get(String.class));
}
@@ -190,13 +190,13 @@ public class VaadinServiceTest {
Registration remover2 = service.addServiceDestroyListener(listener2);
service.destroy();
- Assert.assertEquals(1, listener.callCount);
- Assert.assertEquals(1, listener2.callCount);
+ assertEquals(1, listener.callCount);
+ assertEquals(1, listener2.callCount);
service.removeServiceDestroyListener(listener);
remover2.remove();
service.destroy();
- Assert.assertEquals(1, listener.callCount);
- Assert.assertEquals(1, listener2.callCount);
+ assertEquals(1, listener.callCount);
+ assertEquals(1, listener2.callCount);
}
}
diff --git a/server/src/test/java/com/vaadin/server/VaadinServletConfigurationTest.java b/server/src/test/java/com/vaadin/server/VaadinServletConfigurationTest.java
index bc13afa4fd..5e6176df53 100644
--- a/server/src/test/java/com/vaadin/server/VaadinServletConfigurationTest.java
+++ b/server/src/test/java/com/vaadin/server/VaadinServletConfigurationTest.java
@@ -19,13 +19,16 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.Properties;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import org.easymock.EasyMock;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.annotations.VaadinServletConfiguration;
@@ -43,7 +46,7 @@ public class VaadinServletConfigurationTest {
.getUIClass(new UIClassSelectionEvent(new VaadinServletRequest(
EasyMock.createMock(HttpServletRequest.class),
servlet.getService())));
- Assert.assertEquals(MockUIContainingServlet.class, uiClass);
+ assertEquals(MockUIContainingServlet.class, uiClass);
}
@Test
@@ -53,16 +56,16 @@ public class VaadinServletConfigurationTest {
DeploymentConfiguration configuration = servlet.getService()
.getDeploymentConfiguration();
- Assert.assertTrue(configuration.isProductionMode());
- Assert.assertTrue(configuration.isCloseIdleSessions());
- Assert.assertEquals(1234, configuration.getHeartbeatInterval());
- Assert.assertEquals(4321, configuration.getResourceCacheTime());
+ assertTrue(configuration.isProductionMode());
+ assertTrue(configuration.isCloseIdleSessions());
+ assertEquals(1234, configuration.getHeartbeatInterval());
+ assertEquals(4321, configuration.getResourceCacheTime());
Class<? extends UI> uiClass = new DefaultUIProvider()
.getUIClass(new UIClassSelectionEvent(new VaadinServletRequest(
EasyMock.createMock(HttpServletRequest.class),
servlet.getService())));
- Assert.assertEquals(MockUIContainingServlet.class, uiClass);
+ assertEquals(MockUIContainingServlet.class, uiClass);
}
@Test
@@ -77,18 +80,18 @@ public class VaadinServletConfigurationTest {
.getDeploymentConfiguration();
// Values from servlet init params take precedence
- Assert.assertEquals(1111, configuration.getHeartbeatInterval());
- Assert.assertFalse(configuration.isProductionMode());
+ assertEquals(1111, configuration.getHeartbeatInterval());
+ assertFalse(configuration.isProductionMode());
// Other params are as defined in the annotation
- Assert.assertTrue(configuration.isCloseIdleSessions());
- Assert.assertEquals(4321, configuration.getResourceCacheTime());
+ assertTrue(configuration.isCloseIdleSessions());
+ assertEquals(4321, configuration.getResourceCacheTime());
Class<? extends UI> uiClass = new DefaultUIProvider()
.getUIClass(new UIClassSelectionEvent(new VaadinServletRequest(
EasyMock.createMock(HttpServletRequest.class),
servlet.getService())));
- Assert.assertEquals(MockUIContainingServlet.class, uiClass);
+ assertEquals(MockUIContainingServlet.class, uiClass);
}
}
diff --git a/server/src/test/java/com/vaadin/server/VaadinServletServiceTest.java b/server/src/test/java/com/vaadin/server/VaadinServletServiceTest.java
index 24bb800a12..1630d3b968 100644
--- a/server/src/test/java/com/vaadin/server/VaadinServletServiceTest.java
+++ b/server/src/test/java/com/vaadin/server/VaadinServletServiceTest.java
@@ -3,6 +3,7 @@ package com.vaadin.server;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
+import static org.junit.Assert.assertEquals;
import java.net.MalformedURLException;
import java.net.URL;
@@ -10,7 +11,6 @@ import java.net.URL;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -32,36 +32,36 @@ public class VaadinServletServiceTest {
// should return . (relative url resolving to /contextpath)
location = testLocation("http://dummy.host:8080", "/contextpath",
"/servlet", "");
- Assert.assertEquals(".", location);
+ assertEquals(".", location);
// http://dummy.host:8080/contextpath/servlet/
// should return ./.. (relative url resolving to /contextpath)
location = testLocation("http://dummy.host:8080", "/contextpath",
"/servlet", "/");
- Assert.assertEquals("./..", location);
+ assertEquals("./..", location);
// http://dummy.host:8080/servlet
// should return "."
location = testLocation("http://dummy.host:8080", "", "/servlet", "");
- Assert.assertEquals(".", location);
+ assertEquals(".", location);
// http://dummy.host/contextpath/servlet/extra/stuff
// should return ./../.. (relative url resolving to /contextpath)
location = testLocation("http://dummy.host", "/contextpath", "/servlet",
"/extra/stuff");
- Assert.assertEquals("./../..", location);
+ assertEquals("./../..", location);
// http://dummy.host/contextpath/servlet/extra/stuff/
// should return ./../.. (relative url resolving to /contextpath)
location = testLocation("http://dummy.host", "/contextpath", "/servlet",
"/extra/stuff/");
- Assert.assertEquals("./../../..", location);
+ assertEquals("./../../..", location);
// http://dummy.host/context/path/servlet/extra/stuff
// should return ./../.. (relative url resolving to /context/path)
location = testLocation("http://dummy.host", "/context/path",
"/servlet", "/extra/stuff");
- Assert.assertEquals("./../..", location);
+ assertEquals("./../..", location);
}
diff --git a/server/src/test/java/com/vaadin/server/VaadinServletTest.java b/server/src/test/java/com/vaadin/server/VaadinServletTest.java
index 296d4e8c40..13bde9699c 100644
--- a/server/src/test/java/com/vaadin/server/VaadinServletTest.java
+++ b/server/src/test/java/com/vaadin/server/VaadinServletTest.java
@@ -15,9 +15,11 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
import javax.servlet.http.HttpServletRequest;
-import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
@@ -25,39 +27,39 @@ public class VaadinServletTest {
@Test
public void testGetLastPathParameter() {
- Assert.assertEquals("",
+ assertEquals("",
VaadinServlet.getLastPathParameter("http://myhost.com"));
- Assert.assertEquals(";a",
+ assertEquals(";a",
VaadinServlet.getLastPathParameter("http://myhost.com;a"));
- Assert.assertEquals("",
+ assertEquals("",
VaadinServlet.getLastPathParameter("http://myhost.com/hello"));
- Assert.assertEquals(";b=c", VaadinServlet
+ assertEquals(";b=c", VaadinServlet
.getLastPathParameter("http://myhost.com/hello;b=c"));
- Assert.assertEquals("",
+ assertEquals("",
VaadinServlet.getLastPathParameter("http://myhost.com/hello/"));
- Assert.assertEquals("", VaadinServlet
+ assertEquals("", VaadinServlet
.getLastPathParameter("http://myhost.com/hello;a/"));
- Assert.assertEquals("", VaadinServlet
+ assertEquals("", VaadinServlet
.getLastPathParameter("http://myhost.com/hello;a=1/"));
- Assert.assertEquals(";b", VaadinServlet
+ assertEquals(";b", VaadinServlet
.getLastPathParameter("http://myhost.com/hello/;b"));
- Assert.assertEquals(";b=1", VaadinServlet
+ assertEquals(";b=1", VaadinServlet
.getLastPathParameter("http://myhost.com/hello/;b=1"));
- Assert.assertEquals(";b=1,c=2", VaadinServlet
+ assertEquals(";b=1,c=2", VaadinServlet
.getLastPathParameter("http://myhost.com/hello/;b=1,c=2"));
- Assert.assertEquals("", VaadinServlet
+ assertEquals("", VaadinServlet
.getLastPathParameter("http://myhost.com/hello/;b=1,c=2/"));
- Assert.assertEquals("", VaadinServlet
+ assertEquals("", VaadinServlet
.getLastPathParameter("http://myhost.com/a;hello/;a/"));
- Assert.assertEquals("", VaadinServlet
+ assertEquals("", VaadinServlet
.getLastPathParameter("http://myhost.com/a;hello/;a=1/"));
- Assert.assertEquals(";b", VaadinServlet
+ assertEquals(";b", VaadinServlet
.getLastPathParameter("http://myhost.com/a;hello/;b"));
- Assert.assertEquals(";b=1", VaadinServlet
+ assertEquals(";b=1", VaadinServlet
.getLastPathParameter("http://myhost.com/a;hello/;b=1"));
- Assert.assertEquals(";b=1,c=2", VaadinServlet
+ assertEquals(";b=1,c=2", VaadinServlet
.getLastPathParameter("http://myhost.com/a;hello/;b=1,c=2"));
- Assert.assertEquals("", VaadinServlet
+ assertEquals("", VaadinServlet
.getLastPathParameter("http://myhost.com/a;hello/;b=1,c=2/"));
}
@@ -67,61 +69,59 @@ public class VaadinServletTest {
// Mapping: /VAADIN/*
// /VAADIN
- Assert.assertNull(servlet
+ assertNull(servlet
.getStaticFilePath(createServletRequest("/VAADIN", null)));
// /VAADIN/ - not really sensible but still interpreted as a resource
// request
- Assert.assertEquals("/VAADIN/", servlet
+ assertEquals("/VAADIN/", servlet
.getStaticFilePath(createServletRequest("/VAADIN", "/")));
// /VAADIN/vaadinBootstrap.js
- Assert.assertEquals("/VAADIN/vaadinBootstrap.js",
- servlet.getStaticFilePath(createServletRequest("/VAADIN",
- "/vaadinBootstrap.js")));
+ assertEquals("/VAADIN/vaadinBootstrap.js", servlet.getStaticFilePath(
+ createServletRequest("/VAADIN", "/vaadinBootstrap.js")));
// /VAADIN/foo bar.js
- Assert.assertEquals("/VAADIN/foo bar.js", servlet.getStaticFilePath(
+ assertEquals("/VAADIN/foo bar.js", servlet.getStaticFilePath(
createServletRequest("/VAADIN", "/foo bar.js")));
// /VAADIN/.. - not normalized and disallowed in this method
- Assert.assertEquals("/VAADIN/..", servlet
+ assertEquals("/VAADIN/..", servlet
.getStaticFilePath(createServletRequest("/VAADIN", "/..")));
// Mapping: /*
// /
- Assert.assertNull(
- servlet.getStaticFilePath(createServletRequest("", null)));
+ assertNull(servlet.getStaticFilePath(createServletRequest("", null)));
// /VAADIN
- Assert.assertNull(
+ assertNull(
servlet.getStaticFilePath(createServletRequest("", "/VAADIN")));
// /VAADIN/
- Assert.assertEquals("/VAADIN/", servlet
+ assertEquals("/VAADIN/", servlet
.getStaticFilePath(createServletRequest("", "/VAADIN/")));
// /VAADIN/foo bar.js
- Assert.assertEquals("/VAADIN/foo bar.js", servlet.getStaticFilePath(
+ assertEquals("/VAADIN/foo bar.js", servlet.getStaticFilePath(
createServletRequest("", "/VAADIN/foo bar.js")));
// /VAADIN/.. - not normalized and disallowed in this method
- Assert.assertEquals("/VAADIN/..", servlet
+ assertEquals("/VAADIN/..", servlet
.getStaticFilePath(createServletRequest("", "/VAADIN/..")));
// /BAADIN/foo.js
- Assert.assertNull(servlet
+ assertNull(servlet
.getStaticFilePath(createServletRequest("", "/BAADIN/foo.js")));
// Mapping: /myservlet/*
// /myservlet
- Assert.assertNull(servlet
+ assertNull(servlet
.getStaticFilePath(createServletRequest("/myservlet", null)));
// /myservlet/VAADIN
- Assert.assertNull(servlet.getStaticFilePath(
+ assertNull(servlet.getStaticFilePath(
createServletRequest("/myservlet", "/VAADIN")));
// /myservlet/VAADIN/
- Assert.assertEquals("/VAADIN/", servlet.getStaticFilePath(
+ assertEquals("/VAADIN/", servlet.getStaticFilePath(
createServletRequest("/myservlet", "/VAADIN/")));
// /myservlet/VAADIN/foo bar.js
- Assert.assertEquals("/VAADIN/foo bar.js", servlet.getStaticFilePath(
+ assertEquals("/VAADIN/foo bar.js", servlet.getStaticFilePath(
createServletRequest("/myservlet", "/VAADIN/foo bar.js")));
// /myservlet/VAADIN/.. - not normalized and disallowed in this method
- Assert.assertEquals("/VAADIN/..", servlet.getStaticFilePath(
+ assertEquals("/VAADIN/..", servlet.getStaticFilePath(
createServletRequest("/myservlet", "/VAADIN/..")));
// /myservlet/BAADIN/foo.js
- Assert.assertNull(servlet.getStaticFilePath(
+ assertNull(servlet.getStaticFilePath(
createServletRequest("/myservlet", "/BAADIN/foo.js")));
}
diff --git a/server/src/test/java/com/vaadin/server/VaadinSessionTest.java b/server/src/test/java/com/vaadin/server/VaadinSessionTest.java
index a3d0746149..ccd610269c 100644
--- a/server/src/test/java/com/vaadin/server/VaadinSessionTest.java
+++ b/server/src/test/java/com/vaadin/server/VaadinSessionTest.java
@@ -15,6 +15,12 @@
*/
package com.vaadin.server;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -33,7 +39,6 @@ import javax.servlet.http.HttpSessionBindingEvent;
import org.easymock.EasyMock;
import org.easymock.IMocksControl;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -196,11 +201,11 @@ public class VaadinSessionTest implements Serializable {
final AtomicBoolean detachCalled = new AtomicBoolean(false);
ui.addDetachListener((DetachEvent event) -> {
detachCalled.set(true);
- Assert.assertEquals(ui, UI.getCurrent());
- Assert.assertEquals(ui.getPage(), Page.getCurrent());
- Assert.assertEquals(session, VaadinSession.getCurrent());
- Assert.assertEquals(mockService, VaadinService.getCurrent());
- Assert.assertEquals(mockServlet, VaadinServlet.getCurrent());
+ assertEquals(ui, UI.getCurrent());
+ assertEquals(ui.getPage(), Page.getCurrent());
+ assertEquals(session, VaadinSession.getCurrent());
+ assertEquals(mockService, VaadinService.getCurrent());
+ assertEquals(mockServlet, VaadinServlet.getCurrent());
});
session.valueUnbound(
@@ -211,7 +216,7 @@ public class VaadinSessionTest implements Serializable {
// VaadinService.fireSessionDestroy,
// we need to run the
// pending task ourselves
- Assert.assertTrue(detachCalled.get());
+ assertTrue(detachCalled.get());
}
@Test
@@ -219,11 +224,11 @@ public class VaadinSessionTest implements Serializable {
final AtomicBoolean detachCalled = new AtomicBoolean(false);
ui.addDetachListener((DetachEvent event) -> {
detachCalled.set(true);
- Assert.assertEquals(ui, UI.getCurrent());
- Assert.assertEquals(ui.getPage(), Page.getCurrent());
- Assert.assertEquals(session, VaadinSession.getCurrent());
- Assert.assertEquals(mockService, VaadinService.getCurrent());
- Assert.assertEquals(mockServlet, VaadinServlet.getCurrent());
+ assertEquals(ui, UI.getCurrent());
+ assertEquals(ui.getPage(), Page.getCurrent());
+ assertEquals(session, VaadinSession.getCurrent());
+ assertEquals(mockService, VaadinService.getCurrent());
+ assertEquals(mockServlet, VaadinServlet.getCurrent());
});
CurrentInstance.clearAll();
session.close();
@@ -234,7 +239,7 @@ public class VaadinSessionTest implements Serializable {
// VaadinService.fireSessionDestroy,
// we need to run the
// pending task ourselves
- Assert.assertTrue(detachCalled.get());
+ assertTrue(detachCalled.get());
}
@Test
@@ -287,8 +292,8 @@ public class VaadinSessionTest implements Serializable {
VaadinSession.setCurrent(session);
session.lock();
SerializationTestLabel label = new SerializationTestLabel();
- Assert.assertEquals("Session should be set when instance is created",
- session, label.session);
+ assertEquals("Session should be set when instance is created", session,
+ label.session);
ui.setContent(label);
int uiId = ui.getUIId();
@@ -307,11 +312,10 @@ public class VaadinSessionTest implements Serializable {
VaadinSession deserializedSession = (VaadinSession) in.readObject();
- Assert.assertNull("Current session shouldn't leak from deserialisation",
+ assertNull("Current session shouldn't leak from deserialisation",
VaadinSession.getCurrent());
- Assert.assertNotSame("Should get a new session", session,
- deserializedSession);
+ assertNotSame("Should get a new session", session, deserializedSession);
// Restore http session and service instance so the session can be
// locked
@@ -322,7 +326,7 @@ public class VaadinSessionTest implements Serializable {
SerializationTestLabel deserializedLabel = (SerializationTestLabel) deserializedUi
.getContent();
- Assert.assertEquals(
+ assertEquals(
"Current session should be available in SerializationTestLabel.readObject",
deserializedSession, deserializedLabel.session);
deserializedSession.unlock();
@@ -335,20 +339,20 @@ public class VaadinSessionTest implements Serializable {
ui.setContent(new Label() {
private void writeObject(ObjectOutputStream out)
throws IOException {
- Assert.assertTrue(session.hasLock());
+ assertTrue(session.hasLock());
lockChecked.set(true);
out.defaultWriteObject();
}
});
session.unlock();
- Assert.assertFalse(session.hasLock());
+ assertFalse(session.hasLock());
ObjectOutputStream out = new ObjectOutputStream(
new ByteArrayOutputStream());
out.writeObject(session);
- Assert.assertFalse(session.hasLock());
- Assert.assertTrue(lockChecked.get());
+ assertFalse(session.hasLock());
+ assertTrue(lockChecked.get());
}
}
diff --git a/server/src/test/java/com/vaadin/server/communication/AtmospherePushConnectionTest.java b/server/src/test/java/com/vaadin/server/communication/AtmospherePushConnectionTest.java
index d377496e19..49e32ebeec 100644
--- a/server/src/test/java/com/vaadin/server/communication/AtmospherePushConnectionTest.java
+++ b/server/src/test/java/com/vaadin/server/communication/AtmospherePushConnectionTest.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.server.communication;
+import static org.junit.Assert.assertEquals;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
@@ -22,7 +24,6 @@ import java.io.ObjectOutputStream;
import org.atmosphere.cpr.AtmosphereResource;
import org.easymock.EasyMock;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.server.communication.AtmospherePushConnection.State;
@@ -39,7 +40,7 @@ public class AtmospherePushConnectionTest {
AtmospherePushConnection connection = new AtmospherePushConnection(ui);
connection.connect(resource);
- Assert.assertEquals(State.CONNECTED, connection.getState());
+ assertEquals(State.CONNECTED, connection.getState());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -48,6 +49,6 @@ public class AtmospherePushConnectionTest {
connection = (AtmospherePushConnection) new ObjectInputStream(
new ByteArrayInputStream(baos.toByteArray())).readObject();
- Assert.assertEquals(State.DISCONNECTED, connection.getState());
+ assertEquals(State.DISCONNECTED, connection.getState());
}
}
diff --git a/server/src/test/java/com/vaadin/server/communication/MetadataWriterTest.java b/server/src/test/java/com/vaadin/server/communication/MetadataWriterTest.java
index 679598de91..04d85e80b7 100644
--- a/server/src/test/java/com/vaadin/server/communication/MetadataWriterTest.java
+++ b/server/src/test/java/com/vaadin/server/communication/MetadataWriterTest.java
@@ -15,13 +15,13 @@
*/
package com.vaadin.server.communication;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.io.IOException;
import java.io.StringWriter;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -56,20 +56,19 @@ public class MetadataWriterTest {
@Test
public void writeAsyncTag() throws Exception {
new MetadataWriter().write(ui, writer, false, true, messages);
- Assert.assertEquals("{\"async\":true}", writer.getBuffer().toString());
+ assertEquals("{\"async\":true}", writer.getBuffer().toString());
}
@Test
public void writeRepaintTag() throws Exception {
new MetadataWriter().write(ui, writer, true, false, messages);
- Assert.assertEquals("{\"repaintAll\":true}",
- writer.getBuffer().toString());
+ assertEquals("{\"repaintAll\":true}", writer.getBuffer().toString());
}
@Test
public void writeRepaintAndAsyncTag() throws Exception {
new MetadataWriter().write(ui, writer, true, true, messages);
- Assert.assertEquals("{\"repaintAll\":true, \"async\":true}",
+ assertEquals("{\"repaintAll\":true, \"async\":true}",
writer.getBuffer().toString());
}
@@ -78,7 +77,7 @@ public class MetadataWriterTest {
disableSessionExpirationMessages(messages);
new MetadataWriter().write(ui, writer, false, false, messages);
- Assert.assertEquals("{}", writer.getBuffer().toString());
+ assertEquals("{}", writer.getBuffer().toString());
}
@Test
@@ -89,8 +88,7 @@ public class MetadataWriterTest {
disableSessionExpirationMessages(messages);
new MetadataWriter().write(ui, writer, false, false, messages);
- Assert.assertEquals(
- "{\"timedRedirect\":{\"interval\":15,\"url\":\"\"}}",
+ assertEquals("{\"timedRedirect\":{\"interval\":15,\"url\":\"\"}}",
writer.getBuffer().toString());
}
@@ -102,7 +100,7 @@ public class MetadataWriterTest {
disableSessionExpirationMessages(messages);
new MetadataWriter().write(ui, writer, false, true, messages);
- Assert.assertEquals(
+ assertEquals(
"{\"async\":true,\"timedRedirect\":{\"interval\":15,\"url\":\"\"}}",
writer.getBuffer().toString());
}
diff --git a/server/src/test/java/com/vaadin/server/communication/ServletUIInitHandlerTest.java b/server/src/test/java/com/vaadin/server/communication/ServletUIInitHandlerTest.java
index 6c61922307..6ded996687 100644
--- a/server/src/test/java/com/vaadin/server/communication/ServletUIInitHandlerTest.java
+++ b/server/src/test/java/com/vaadin/server/communication/ServletUIInitHandlerTest.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.server.communication;
+import static org.junit.Assert.assertEquals;
+
import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicInteger;
@@ -24,7 +26,6 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
@@ -145,9 +146,9 @@ public class ServletUIInitHandlerTest {
}
});
- Assert.assertEquals(1, pre.getAndIncrement());
- Assert.assertEquals(1, errorHandlerCalls.getAndIncrement());
- Assert.assertEquals(mock.session, ui.getSession());
+ assertEquals(1, pre.getAndIncrement());
+ assertEquals(1, errorHandlerCalls.getAndIncrement());
+ assertEquals(mock.session, ui.getSession());
}
@Test
@@ -180,9 +181,9 @@ public class ServletUIInitHandlerTest {
}
});
- Assert.assertEquals(1, pre.getAndIncrement());
+ assertEquals(1, pre.getAndIncrement());
// Default error handler only logs the exception
- Assert.assertEquals(mock.session, ui.getSession());
+ assertEquals(mock.session, ui.getSession());
}
}
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 8fc5fc28b6..10094dc8f0 100644
--- a/server/src/test/java/com/vaadin/tests/components/TreeTest.java
+++ b/server/src/test/java/com/vaadin/tests/components/TreeTest.java
@@ -36,7 +36,7 @@ public class TreeTest {
public void itemCollapse(CollapseEvent<String> event) {
assertEquals("Source component was incorrect", tree,
event.getComponent());
- Assert.assertFalse("Multiple collapse events", collapsed);
+ assertFalse("Multiple collapse events", collapsed);
collapsed = true;
}
@@ -44,7 +44,7 @@ public class TreeTest {
public void itemExpand(ExpandEvent<String> event) {
assertEquals("Source component was incorrect", tree,
event.getComponent());
- Assert.assertFalse("Multiple expand events", expanded);
+ assertFalse("Multiple expand events", expanded);
expanded = true;
}
@@ -71,13 +71,13 @@ public class TreeTest {
tree.addExpandListener(listener);
tree.addCollapseListener(listener);
- Assert.assertFalse(listener.isExpanded());
+ assertFalse(listener.isExpanded());
tree.expand("Foo");
assertTrue("Item not expanded", tree.isExpanded("Foo"));
assertTrue("Expand event not fired", listener.isExpanded());
- Assert.assertFalse(listener.isCollapsed());
+ assertFalse(listener.isCollapsed());
tree.collapse("Foo");
- Assert.assertFalse("Item not collapsed", tree.isExpanded("Foo"));
+ assertFalse("Item not collapsed", tree.isExpanded("Foo"));
assertTrue("Collapse event not fired", listener.isCollapsed());
}
diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridComponentRendererTest.java b/server/src/test/java/com/vaadin/tests/components/grid/GridComponentRendererTest.java
index d0b2b11dca..e8cfc63ec5 100644
--- a/server/src/test/java/com/vaadin/tests/components/grid/GridComponentRendererTest.java
+++ b/server/src/test/java/com/vaadin/tests/components/grid/GridComponentRendererTest.java
@@ -1,10 +1,12 @@
package com.vaadin.tests.components.grid;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -55,7 +57,7 @@ public class GridComponentRendererTest {
generateDataForClient(true);
dataProvider.refreshItem(PERSON);
generateDataForClient(false);
- Assert.assertNotNull("Old component should exist.", oldComponent);
+ assertNotNull("Old component should exist.", oldComponent);
}
@Test
@@ -63,26 +65,25 @@ public class GridComponentRendererTest {
generateDataForClient(true);
grid.select(PERSON);
generateDataForClient(false);
- Assert.assertNotNull("Old component should exist.", oldComponent);
+ assertNotNull("Old component should exist.", oldComponent);
}
@Test
public void testComponentChangeOnDataProviderChange() {
generateDataForClient(true);
grid.setItems(PERSON);
- Assert.assertEquals(
- "Test component was not detached on DataProvider change.", null,
- testComponent.getParent());
+ assertEquals("Test component was not detached on DataProvider change.",
+ null, testComponent.getParent());
}
private void generateDataForClient(boolean initial) {
grid.getDataCommunicator().beforeClientResponse(initial);
if (testComponent != null) {
- Assert.assertEquals("New component was not attached.", grid,
+ assertEquals("New component was not attached.", grid,
testComponent.getParent());
}
if (oldComponent != null) {
- Assert.assertEquals("Old component was not detached.", null,
+ assertEquals("Old component was not detached.", null,
oldComponent.getParent());
}
}
diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java b/server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java
index 3b107d6c9b..f6696155c2 100644
--- a/server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java
+++ b/server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.components.grid;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
@@ -19,7 +20,6 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.IntStream;
import org.easymock.Capture;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -169,11 +169,11 @@ public class GridMultiSelectionModelTest {
customGrid.getDataCommunicator().beforeClientResponse(true);
- Assert.assertFalse("Item should have been updated as selected",
+ assertFalse("Item should have been updated as selected",
customModel.generatedData.get("Foo"));
- Assert.assertFalse("Item should have been updated as NOT selected",
+ assertFalse("Item should have been updated as NOT selected",
customModel.generatedData.get("Bar"));
- Assert.assertFalse("Item should have been updated as NOT selected",
+ assertFalse("Item should have been updated as NOT selected",
customModel.generatedData.get("Baz"));
customModel.generatedData.clear();
@@ -181,11 +181,11 @@ public class GridMultiSelectionModelTest {
customGrid.getSelectionModel().select("Foo");
customGrid.getDataCommunicator().beforeClientResponse(false);
- Assert.assertTrue("Item should have been updated as selected",
+ assertTrue("Item should have been updated as selected",
customModel.generatedData.get("Foo"));
- Assert.assertFalse("Item should have NOT been updated",
+ assertFalse("Item should have NOT been updated",
customModel.generatedData.containsKey("Bar"));
- Assert.assertFalse("Item should have NOT been updated",
+ assertFalse("Item should have NOT been updated",
customModel.generatedData.containsKey("Baz"));
customModel.generatedData.clear();
@@ -193,11 +193,11 @@ public class GridMultiSelectionModelTest {
customModel.updateSelection(asSet("Bar"), asSet("Foo"));
customGrid.getDataCommunicator().beforeClientResponse(false);
- Assert.assertFalse("Item should have been updated as NOT selected",
+ assertFalse("Item should have been updated as NOT selected",
customModel.generatedData.get("Foo"));
- Assert.assertTrue("Item should have been updated as selected",
+ assertTrue("Item should have been updated as selected",
customModel.generatedData.get("Bar"));
- Assert.assertFalse("Item should have NOT been updated",
+ assertFalse("Item should have NOT been updated",
customModel.generatedData.containsKey("Baz"));
// switch to single to cause event
@@ -207,7 +207,7 @@ public class GridMultiSelectionModelTest {
// changing selection model should trigger row updates, but the old
// selection model is not triggered as it has been removed
- Assert.assertTrue(customModel.generatedData.isEmpty()); // not triggered
+ assertTrue(customModel.generatedData.isEmpty()); // not triggered
}
@Test
@@ -217,22 +217,22 @@ public class GridMultiSelectionModelTest {
gridWithStrings.setItems("Foo", "Bar", "Baz");
GridSelectionModel<String> model = gridWithStrings.getSelectionModel();
- Assert.assertFalse(model.isSelected("Foo"));
+ assertFalse(model.isSelected("Foo"));
model.select("Foo");
- Assert.assertTrue(model.isSelected("Foo"));
- Assert.assertEquals(Optional.of("Foo"), model.getFirstSelectedItem());
+ assertTrue(model.isSelected("Foo"));
+ assertEquals(Optional.of("Foo"), model.getFirstSelectedItem());
model.select("Bar");
- Assert.assertTrue(model.isSelected("Foo"));
- Assert.assertTrue(model.isSelected("Bar"));
- Assert.assertEquals(Arrays.asList("Foo", "Bar"),
+ assertTrue(model.isSelected("Foo"));
+ assertTrue(model.isSelected("Bar"));
+ assertEquals(Arrays.asList("Foo", "Bar"),
new ArrayList<>(model.getSelectedItems()));
model.deselect("Bar");
- Assert.assertFalse(model.isSelected("Bar"));
- Assert.assertTrue(model.getFirstSelectedItem().isPresent());
- Assert.assertEquals(Arrays.asList("Foo"),
+ assertFalse(model.isSelected("Bar"));
+ assertTrue(model.getFirstSelectedItem().isPresent());
+ assertEquals(Arrays.asList("Foo"),
new ArrayList<>(model.getSelectedItems()));
}
@@ -598,18 +598,18 @@ public class GridMultiSelectionModelTest {
AtomicReference<MultiSelectionEvent<String>> event = new AtomicReference<>();
Registration actualRegistration = model
.addMultiSelectionListener(evt -> {
- Assert.assertNull(event.get());
+ assertNull(event.get());
event.set(evt);
});
- Assert.assertSame(registration, actualRegistration);
+ assertSame(registration, actualRegistration);
selectionListener.get().selectionChange(new MultiSelectionEvent<>(grid,
model.asMultiSelect(), Collections.emptySet(), true));
- Assert.assertEquals(grid, event.get().getComponent());
- Assert.assertEquals(new LinkedHashSet<>(Arrays.asList(value)),
+ assertEquals(grid, event.get().getComponent());
+ assertEquals(new LinkedHashSet<>(Arrays.asList(value)),
event.get().getValue());
- Assert.assertTrue(event.get().isUserOriginated());
+ assertTrue(event.get().isUserOriginated());
}
@Test
@@ -622,32 +622,32 @@ public class GridMultiSelectionModelTest {
ui.setContent(grid);
// no items yet, default data provider is empty not in memory one
- Assert.assertFalse(model.isSelectAllCheckBoxVisible());
- Assert.assertEquals(SelectAllCheckBoxVisibility.DEFAULT,
+ assertFalse(model.isSelectAllCheckBoxVisible());
+ assertEquals(SelectAllCheckBoxVisibility.DEFAULT,
model.getSelectAllCheckBoxVisibility());
grid.setItems("Foo", "Bar", "Baz");
// in-memory container keeps default
- Assert.assertTrue(model.isSelectAllCheckBoxVisible());
- Assert.assertEquals(SelectAllCheckBoxVisibility.DEFAULT,
+ assertTrue(model.isSelectAllCheckBoxVisible());
+ assertEquals(SelectAllCheckBoxVisibility.DEFAULT,
model.getSelectAllCheckBoxVisibility());
// change to explicit NO
model.setSelectAllCheckBoxVisibility(
SelectAllCheckBoxVisibility.HIDDEN);
- Assert.assertEquals(SelectAllCheckBoxVisibility.HIDDEN,
+ assertEquals(SelectAllCheckBoxVisibility.HIDDEN,
model.getSelectAllCheckBoxVisibility());
- Assert.assertFalse(model.isSelectAllCheckBoxVisible());
+ assertFalse(model.isSelectAllCheckBoxVisible());
// change to explicit YES
model.setSelectAllCheckBoxVisibility(
SelectAllCheckBoxVisibility.VISIBLE);
- Assert.assertEquals(SelectAllCheckBoxVisibility.VISIBLE,
+ assertEquals(SelectAllCheckBoxVisibility.VISIBLE,
model.getSelectAllCheckBoxVisibility());
- Assert.assertTrue(model.isSelectAllCheckBoxVisible());
+ assertTrue(model.isSelectAllCheckBoxVisible());
}
@Test
@@ -660,8 +660,8 @@ public class GridMultiSelectionModelTest {
.setSelectionMode(SelectionMode.MULTI);
// no items yet, default data provider is empty not in memory one
- Assert.assertFalse(model.isSelectAllCheckBoxVisible());
- Assert.assertEquals(SelectAllCheckBoxVisibility.DEFAULT,
+ assertFalse(model.isSelectAllCheckBoxVisible());
+ assertEquals(SelectAllCheckBoxVisibility.DEFAULT,
model.getSelectAllCheckBoxVisibility());
grid.setDataProvider(
@@ -676,32 +676,32 @@ public class GridMultiSelectionModelTest {
query -> 1000));
// not in-memory -> checkbox is hidden
- Assert.assertFalse(model.isSelectAllCheckBoxVisible());
- Assert.assertEquals(SelectAllCheckBoxVisibility.DEFAULT,
+ assertFalse(model.isSelectAllCheckBoxVisible());
+ assertEquals(SelectAllCheckBoxVisibility.DEFAULT,
model.getSelectAllCheckBoxVisibility());
// change to explicit YES
model.setSelectAllCheckBoxVisibility(
SelectAllCheckBoxVisibility.VISIBLE);
- Assert.assertEquals(SelectAllCheckBoxVisibility.VISIBLE,
+ assertEquals(SelectAllCheckBoxVisibility.VISIBLE,
model.getSelectAllCheckBoxVisibility());
- Assert.assertTrue(model.isSelectAllCheckBoxVisible());
+ assertTrue(model.isSelectAllCheckBoxVisible());
// change to explicit NO
model.setSelectAllCheckBoxVisibility(
SelectAllCheckBoxVisibility.HIDDEN);
- Assert.assertEquals(SelectAllCheckBoxVisibility.HIDDEN,
+ assertEquals(SelectAllCheckBoxVisibility.HIDDEN,
model.getSelectAllCheckBoxVisibility());
- Assert.assertFalse(model.isSelectAllCheckBoxVisible());
+ assertFalse(model.isSelectAllCheckBoxVisible());
// change back to depends on data provider
model.setSelectAllCheckBoxVisibility(
SelectAllCheckBoxVisibility.DEFAULT);
- Assert.assertFalse(model.isSelectAllCheckBoxVisible());
- Assert.assertEquals(SelectAllCheckBoxVisibility.DEFAULT,
+ assertFalse(model.isSelectAllCheckBoxVisible());
+ assertEquals(SelectAllCheckBoxVisibility.DEFAULT,
model.getSelectAllCheckBoxVisibility());
}
diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridNoSelectionModelTest.java b/server/src/test/java/com/vaadin/tests/components/grid/GridNoSelectionModelTest.java
index 4222b20d15..a33387e256 100644
--- a/server/src/test/java/com/vaadin/tests/components/grid/GridNoSelectionModelTest.java
+++ b/server/src/test/java/com/vaadin/tests/components/grid/GridNoSelectionModelTest.java
@@ -1,10 +1,12 @@
package com.vaadin.tests.components.grid;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.Optional;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -34,15 +36,15 @@ public class GridNoSelectionModelTest {
public void select() {
model.select(PERSON_A);
- Assert.assertFalse(model.isSelected(PERSON_A));
- Assert.assertEquals(0, model.getSelectedItems().size());
- Assert.assertEquals(Optional.empty(), model.getFirstSelectedItem());
+ assertFalse(model.isSelected(PERSON_A));
+ assertEquals(0, model.getSelectedItems().size());
+ assertEquals(Optional.empty(), model.getFirstSelectedItem());
model.select(PERSON_B);
- Assert.assertFalse(model.isSelected(PERSON_B));
- Assert.assertEquals(0, model.getSelectedItems().size());
- Assert.assertEquals(Optional.empty(), model.getFirstSelectedItem());
+ assertFalse(model.isSelected(PERSON_B));
+ assertEquals(0, model.getSelectedItems().size());
+ assertEquals(Optional.empty(), model.getFirstSelectedItem());
}
@Test
@@ -50,7 +52,7 @@ public class GridNoSelectionModelTest {
grid.setSelectionMode(SelectionMode.SINGLE);
grid.getSelectionModel().select(PERSON_B);
- Assert.assertEquals(PERSON_B,
+ assertEquals(PERSON_B,
grid.getSelectionModel().getFirstSelectedItem().get());
}
@@ -59,7 +61,7 @@ public class GridNoSelectionModelTest {
grid.setSelectionMode(SelectionMode.MULTI);
grid.getSelectionModel().select(PERSON_B);
- Assert.assertEquals(new LinkedHashSet<>(Arrays.asList(PERSON_B)),
+ assertEquals(new LinkedHashSet<>(Arrays.asList(PERSON_B)),
grid.getSelectionModel().getSelectedItems());
}
diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java b/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java
index c68cb2901c..b3040f8725 100644
--- a/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java
+++ b/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSort.java
@@ -1,10 +1,11 @@
package com.vaadin.tests.components.grid;
+import static org.junit.Assert.assertEquals;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -148,7 +149,7 @@ public class GridNullValueSort {
.createSortingComparator();
List<Integer> data = new ArrayList<>(source);
data.sort(sortingComparator);
- Assert.assertEquals(expected, data);
+ assertEquals(expected, data);
}
}
diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridSelectionModeTest.java b/server/src/test/java/com/vaadin/tests/components/grid/GridSelectionModeTest.java
index e9515be789..c8ca4cf791 100644
--- a/server/src/test/java/com/vaadin/tests/components/grid/GridSelectionModeTest.java
+++ b/server/src/test/java/com/vaadin/tests/components/grid/GridSelectionModeTest.java
@@ -1,6 +1,7 @@
package com.vaadin.tests.components.grid;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Before;
import org.junit.Test;
@@ -22,22 +23,22 @@ public class GridSelectionModeTest {
@Test
public void testSelectionModes() {
- Assert.assertEquals(SingleSelectionModelImpl.class,
+ assertEquals(SingleSelectionModelImpl.class,
grid.getSelectionModel().getClass());
- Assert.assertEquals(MultiSelectionModelImpl.class,
+ assertEquals(MultiSelectionModelImpl.class,
grid.setSelectionMode(SelectionMode.MULTI).getClass());
- Assert.assertEquals(MultiSelectionModelImpl.class,
+ assertEquals(MultiSelectionModelImpl.class,
grid.getSelectionModel().getClass());
- Assert.assertEquals(NoSelectionModel.class,
+ assertEquals(NoSelectionModel.class,
grid.setSelectionMode(SelectionMode.NONE).getClass());
- Assert.assertEquals(NoSelectionModel.class,
+ assertEquals(NoSelectionModel.class,
grid.getSelectionModel().getClass());
- Assert.assertEquals(SingleSelectionModelImpl.class,
+ assertEquals(SingleSelectionModelImpl.class,
grid.setSelectionMode(SelectionMode.SINGLE).getClass());
- Assert.assertEquals(SingleSelectionModelImpl.class,
+ assertEquals(SingleSelectionModelImpl.class,
grid.getSelectionModel().getClass());
}
diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridSingleSelectionModelTest.java b/server/src/test/java/com/vaadin/tests/components/grid/GridSingleSelectionModelTest.java
index ce4da636d0..5791e2bc9d 100644
--- a/server/src/test/java/com/vaadin/tests/components/grid/GridSingleSelectionModelTest.java
+++ b/server/src/test/java/com/vaadin/tests/components/grid/GridSingleSelectionModelTest.java
@@ -2,6 +2,8 @@ package com.vaadin.tests.components.grid;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
@@ -12,7 +14,6 @@ import java.util.Map;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -127,11 +128,11 @@ public class GridSingleSelectionModelTest {
customGrid.getDataCommunicator().beforeClientResponse(true);
- Assert.assertFalse("Item should have been updated as selected",
+ assertFalse("Item should have been updated as selected",
customModel.generatedData.get("Foo"));
- Assert.assertFalse("Item should have been updated as NOT selected",
+ assertFalse("Item should have been updated as NOT selected",
customModel.generatedData.get("Bar"));
- Assert.assertFalse("Item should have been updated as NOT selected",
+ assertFalse("Item should have been updated as NOT selected",
customModel.generatedData.get("Baz"));
customModel.generatedData.clear();
@@ -139,11 +140,11 @@ public class GridSingleSelectionModelTest {
customGrid.getSelectionModel().select("Foo");
customGrid.getDataCommunicator().beforeClientResponse(false);
- Assert.assertTrue("Item should have been updated as selected",
+ assertTrue("Item should have been updated as selected",
customModel.generatedData.get("Foo"));
- Assert.assertFalse("Item should have NOT been updated",
+ assertFalse("Item should have NOT been updated",
customModel.generatedData.containsKey("Bar"));
- Assert.assertFalse("Item should have NOT been updated",
+ assertFalse("Item should have NOT been updated",
customModel.generatedData.containsKey("Baz"));
// switch to another selection model to cause event
@@ -154,11 +155,11 @@ public class GridSingleSelectionModelTest {
// since the selection model has been removed, it is no longer a data
// generator for the data communicator, would need to verify somehow
// that row is not marked as selected anymore ? (done in UI tests)
- Assert.assertTrue(customModel.generatedData.isEmpty()); // at least
- // removed
- // selection
- // model is not
- // triggered
+ assertTrue(customModel.generatedData.isEmpty()); // at least
+ // removed
+ // selection
+ // model is not
+ // triggered
}
@Test
@@ -167,19 +168,19 @@ public class GridSingleSelectionModelTest {
gridWithStrings.setItems("Foo", "Bar", "Baz");
GridSelectionModel<String> model = gridWithStrings.getSelectionModel();
- Assert.assertFalse(model.isSelected("Foo"));
+ assertFalse(model.isSelected("Foo"));
model.select("Foo");
- Assert.assertTrue(model.isSelected("Foo"));
- Assert.assertEquals(Optional.of("Foo"), model.getFirstSelectedItem());
+ assertTrue(model.isSelected("Foo"));
+ assertEquals(Optional.of("Foo"), model.getFirstSelectedItem());
model.select("Bar");
- Assert.assertFalse(model.isSelected("Foo"));
- Assert.assertTrue(model.isSelected("Bar"));
+ assertFalse(model.isSelected("Foo"));
+ assertTrue(model.isSelected("Bar"));
model.deselect("Bar");
- Assert.assertFalse(model.isSelected("Bar"));
- Assert.assertFalse(model.getFirstSelectedItem().isPresent());
+ assertFalse(model.isSelected("Bar"));
+ assertFalse(model.getFirstSelectedItem().isPresent());
}
@Test
@@ -271,21 +272,21 @@ public class GridSingleSelectionModelTest {
public void getSelectedItem() {
selectionModel.setSelectedItem(PERSON_B);
- Assert.assertEquals(PERSON_B, selectionModel.getSelectedItem().get());
+ assertEquals(PERSON_B, selectionModel.getSelectedItem().get());
selectionModel.deselect(PERSON_B);
- Assert.assertFalse(selectionModel.getSelectedItem().isPresent());
+ assertFalse(selectionModel.getSelectedItem().isPresent());
}
@Test
public void select_deselect_getSelectedItem() {
selectionModel.select(PERSON_C);
- Assert.assertEquals(PERSON_C, selectionModel.getSelectedItem().get());
+ assertEquals(PERSON_C, selectionModel.getSelectedItem().get());
selectionModel.deselect(PERSON_C);
- Assert.assertFalse(selectionModel.getSelectedItem().isPresent());
+ assertFalse(selectionModel.getSelectedItem().isPresent());
}
@SuppressWarnings({ "serial" })
@@ -313,18 +314,18 @@ public class GridSingleSelectionModelTest {
AtomicReference<ValueChangeEvent<?>> event = new AtomicReference<>();
Registration actualRegistration = select
.addSingleSelectionListener(evt -> {
- Assert.assertNull(event.get());
+ assertNull(event.get());
event.set(evt);
});
- Assert.assertSame(registration, actualRegistration);
+ assertSame(registration, actualRegistration);
selectionListener.get().selectionChange(new SingleSelectionEvent<>(grid,
select.asSingleSelect(), null, true));
- Assert.assertEquals(grid, event.get().getComponent());
- Assert.assertEquals(value, event.get().getValue());
- Assert.assertEquals(null, event.get().getOldValue());
- Assert.assertTrue(event.get().isUserOriginated());
+ assertEquals(grid, event.get().getComponent());
+ assertEquals(value, event.get().getValue());
+ assertEquals(null, event.get().getOldValue());
+ assertTrue(event.get().isUserOriginated());
}
}
diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridValueProvider.java b/server/src/test/java/com/vaadin/tests/components/grid/GridValueProvider.java
index 27ba971127..6b3d85900d 100644
--- a/server/src/test/java/com/vaadin/tests/components/grid/GridValueProvider.java
+++ b/server/src/test/java/com/vaadin/tests/components/grid/GridValueProvider.java
@@ -15,11 +15,13 @@
*/
package com.vaadin.tests.components.grid;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.provider.DataProvider;
@@ -39,7 +41,7 @@ public class GridValueProvider {
person -> person.getFirstName() + " " + person.getLastName());
Person person = new Person("first", "last", "email", 123, Sex.UNKNOWN,
null);
- Assert.assertEquals("first last", col.getValueProvider().apply(person));
+ assertEquals("first last", col.getValueProvider().apply(person));
}
@Test
@@ -49,7 +51,7 @@ public class GridValueProvider {
.getColumn("email");
Person person = new Person("first", "last", "eeemaaail", 123,
Sex.UNKNOWN, null);
- Assert.assertEquals("eeemaaail", col.getValueProvider().apply(person));
+ assertEquals("eeemaaail", col.getValueProvider().apply(person));
}
@@ -71,7 +73,7 @@ public class GridValueProvider {
List<Person> queryPersons = persons.fetch(new Query<>())
.collect(Collectors.toList());
- Assert.assertEquals(1, queryPersons.size());
- Assert.assertSame(upperCasePerson, queryPersons.get(0));
+ assertEquals(1, queryPersons.size());
+ assertSame(upperCasePerson, queryPersons.get(0));
}
}
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 e0706d9575..5a67d2bcce 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
@@ -15,10 +15,12 @@
*/
package com.vaadin.tests.components.menubar;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
import java.io.IOException;
import java.util.List;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.server.ExternalResource;
@@ -140,8 +142,8 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase<MenuBar> {
List<MenuItem> expectedMenuItems = expected.getItems();
List<MenuItem> actualMenuItems = result.getItems();
- Assert.assertEquals("Different amount of menu items",
- expectedMenuItems.size(), actualMenuItems.size());
+ assertEquals("Different amount of menu items", expectedMenuItems.size(),
+ actualMenuItems.size());
for (int i = 0; i < expectedMenuItems.size(); ++i) {
compareMenus(expectedMenuItems.get(i), actualMenuItems.get(i));
@@ -153,38 +155,37 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase<MenuBar> {
private void compareMenus(MenuItem expected, MenuItem actual) {
String baseError = "Error Comparing MenuItem " + expected.getText()
+ ": ";
- Assert.assertEquals(baseError + "Visibile", expected.isVisible(),
+ assertEquals(baseError + "Visibile", expected.isVisible(),
actual.isVisible());
- Assert.assertEquals(baseError + "Checkable", expected.isCheckable(),
+ assertEquals(baseError + "Checkable", expected.isCheckable(),
actual.isCheckable());
- Assert.assertEquals(baseError + "Checked", expected.isChecked(),
+ assertEquals(baseError + "Checked", expected.isChecked(),
actual.isChecked());
- Assert.assertEquals(baseError + "Separator", expected.isSeparator(),
+ assertEquals(baseError + "Separator", expected.isSeparator(),
actual.isSeparator());
- Assert.assertEquals(baseError + "Enabled", expected.isEnabled(),
+ assertEquals(baseError + "Enabled", expected.isEnabled(),
actual.isEnabled());
- Assert.assertEquals(baseError + "Text", expected.getText(),
- actual.getText());
- Assert.assertEquals(baseError + "Description",
- expected.getDescription(), actual.getDescription());
- Assert.assertEquals(baseError + "Style Name", expected.getStyleName(),
+ assertEquals(baseError + "Text", expected.getText(), actual.getText());
+ assertEquals(baseError + "Description", expected.getDescription(),
+ actual.getDescription());
+ assertEquals(baseError + "Style Name", expected.getStyleName(),
actual.getStyleName());
if (expected.getIcon() != null) {
- Assert.assertNotNull(baseError + "Icon was null", actual.getIcon());
+ assertNotNull(baseError + "Icon was null", actual.getIcon());
} else {
if (actual.getIcon() != null) {
- Assert.fail(baseError + "Icon should've been null");
+ fail(baseError + "Icon should've been null");
}
}
- Assert.assertEquals(baseError + "Has Children", expected.hasChildren(),
+ assertEquals(baseError + "Has Children", expected.hasChildren(),
actual.hasChildren());
if (expected.hasChildren()) {
List<MenuItem> children = expected.getChildren();
List<MenuItem> actualChildren = actual.getChildren();
- Assert.assertEquals(baseError + "Child count", children.size(),
+ assertEquals(baseError + "Child count", children.size(),
actualChildren.size());
for (int i = 0; i < children.size(); ++i) {
compareMenus(children.get(i), actualChildren.get(i));
diff --git a/server/src/test/java/com/vaadin/tests/components/treegrid/TreeGridTest.java b/server/src/test/java/com/vaadin/tests/components/treegrid/TreeGridTest.java
index 1876d8de35..d7abcd7301 100644
--- a/server/src/test/java/com/vaadin/tests/components/treegrid/TreeGridTest.java
+++ b/server/src/test/java/com/vaadin/tests/components/treegrid/TreeGridTest.java
@@ -1,6 +1,9 @@
package com.vaadin.tests.components.treegrid;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import com.vaadin.data.TreeData;
@@ -35,16 +38,16 @@ public class TreeGridTest {
treeGrid.addCollapseListener(e -> collapseEventFired = true);
// Test expand event
- Assert.assertFalse(expandEventFired);
+ assertFalse(expandEventFired);
treeGrid.expand("Foo");
- Assert.assertTrue("Item not expanded", treeGrid.isExpanded("Foo"));
- Assert.assertTrue("Expand event not fired", expandEventFired);
+ assertTrue("Item not expanded", treeGrid.isExpanded("Foo"));
+ assertTrue("Expand event not fired", expandEventFired);
// Test collapse event
- Assert.assertFalse(collapseEventFired);
+ assertFalse(collapseEventFired);
treeGrid.collapse("Foo");
- Assert.assertFalse("Item not collapsed", treeGrid.isExpanded("Foo"));
- Assert.assertTrue("Collapse event not fired", collapseEventFired);
+ assertFalse("Item not collapsed", treeGrid.isExpanded("Foo"));
+ assertTrue("Collapse event not fired", collapseEventFired);
}
@Test
@@ -52,8 +55,8 @@ public class TreeGridTest {
Column<String, String> column = treeGrid.addColumn(Object::toString)
.setId("foo");
treeGrid.setHierarchyColumn("foo");
- Assert.assertEquals("Hierarchy column was not correctly returned",
- column, treeGrid.getHierarchyColumn());
+ assertEquals("Hierarchy column was not correctly returned", column,
+ treeGrid.getHierarchyColumn());
}
}
diff --git a/server/src/test/java/com/vaadin/tests/data/converter/AbstractConverterTest.java b/server/src/test/java/com/vaadin/tests/data/converter/AbstractConverterTest.java
index ead81250bf..797a4bc96f 100644
--- a/server/src/test/java/com/vaadin/tests/data/converter/AbstractConverterTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/converter/AbstractConverterTest.java
@@ -1,6 +1,10 @@
package com.vaadin.tests.data.converter;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import com.vaadin.data.Converter;
@@ -23,17 +27,17 @@ public abstract class AbstractConverterTest {
protected <T> void assertValue(String assertMessage, T expectedValue,
Result<?> result) {
- Assert.assertNotNull("Result should never be null", result);
- Assert.assertFalse("Result is not ok", result.isError());
- Assert.assertEquals(expectedValue,
+ assertNotNull("Result should never be null", result);
+ assertFalse("Result is not ok", result.isError());
+ assertEquals(expectedValue,
result.getOrThrow(message -> new AssertionError(
assertMessage != null ? assertMessage : message)));
}
protected void assertError(String expectedResultMessage, Result<?> result) {
- Assert.assertNotNull("Result should never be null", result);
- Assert.assertTrue("Result should be an error", result.isError());
- Assert.assertEquals(expectedResultMessage, result.getMessage().get());
+ assertNotNull("Result should never be null", result);
+ assertTrue("Result should be an error", result.isError());
+ assertEquals(expectedResultMessage, result.getMessage().get());
}
protected String getErrorMessage() {
diff --git a/server/src/test/java/com/vaadin/tests/data/converter/AbstractStringConverterTest.java b/server/src/test/java/com/vaadin/tests/data/converter/AbstractStringConverterTest.java
index 123ef80de2..459702beaf 100644
--- a/server/src/test/java/com/vaadin/tests/data/converter/AbstractStringConverterTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/converter/AbstractStringConverterTest.java
@@ -1,6 +1,8 @@
package com.vaadin.tests.data.converter;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import com.vaadin.data.Converter;
@@ -23,8 +25,8 @@ public abstract class AbstractStringConverterTest
public void testErrorMessage() {
Result<?> result = getConverter().convertToModel("abc",
new ValueContext());
- Assert.assertTrue(result.isError());
- Assert.assertEquals(getErrorMessage(), result.getMessage().get());
+ assertTrue(result.isError());
+ assertEquals(getErrorMessage(), result.getMessage().get());
}
@Override
diff --git a/server/src/test/java/com/vaadin/tests/data/converter/ConverterTest.java b/server/src/test/java/com/vaadin/tests/data/converter/ConverterTest.java
index 3ba3c28882..3c31fddd7e 100644
--- a/server/src/test/java/com/vaadin/tests/data/converter/ConverterTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/converter/ConverterTest.java
@@ -1,6 +1,7 @@
package com.vaadin.tests.data.converter;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
import com.vaadin.data.Converter;
@@ -26,9 +27,9 @@ public class ConverterTest {
@Test
public void basicConversion() {
- Assert.assertEquals("presentation-123",
+ assertEquals("presentation-123",
converter.convertToPresentation("123", new ValueContext()));
- Assert.assertEquals("123",
+ assertEquals("123",
converter.convertToModel("presentation-123", new ValueContext())
.getOrThrow(msg -> new AssertionError(msg)));
}
diff --git a/server/src/test/java/com/vaadin/tests/data/converter/LocalDateTimeToDateConverterTest.java b/server/src/test/java/com/vaadin/tests/data/converter/LocalDateTimeToDateConverterTest.java
index fdad1391f5..eaa66fd526 100644
--- a/server/src/test/java/com/vaadin/tests/data/converter/LocalDateTimeToDateConverterTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/converter/LocalDateTimeToDateConverterTest.java
@@ -15,13 +15,14 @@
*/
package com.vaadin.tests.data.converter;
+import static org.junit.Assert.assertEquals;
+
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.Binder;
@@ -56,7 +57,7 @@ public class LocalDateTimeToDateConverterTest extends AbstractConverterTest {
@Test
public void testToPresentation() {
- Assert.assertEquals(LOCAL_DATE,
+ assertEquals(LOCAL_DATE,
getConverter().convertToPresentation(DATE, new ValueContext()));
}
@@ -73,7 +74,7 @@ public class LocalDateTimeToDateConverterTest extends AbstractConverterTest {
BeanWithDate bean = new BeanWithDate();
binder.writeBean(bean);
- Assert.assertEquals(DATE, bean.getDate());
+ assertEquals(DATE, bean.getDate());
}
public static class BeanWithDate {
diff --git a/server/src/test/java/com/vaadin/tests/data/converter/LocalDateToDateConverterTest.java b/server/src/test/java/com/vaadin/tests/data/converter/LocalDateToDateConverterTest.java
index 9517ad783b..c1466ab94c 100644
--- a/server/src/test/java/com/vaadin/tests/data/converter/LocalDateToDateConverterTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/converter/LocalDateToDateConverterTest.java
@@ -15,13 +15,14 @@
*/
package com.vaadin.tests.data.converter;
+import static org.junit.Assert.assertEquals;
+
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.Binder;
@@ -57,7 +58,7 @@ public class LocalDateToDateConverterTest extends AbstractConverterTest {
@Test
public void testToPresentation() {
- Assert.assertEquals(LOCAL_DATE,
+ assertEquals(LOCAL_DATE,
getConverter().convertToPresentation(DATE, new ValueContext()));
}
@@ -74,7 +75,7 @@ public class LocalDateToDateConverterTest extends AbstractConverterTest {
BeanWithDate bean = new BeanWithDate();
binder.writeBean(bean);
- Assert.assertEquals(DATE, bean.getDate());
+ assertEquals(DATE, bean.getDate());
}
public static class BeanWithDate {
diff --git a/server/src/test/java/com/vaadin/tests/data/converter/StringToBigDecimalConverterTest.java b/server/src/test/java/com/vaadin/tests/data/converter/StringToBigDecimalConverterTest.java
index 60dad91e61..54363e768f 100644
--- a/server/src/test/java/com/vaadin/tests/data/converter/StringToBigDecimalConverterTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/converter/StringToBigDecimalConverterTest.java
@@ -15,10 +15,11 @@
*/
package com.vaadin.tests.data.converter;
+import static org.junit.Assert.assertEquals;
+
import java.math.BigDecimal;
import java.util.Locale;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.Result;
@@ -48,7 +49,7 @@ public class StringToBigDecimalConverterTest
String converted = getConverter().convertToPresentation(bd,
new ValueContext(Locale.GERMAN));
- Assert.assertEquals(expected, converted);
+ assertEquals(expected, converted);
}
@Test
@@ -58,7 +59,7 @@ public class StringToBigDecimalConverterTest
assertValue(BigDecimal.ZERO,
converter.convertToModel("", new ValueContext()));
- Assert.assertEquals("0", converter
- .convertToPresentation(BigDecimal.ZERO, new ValueContext()));
+ assertEquals("0", converter.convertToPresentation(BigDecimal.ZERO,
+ new ValueContext()));
}
}
diff --git a/server/src/test/java/com/vaadin/tests/data/converter/StringToBigIntegerConverterTest.java b/server/src/test/java/com/vaadin/tests/data/converter/StringToBigIntegerConverterTest.java
index 28abe19224..132feee20d 100644
--- a/server/src/test/java/com/vaadin/tests/data/converter/StringToBigIntegerConverterTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/converter/StringToBigIntegerConverterTest.java
@@ -15,10 +15,11 @@
*/
package com.vaadin.tests.data.converter;
+import static org.junit.Assert.assertEquals;
+
import java.math.BigInteger;
import java.util.Locale;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.Result;
@@ -50,8 +51,7 @@ public class StringToBigIntegerConverterTest
String converted = getConverter().convertToPresentation(bd,
new ValueContext(Locale.GERMAN));
- Assert.assertEquals(
- "Value with specific locale was converted incorrectly",
+ assertEquals("Value with specific locale was converted incorrectly",
expected, converted);
}
@@ -62,8 +62,8 @@ public class StringToBigIntegerConverterTest
assertValue(BigInteger.ZERO,
converter.convertToModel("", new ValueContext()));
- Assert.assertEquals("0", converter
- .convertToPresentation(BigInteger.ZERO, new ValueContext()));
+ assertEquals("0", converter.convertToPresentation(BigInteger.ZERO,
+ new ValueContext()));
}
}
diff --git a/server/src/test/java/com/vaadin/tests/data/converter/StringToBooleanConverterTest.java b/server/src/test/java/com/vaadin/tests/data/converter/StringToBooleanConverterTest.java
index 5c265fe31c..f1ab5f19f6 100644
--- a/server/src/test/java/com/vaadin/tests/data/converter/StringToBooleanConverterTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/converter/StringToBooleanConverterTest.java
@@ -1,10 +1,11 @@
package com.vaadin.tests.data.converter;
+import static org.junit.Assert.assertEquals;
+
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.ValueContext;
@@ -57,9 +58,9 @@ public class StringToBooleanConverterTest extends AbstractStringConverterTest {
assertValue(false,
yesNoConverter.convertToModel("no", new ValueContext()));
- Assert.assertEquals("yes",
+ assertEquals("yes",
yesNoConverter.convertToPresentation(true, new ValueContext()));
- Assert.assertEquals("no", yesNoConverter.convertToPresentation(false,
+ assertEquals("no", yesNoConverter.convertToPresentation(false,
new ValueContext()));
}
@@ -70,23 +71,22 @@ public class StringToBooleanConverterTest extends AbstractStringConverterTest {
assertValue(false, emptyTrueConverter.convertToModel("ABSENT",
new ValueContext()));
- Assert.assertEquals("", emptyTrueConverter.convertToPresentation(true,
+ assertEquals("", emptyTrueConverter.convertToPresentation(true,
+ new ValueContext()));
+ assertEquals("ABSENT", emptyTrueConverter.convertToPresentation(false,
new ValueContext()));
- Assert.assertEquals("ABSENT", emptyTrueConverter
- .convertToPresentation(false, new ValueContext()));
}
@Test
public void testLocale() {
- Assert.assertEquals("May 18, 2033", localeConverter
- .convertToPresentation(true, new ValueContext(Locale.US)));
- Assert.assertEquals("January 24, 2065", localeConverter
+ assertEquals("May 18, 2033", localeConverter.convertToPresentation(true,
+ new ValueContext(Locale.US)));
+ assertEquals("January 24, 2065", localeConverter
.convertToPresentation(false, new ValueContext(Locale.US)));
- Assert.assertEquals("18. Mai 2033", localeConverter
- .convertToPresentation(true, new ValueContext(Locale.GERMANY)));
- Assert.assertEquals("24. Januar 2065",
- localeConverter.convertToPresentation(false,
- new ValueContext(Locale.GERMANY)));
+ assertEquals("18. Mai 2033", localeConverter.convertToPresentation(true,
+ new ValueContext(Locale.GERMANY)));
+ assertEquals("24. Januar 2065", localeConverter.convertToPresentation(
+ false, new ValueContext(Locale.GERMANY)));
}
}
diff --git a/server/src/test/java/com/vaadin/tests/data/converter/StringToDoubleConverterTest.java b/server/src/test/java/com/vaadin/tests/data/converter/StringToDoubleConverterTest.java
index 2dda3d7dbf..43dab81203 100644
--- a/server/src/test/java/com/vaadin/tests/data/converter/StringToDoubleConverterTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/converter/StringToDoubleConverterTest.java
@@ -1,6 +1,8 @@
package com.vaadin.tests.data.converter;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import com.vaadin.data.Result;
@@ -31,8 +33,8 @@ public class StringToDoubleConverterTest extends AbstractConverterTest {
public void testErrorMessage() {
Result<Double> result = getConverter().convertToModel("abc",
new ValueContext());
- Assert.assertTrue(result.isError());
- Assert.assertEquals("Failed", result.getMessage().get());
+ assertTrue(result.isError());
+ assertEquals("Failed", result.getMessage().get());
}
@Test
@@ -41,7 +43,7 @@ public class StringToDoubleConverterTest extends AbstractConverterTest {
getErrorMessage());
assertValue(0.0, converter.convertToModel("", new ValueContext()));
- Assert.assertEquals("0",
+ assertEquals("0",
converter.convertToPresentation(0.0, new ValueContext()));
}
diff --git a/server/src/test/java/com/vaadin/tests/data/converter/StringToFloatConverterTest.java b/server/src/test/java/com/vaadin/tests/data/converter/StringToFloatConverterTest.java
index 2601ae2cd4..6cac48df97 100644
--- a/server/src/test/java/com/vaadin/tests/data/converter/StringToFloatConverterTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/converter/StringToFloatConverterTest.java
@@ -1,6 +1,7 @@
package com.vaadin.tests.data.converter;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
import com.vaadin.data.ValueContext;
@@ -40,7 +41,7 @@ public class StringToFloatConverterTest extends AbstractStringConverterTest {
assertValue((float) 0.0,
converter.convertToModel("", new ValueContext()));
- Assert.assertEquals("0", converter.convertToPresentation((float) 0.0,
+ assertEquals("0", converter.convertToPresentation((float) 0.0,
new ValueContext()));
}
}
diff --git a/server/src/test/java/com/vaadin/tests/data/converter/StringToIntegerConverterTest.java b/server/src/test/java/com/vaadin/tests/data/converter/StringToIntegerConverterTest.java
index 8ea4e7a558..db050233cf 100644
--- a/server/src/test/java/com/vaadin/tests/data/converter/StringToIntegerConverterTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/converter/StringToIntegerConverterTest.java
@@ -1,6 +1,9 @@
package com.vaadin.tests.data.converter;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import com.vaadin.data.Result;
@@ -22,9 +25,8 @@ public class StringToIntegerConverterTest extends AbstractConverterTest {
@Test
public void testValueOutOfRange() {
- Double[] values = { Integer.MAX_VALUE * 2.0,
- Integer.MIN_VALUE * 2.0, Long.MAX_VALUE * 2.0,
- Long.MIN_VALUE * 2.0 };
+ Double[] values = { Integer.MAX_VALUE * 2.0, Integer.MIN_VALUE * 2.0,
+ Long.MAX_VALUE * 2.0, Long.MIN_VALUE * 2.0 };
boolean accepted = false;
for (Number value : values) {
@@ -35,7 +37,7 @@ public class StringToIntegerConverterTest extends AbstractConverterTest {
accepted = true;
}
}
- Assert.assertFalse("Accepted value outside range of int", accepted);
+ assertFalse("Accepted value outside range of int", accepted);
}
@Test
@@ -48,8 +50,8 @@ public class StringToIntegerConverterTest extends AbstractConverterTest {
public void testErrorMessage() {
Result<Integer> result = getConverter().convertToModel("abc",
new ValueContext());
- Assert.assertTrue(result.isError());
- Assert.assertEquals("Failed", result.getMessage().get());
+ assertTrue(result.isError());
+ assertEquals("Failed", result.getMessage().get());
}
@Test
@@ -58,7 +60,7 @@ public class StringToIntegerConverterTest extends AbstractConverterTest {
getErrorMessage());
assertValue(0, converter.convertToModel("", new ValueContext()));
- Assert.assertEquals("0",
+ assertEquals("0",
converter.convertToPresentation(0, new ValueContext()));
}
}
diff --git a/server/src/test/java/com/vaadin/tests/data/converter/StringToLongConverterTest.java b/server/src/test/java/com/vaadin/tests/data/converter/StringToLongConverterTest.java
index fb8ab07d80..ed70763823 100644
--- a/server/src/test/java/com/vaadin/tests/data/converter/StringToLongConverterTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/converter/StringToLongConverterTest.java
@@ -1,6 +1,7 @@
package com.vaadin.tests.data.converter;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
import com.vaadin.data.Result;
@@ -56,7 +57,7 @@ public class StringToLongConverterTest extends AbstractStringConverterTest {
getErrorMessage());
assertValue((long) 0, converter.convertToModel("", new ValueContext()));
- Assert.assertEquals("0",
+ assertEquals("0",
converter.convertToPresentation((long) 0, new ValueContext()));
}
}
diff --git a/server/src/test/java/com/vaadin/tests/data/selection/AbstractStaleSelectionTest.java b/server/src/test/java/com/vaadin/tests/data/selection/AbstractStaleSelectionTest.java
index 45e25cc867..1a8529302e 100644
--- a/server/src/test/java/com/vaadin/tests/data/selection/AbstractStaleSelectionTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/selection/AbstractStaleSelectionTest.java
@@ -1,9 +1,11 @@
package com.vaadin.tests.data.selection;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.List;
import java.util.concurrent.Future;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -56,13 +58,12 @@ public abstract class AbstractStaleSelectionTest<S extends AbstractListing<StrBe
}
protected final void assertIsStale(StrBean bean) {
- Assert.assertTrue("Bean with id " + bean.getId() + " should be stale.",
+ assertTrue("Bean with id " + bean.getId() + " should be stale.",
dataProvider.isStale(bean));
}
protected final void assertNotStale(StrBean bean) {
- Assert.assertFalse(
- "Bean with id " + bean.getId() + " should not be stale.",
+ assertFalse("Bean with id " + bean.getId() + " should not be stale.",
dataProvider.isStale(bean));
}
}
diff --git a/server/src/test/java/com/vaadin/tests/data/selection/GridStaleElementTest.java b/server/src/test/java/com/vaadin/tests/data/selection/GridStaleElementTest.java
index 64b7ecbc35..16ed3df97c 100644
--- a/server/src/test/java/com/vaadin/tests/data/selection/GridStaleElementTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/selection/GridStaleElementTest.java
@@ -1,9 +1,11 @@
package com.vaadin.tests.data.selection;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.List;
import java.util.concurrent.Future;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -64,15 +66,15 @@ public class GridStaleElementTest {
assertStale(toReplace);
model.getSelectedItems()
- .forEach(item -> Assert.assertFalse(
+ .forEach(item -> assertFalse(
"Selection should not contain stale values",
dataProvider.isStale(item)));
Object oldId = dataProvider.getId(toReplace);
- Assert.assertTrue("Selection did not contain an item with matching Id.",
+ assertTrue("Selection did not contain an item with matching Id.",
model.getSelectedItems().stream().map(dataProvider::getId)
.anyMatch(oldId::equals));
- Assert.assertTrue("Stale element is not considered selected.",
+ assertTrue("Stale element is not considered selected.",
model.isSelected(toReplace));
}
@@ -91,26 +93,25 @@ public class GridStaleElementTest {
assertStale(toReplace);
model.getSelectedItems()
- .forEach(i -> Assert.assertFalse(
+ .forEach(i -> assertFalse(
"Selection should not contain stale values",
dataProvider.isStale(i)));
- Assert.assertTrue("Selection did not contain an item with matching Id.",
+ assertTrue("Selection did not contain an item with matching Id.",
model.getSelectedItems().stream().map(dataProvider::getId)
.filter(i -> dataProvider.getId(toReplace).equals(i))
.findFirst().isPresent());
- Assert.assertTrue("Stale element is not considered selected.",
+ assertTrue("Stale element is not considered selected.",
model.isSelected(toReplace));
}
private void assertNotStale(StrBean bean) {
- Assert.assertFalse(
- "Bean with id " + bean.getId() + " should not be stale.",
+ assertFalse("Bean with id " + bean.getId() + " should not be stale.",
dataProvider.isStale(bean));
}
private void assertStale(StrBean bean) {
- Assert.assertTrue("Bean with id " + bean.getId() + " should be stale.",
+ assertTrue("Bean with id " + bean.getId() + " should be stale.",
dataProvider.isStale(bean));
}
}
diff --git a/server/src/test/java/com/vaadin/tests/data/selection/StaleMultiSelectionTest.java b/server/src/test/java/com/vaadin/tests/data/selection/StaleMultiSelectionTest.java
index 9769ec3997..11918df0d6 100644
--- a/server/src/test/java/com/vaadin/tests/data/selection/StaleMultiSelectionTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/selection/StaleMultiSelectionTest.java
@@ -1,10 +1,12 @@
package com.vaadin.tests.data.selection;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.Collection;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.junit.Assert;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
@@ -30,15 +32,15 @@ public class StaleMultiSelectionTest
assertIsStale(toReplace);
select.getSelectedItems()
- .forEach(item -> Assert.assertFalse(
+ .forEach(item -> assertFalse(
"Selection should not contain stale values",
dataProvider.isStale(item)));
Object oldId = dataProvider.getId(toReplace);
- Assert.assertTrue("Selection did not contain an item with matching Id.",
+ assertTrue("Selection did not contain an item with matching Id.",
select.getSelectedItems().stream().map(dataProvider::getId)
.anyMatch(oldId::equals));
- Assert.assertTrue("Stale element is not considered selected.",
+ assertTrue("Stale element is not considered selected.",
select.isSelected(toReplace));
}
diff --git a/server/src/test/java/com/vaadin/tests/data/selection/StaleSingleSelectionTest.java b/server/src/test/java/com/vaadin/tests/data/selection/StaleSingleSelectionTest.java
index e8b354de9e..bdcdb46b18 100644
--- a/server/src/test/java/com/vaadin/tests/data/selection/StaleSingleSelectionTest.java
+++ b/server/src/test/java/com/vaadin/tests/data/selection/StaleSingleSelectionTest.java
@@ -1,10 +1,12 @@
package com.vaadin.tests.data.selection;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
import java.util.Collection;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.junit.Assert;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
@@ -29,10 +31,10 @@ public class StaleSingleSelectionTest
dataProvider.refreshItem(replacement);
assertIsStale(toReplace);
- Assert.assertFalse("Selection should not contain stale values",
+ assertFalse("Selection should not contain stale values",
dataProvider.isStale(select.getValue()));
- Assert.assertEquals("Selected item id did not match original.",
+ assertEquals("Selected item id did not match original.",
toReplace.getId(), dataProvider.getId(select.getValue()));
}
diff --git a/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java b/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java
index 813ff361f3..41be5aa6ab 100644
--- a/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java
+++ b/server/src/test/java/com/vaadin/tests/design/ComponentFactoryTest.java
@@ -15,12 +15,13 @@
*/
package com.vaadin.tests.design;
+import static org.junit.Assert.assertEquals;
+
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.List;
import org.junit.After;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.ui.AbstractComponent;
@@ -69,9 +70,8 @@ public class ComponentFactoryTest {
Design.read(new ByteArrayInputStream("<vaadin-label />".getBytes()));
- Assert.assertEquals("There should be one message logged", 1,
- messages.size());
- Assert.assertEquals("Requested class " + Label.class.getCanonicalName(),
+ assertEquals("There should be one message logged", 1, messages.size());
+ assertEquals("Requested class " + Label.class.getCanonicalName(),
messages.get(0));
}
@@ -109,10 +109,8 @@ public class ComponentFactoryTest {
DesignContext designContext = new DesignContext();
designContext.getDefaultInstance(new DefaultInstanceTestComponent());
- Assert.assertEquals("There should be one class requests", 1,
- classes.size());
- Assert.assertEquals(
- "First class should be DefaultInstanceTestComponent",
+ assertEquals("There should be one class requests", 1, classes.size());
+ assertEquals("First class should be DefaultInstanceTestComponent",
DefaultInstanceTestComponent.class.getName(), classes.get(0));
}
diff --git a/server/src/test/java/com/vaadin/tests/design/ComponentMapperTest.java b/server/src/test/java/com/vaadin/tests/design/ComponentMapperTest.java
index 25062f76f4..e9eefa3e6b 100644
--- a/server/src/test/java/com/vaadin/tests/design/ComponentMapperTest.java
+++ b/server/src/test/java/com/vaadin/tests/design/ComponentMapperTest.java
@@ -15,11 +15,13 @@
*/
package com.vaadin.tests.design;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.ui.Component;
@@ -100,11 +102,11 @@ public class ComponentMapperTest {
Component component = Design
.read(new ByteArrayInputStream("<custom-foobar />".getBytes()));
- Assert.assertTrue(
+ assertTrue(
"<custom-foobar> should resolve "
+ ComponentWithCustomTagName.class.getSimpleName(),
component instanceof ComponentWithCustomTagName);
- Assert.assertEquals("custom-foobar",
+ assertEquals("custom-foobar",
((ComponentWithCustomTagName) component).tagName);
}
@@ -119,7 +121,7 @@ public class ComponentMapperTest {
Design.write(component, bos);
String writtenDesign = new String(bos.toByteArray());
- Assert.assertTrue(
+ assertTrue(
"Written design should contain \"<custom-special\", but instead got "
+ writtenDesign,
writtenDesign.contains("<custom-special"));
diff --git a/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java b/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java
index a3b6fbeeeb..f3e7c237a8 100644
--- a/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java
+++ b/server/src/test/java/com/vaadin/tests/design/DeclarativeTestBaseBase.java
@@ -16,6 +16,7 @@
package com.vaadin.tests.design;
import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertNull;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -95,11 +96,11 @@ public abstract class DeclarativeTestBaseBase<T extends Component> {
protected void assertEquals(String message, Object o1, Object o2) {
if (o1 == null) {
- Assert.assertNull(message, o2);
+ assertNull(message, o2);
return;
}
if (o2 == null) {
- Assert.assertNull(message, o1);
+ assertNull(message, o1);
return;
}
diff --git a/server/src/test/java/com/vaadin/tests/design/DesignFormatterTest.java b/server/src/test/java/com/vaadin/tests/design/DesignFormatterTest.java
index f448f5c2b2..9f6253067a 100644
--- a/server/src/test/java/com/vaadin/tests/design/DesignFormatterTest.java
+++ b/server/src/test/java/com/vaadin/tests/design/DesignFormatterTest.java
@@ -16,7 +16,9 @@
package com.vaadin.tests.design;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
import java.math.BigDecimal;
@@ -25,7 +27,6 @@ import java.util.Date;
import java.util.HashSet;
import java.util.TimeZone;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -80,15 +81,15 @@ public class DesignFormatterTest {
assertEquals("", formatter.format(true));
assertEquals("false", formatter.format(false));
- Assert.assertTrue(formatter.parse("true", boolean.class));
- Assert.assertTrue(formatter.parse("foobar", boolean.class));
- Assert.assertTrue(formatter.parse("", boolean.class));
- Assert.assertFalse(formatter.parse("false", boolean.class));
+ assertTrue(formatter.parse("true", boolean.class));
+ assertTrue(formatter.parse("foobar", boolean.class));
+ assertTrue(formatter.parse("", boolean.class));
+ assertFalse(formatter.parse("false", boolean.class));
- Assert.assertTrue(formatter.parse("true", Boolean.class));
- Assert.assertTrue(formatter.parse("foobar", Boolean.class));
- Assert.assertTrue(formatter.parse("", Boolean.class));
- Assert.assertFalse(formatter.parse("false", Boolean.class));
+ assertTrue(formatter.parse("true", Boolean.class));
+ assertTrue(formatter.parse("foobar", Boolean.class));
+ assertTrue(formatter.parse("", Boolean.class));
+ assertFalse(formatter.parse("false", Boolean.class));
}
@Test
@@ -236,7 +237,7 @@ public class DesignFormatterTest {
protected void assertInvalidShortcut(String shortcut) {
try {
formatter.parse(shortcut, ShortcutAction.class);
- Assert.fail("Invalid shortcut '" + shortcut + "' should throw");
+ fail("Invalid shortcut '" + shortcut + "' should throw");
} catch (IllegalArgumentException e) {
// expected
}
diff --git a/server/src/test/java/com/vaadin/tests/design/DesignReadInConstructorTest.java b/server/src/test/java/com/vaadin/tests/design/DesignReadInConstructorTest.java
index b870e55f13..f97842b0cf 100644
--- a/server/src/test/java/com/vaadin/tests/design/DesignReadInConstructorTest.java
+++ b/server/src/test/java/com/vaadin/tests/design/DesignReadInConstructorTest.java
@@ -16,6 +16,7 @@
package com.vaadin.tests.design;
import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertEquals;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -26,7 +27,6 @@ import org.jsoup.Jsoup;
import org.jsoup.nodes.Attribute;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
-import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
@@ -37,7 +37,7 @@ public class DesignReadInConstructorTest {
@Test
public void useDesignReadInConstructor() {
DesignReadInConstructor dric = new DesignReadInConstructor();
- Assert.assertEquals(3, dric.getComponentCount());
+ assertEquals(3, dric.getComponentCount());
}
@Test
@@ -55,7 +55,7 @@ public class DesignReadInConstructorTest {
}
private void assertJsoupTreeEquals(Element expected, Element actual) {
- Assert.assertEquals(expected.tagName(), actual.tagName());
+ assertEquals(expected.tagName(), actual.tagName());
Set<String> keys = new HashSet<>();
@@ -66,12 +66,11 @@ public class DesignReadInConstructorTest {
keys.add(attr.getKey());
}
for (String attributeKey : keys) {
- Assert.assertEquals(expected.attr(attributeKey),
+ assertEquals(expected.attr(attributeKey),
actual.attr(attributeKey));
}
- Assert.assertEquals(expected.children().size(),
- actual.children().size());
+ assertEquals(expected.children().size(), actual.children().size());
for (int i = 0; i < expected.children().size(); i++) {
assertJsoupTreeEquals(expected.child(i), actual.child(i));
}
diff --git a/server/src/test/java/com/vaadin/tests/design/DesignTest.java b/server/src/test/java/com/vaadin/tests/design/DesignTest.java
index 95749aed68..115dde4934 100644
--- a/server/src/test/java/com/vaadin/tests/design/DesignTest.java
+++ b/server/src/test/java/com/vaadin/tests/design/DesignTest.java
@@ -15,13 +15,14 @@
*/
package com.vaadin.tests.design;
+import static org.junit.Assert.assertEquals;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Iterator;
-import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
@@ -43,13 +44,11 @@ public class DesignTest {
Component root = Design.read(getClass()
.getResourceAsStream("verticallayout-two-children.html"));
VerticalLayout rootLayout = (VerticalLayout) root;
- Assert.assertEquals(VerticalLayout.class, root.getClass());
+ assertEquals(VerticalLayout.class, root.getClass());
- Assert.assertEquals(2, rootLayout.getComponentCount());
- Assert.assertEquals(TextField.class,
- rootLayout.getComponent(0).getClass());
- Assert.assertEquals(Button.class,
- rootLayout.getComponent(1).getClass());
+ assertEquals(2, rootLayout.getComponentCount());
+ assertEquals(TextField.class, rootLayout.getComponent(0).getClass());
+ assertEquals(Button.class, rootLayout.getComponent(1).getClass());
}
@Test(expected = DesignException.class)
diff --git a/server/src/test/java/com/vaadin/tests/design/FieldNameWhichConflictsWithGettersTest.java b/server/src/test/java/com/vaadin/tests/design/FieldNameWhichConflictsWithGettersTest.java
index 91e7e89627..0b70006965 100644
--- a/server/src/test/java/com/vaadin/tests/design/FieldNameWhichConflictsWithGettersTest.java
+++ b/server/src/test/java/com/vaadin/tests/design/FieldNameWhichConflictsWithGettersTest.java
@@ -16,6 +16,8 @@
package com.vaadin.tests.design;
import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -23,7 +25,6 @@ import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.annotations.DesignRoot;
@@ -48,8 +49,8 @@ public class FieldNameWhichConflictsWithGettersTest {
@Test
public void readWithConflictingFields() {
MyVerticalLayout v = new MyVerticalLayout();
- Assert.assertNotNull(v.caption);
- Assert.assertNotNull(v.description);
+ assertNotNull(v.caption);
+ assertNotNull(v.description);
}
@Test
@@ -72,13 +73,13 @@ public class FieldNameWhichConflictsWithGettersTest {
Document doc = Jsoup.parse(str);
Element body = doc.body();
Element captionElement = body.getElementById("caption");
- Assert.assertNotNull(captionElement);
- Assert.assertEquals("vaadin-label", captionElement.tagName());
+ assertNotNull(captionElement);
+ assertEquals("vaadin-label", captionElement.tagName());
Element descriptionElement = captionElement.nextElementSibling();
- Assert.assertNotNull(descriptionElement);
- Assert.assertEquals("vaadin-text-field", descriptionElement.tagName());
- Assert.assertEquals("description", descriptionElement.attr("_id"));
+ assertNotNull(descriptionElement);
+ assertEquals("vaadin-text-field", descriptionElement.tagName());
+ assertEquals("description", descriptionElement.attr("_id"));
}
}
diff --git a/server/src/test/java/com/vaadin/tests/design/InvalidTagNamesTest.java b/server/src/test/java/com/vaadin/tests/design/InvalidTagNamesTest.java
index 98ca82d646..229e4d69ac 100644
--- a/server/src/test/java/com/vaadin/tests/design/InvalidTagNamesTest.java
+++ b/server/src/test/java/com/vaadin/tests/design/InvalidTagNamesTest.java
@@ -16,10 +16,11 @@
package com.vaadin.tests.design;
import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.ui.Button;
@@ -38,7 +39,7 @@ public class InvalidTagNamesTest {
public void emptyTag() {
// JSoup parses empty tags into text nodes
Component c = readDesign("<>foo</>");
- Assert.assertNull(c);
+ assertNull(c);
}
@Test(expected = DesignException.class)
@@ -51,7 +52,7 @@ public class InvalidTagNamesTest {
// JSoup will refuse to parse tags starting with - and convert them into
// text nodes instead
Component c = readDesign("<-v>foo</-v>");
- Assert.assertNull(c);
+ assertNull(c);
}
@Test(expected = DesignException.class)
@@ -69,7 +70,7 @@ public class InvalidTagNamesTest {
// parsed currently as <vaadin-button> (this should not be considered API)
public void tagEndsInDash() {
Component c = readDesign("<vaadin-button-></vaadin-button->");
- Assert.assertTrue(c.getClass() == Button.class);
+ assertTrue(c.getClass() == Button.class);
}
// @Test(expected = DesignException.class)
@@ -77,7 +78,7 @@ public class InvalidTagNamesTest {
// parsed currently as <vaadin-button> (this should not be considered API)
public void tagEndsInTwoDashes() {
Component c = readDesign("<vaadin-button--></vaadin-button-->");
- Assert.assertTrue(c.getClass() == Button.class);
+ assertTrue(c.getClass() == Button.class);
}
// @Test(expected = DesignException.class)
@@ -85,7 +86,7 @@ public class InvalidTagNamesTest {
// parsed currently as <vaadin-button> (this should not be considered API)
public void tagWithTwoDashes() {
Component c = readDesign("<vaadin--button></vaadin--button>");
- Assert.assertTrue(c.getClass() == Button.class);
+ assertTrue(c.getClass() == Button.class);
}
@Test(expected = DesignException.class)
diff --git a/server/src/test/java/com/vaadin/tests/design/designroot/CompositeDesignRootTest.java b/server/src/test/java/com/vaadin/tests/design/designroot/CompositeDesignRootTest.java
index fbe0b029f2..e18ef0b409 100644
--- a/server/src/test/java/com/vaadin/tests/design/designroot/CompositeDesignRootTest.java
+++ b/server/src/test/java/com/vaadin/tests/design/designroot/CompositeDesignRootTest.java
@@ -15,7 +15,9 @@
*/
package com.vaadin.tests.design.designroot;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.junit.Test;
import com.vaadin.tests.server.component.composite.MyPrefilledComposite;
@@ -29,11 +31,11 @@ public class CompositeDesignRootTest {
CompositeDesignRootForVerticalLayout r = new CompositeDesignRootForVerticalLayout();
// Composition root, should be VerticalLayout
Component compositionRoot = r.iterator().next();
- Assert.assertNotNull(compositionRoot);
- Assert.assertEquals(VerticalLayout.class, compositionRoot.getClass());
- Assert.assertNotNull(r.ok);
- Assert.assertNotNull(r.cancel);
- Assert.assertEquals("original", r.preInitializedField.getValue());
+ assertNotNull(compositionRoot);
+ assertEquals(VerticalLayout.class, compositionRoot.getClass());
+ assertNotNull(r.ok);
+ assertNotNull(r.cancel);
+ assertEquals("original", r.preInitializedField.getValue());
}
@Test
@@ -41,9 +43,8 @@ public class CompositeDesignRootTest {
CompositeDesignRootForMyComposite r = new CompositeDesignRootForMyComposite();
// Composition root, should be MyPrefilledcomposite
Component compositionRoot = r.iterator().next();
- Assert.assertNotNull(compositionRoot);
- Assert.assertEquals(MyPrefilledComposite.class,
- compositionRoot.getClass());
+ assertNotNull(compositionRoot);
+ assertEquals(MyPrefilledComposite.class, compositionRoot.getClass());
}
diff --git a/server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootTest.java b/server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootTest.java
index 5331fdba4b..bab95d9e19 100644
--- a/server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootTest.java
+++ b/server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootTest.java
@@ -15,7 +15,9 @@
*/
package com.vaadin.tests.design.designroot;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.junit.Test;
import com.vaadin.tests.server.component.customcomponent.MyPrefilledCustomComponent;
@@ -29,11 +31,11 @@ public class CustomComponentDesignRootTest {
CustomComponentDesignRootForVerticalLayout r = new CustomComponentDesignRootForVerticalLayout();
// Composition root, should be VerticalLayout
Component compositionRoot = r.iterator().next();
- Assert.assertNotNull(compositionRoot);
- Assert.assertEquals(VerticalLayout.class, compositionRoot.getClass());
- Assert.assertNotNull(r.ok);
- Assert.assertNotNull(r.cancel);
- Assert.assertEquals("original", r.preInitializedField.getValue());
+ assertNotNull(compositionRoot);
+ assertEquals(VerticalLayout.class, compositionRoot.getClass());
+ assertNotNull(r.ok);
+ assertNotNull(r.cancel);
+ assertEquals("original", r.preInitializedField.getValue());
}
@Test
@@ -41,8 +43,8 @@ public class CustomComponentDesignRootTest {
CustomComponentDesignRootForMyCustomComponent r = new CustomComponentDesignRootForMyCustomComponent();
// Composition root, should be MyPrefilledCustomComponent
Component compositionRoot = r.iterator().next();
- Assert.assertNotNull(compositionRoot);
- Assert.assertEquals(MyPrefilledCustomComponent.class,
+ assertNotNull(compositionRoot);
+ assertEquals(MyPrefilledCustomComponent.class,
compositionRoot.getClass());
}
diff --git a/server/src/test/java/com/vaadin/tests/design/designroot/DesignRootTest.java b/server/src/test/java/com/vaadin/tests/design/designroot/DesignRootTest.java
index 3f35c7602d..fb1e216800 100644
--- a/server/src/test/java/com/vaadin/tests/design/designroot/DesignRootTest.java
+++ b/server/src/test/java/com/vaadin/tests/design/designroot/DesignRootTest.java
@@ -15,40 +15,42 @@
*/
package com.vaadin.tests.design.designroot;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.junit.Test;
public class DesignRootTest {
@Test
public void designAnnotationWithoutFilename() {
DesignWithEmptyAnnotation d = new DesignWithEmptyAnnotation();
- Assert.assertNotNull(d.ok);
- Assert.assertNotNull(d.CaNCEL);
- Assert.assertEquals("original", d.preInitializedField.getValue());
+ assertNotNull(d.ok);
+ assertNotNull(d.CaNCEL);
+ assertEquals("original", d.preInitializedField.getValue());
}
@Test
public void designAnnotationWithFilename() {
DesignWithAnnotation d = new DesignWithAnnotation();
- Assert.assertNotNull(d.ok);
- Assert.assertNotNull(d.cancel);
- Assert.assertEquals("original", d.preInitializedField.getValue());
+ assertNotNull(d.ok);
+ assertNotNull(d.cancel);
+ assertEquals("original", d.preInitializedField.getValue());
}
@Test
public void extendedDesignAnnotationWithoutFilename() {
DesignWithEmptyAnnotation d = new ExtendedDesignWithEmptyAnnotation();
- Assert.assertNotNull(d.ok);
- Assert.assertNotNull(d.CaNCEL);
- Assert.assertEquals("original", d.preInitializedField.getValue());
+ assertNotNull(d.ok);
+ assertNotNull(d.CaNCEL);
+ assertEquals("original", d.preInitializedField.getValue());
}
@Test
public void extendedDesignAnnotationWithFilename() {
DesignWithAnnotation d = new ExtendedDesignWithAnnotation();
- Assert.assertNotNull(d.ok);
- Assert.assertNotNull(d.cancel);
- Assert.assertEquals("original", d.preInitializedField.getValue());
+ assertNotNull(d.ok);
+ assertNotNull(d.cancel);
+ assertEquals("original", d.preInitializedField.getValue());
}
}
diff --git a/server/src/test/java/com/vaadin/tests/event/EventRouterTest.java b/server/src/test/java/com/vaadin/tests/event/EventRouterTest.java
index a290d43ea3..013c8b8f58 100644
--- a/server/src/test/java/com/vaadin/tests/event/EventRouterTest.java
+++ b/server/src/test/java/com/vaadin/tests/event/EventRouterTest.java
@@ -15,10 +15,12 @@
*/
package com.vaadin.tests.event;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
import java.lang.reflect.Method;
import org.easymock.EasyMock;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -70,10 +72,10 @@ public class EventRouterTest {
EasyMock.replay(component, listener);
try {
router.fireEvent(new Component.Event(component));
- Assert.fail("Did not receive expected exception from listener");
+ fail("Did not receive expected exception from listener");
} catch (RuntimeException e) {
// e is a ListenerMethod@MethodException
- Assert.assertEquals("listener failed", e.getCause().getMessage());
+ assertEquals("listener failed", e.getCause().getMessage());
}
EasyMock.verify(listener);
}
diff --git a/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java b/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java
index aa37e860d7..d85c23b5f8 100644
--- a/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java
@@ -1,5 +1,7 @@
package com.vaadin.tests.server;
+import static org.junit.Assert.fail;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -26,7 +28,6 @@ import java.util.jar.JarFile;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.ui.Component;
@@ -213,7 +214,7 @@ public class ClassesSerializableTest {
field.getDeclaringClass().getName(), field.getName()))
.collect(Collectors.joining(", "));
- Assert.fail("Fields with functional types that are not serializable: "
+ fail("Fields with functional types that are not serializable: "
+ nonSerializableString);
}
@@ -233,9 +234,8 @@ public class ClassesSerializableTest {
nonSerializableString += ")";
}
}
- Assert.fail(
- "Serializable not implemented by the following classes and interfaces: "
- + nonSerializableString);
+ fail("Serializable not implemented by the following classes and interfaces: "
+ + nonSerializableString);
}
diff --git a/server/src/test/java/com/vaadin/tests/server/CsrfTokenMissingTest.java b/server/src/test/java/com/vaadin/tests/server/CsrfTokenMissingTest.java
index 2f4ba832d3..da1edeff59 100644
--- a/server/src/test/java/com/vaadin/tests/server/CsrfTokenMissingTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/CsrfTokenMissingTest.java
@@ -15,6 +15,9 @@
*/
package com.vaadin.tests.server;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -23,7 +26,6 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import org.easymock.EasyMock;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -149,7 +151,7 @@ public class CsrfTokenMissingTest {
} catch (JsonException e) {
LOGGER.log(Level.SEVERE, "", e);
- Assert.assertTrue(false);
+ assertTrue(false);
return null;
}
}
@@ -196,8 +198,8 @@ public class CsrfTokenMissingTest {
RpcRequest rpcRequest = createRequest();
- Assert.assertTrue(isDefaultToken(rpcRequest));
- Assert.assertFalse(isRequestValid(rpcRequest));
+ assertTrue(isDefaultToken(rpcRequest));
+ assertFalse(isRequestValid(rpcRequest));
}
@Test
@@ -206,8 +208,8 @@ public class CsrfTokenMissingTest {
RpcRequest rpcRequest = createRequest();
- Assert.assertTrue(isDefaultToken(rpcRequest));
- Assert.assertTrue(isRequestValid(rpcRequest));
+ assertTrue(isDefaultToken(rpcRequest));
+ assertTrue(isRequestValid(rpcRequest));
}
@Test
@@ -216,8 +218,8 @@ public class CsrfTokenMissingTest {
RpcRequest rpcRequest = createRequest();
- Assert.assertTrue(isInvalidToken(rpcRequest));
- Assert.assertFalse(isRequestValid(rpcRequest));
+ assertTrue(isInvalidToken(rpcRequest));
+ assertFalse(isRequestValid(rpcRequest));
}
@Test
@@ -226,8 +228,8 @@ public class CsrfTokenMissingTest {
RpcRequest rpcRequest = createRequest();
- Assert.assertTrue(isInvalidToken(rpcRequest));
- Assert.assertTrue(isRequestValid(rpcRequest));
+ assertTrue(isInvalidToken(rpcRequest));
+ assertTrue(isRequestValid(rpcRequest));
}
@Test
@@ -236,8 +238,8 @@ public class CsrfTokenMissingTest {
RpcRequest rpcRequest = createRequest();
- Assert.assertTrue(isValidToken(rpcRequest));
- Assert.assertTrue(isRequestValid(rpcRequest));
+ assertTrue(isValidToken(rpcRequest));
+ assertTrue(isRequestValid(rpcRequest));
}
@Test
@@ -246,8 +248,8 @@ public class CsrfTokenMissingTest {
RpcRequest rpcRequest = createRequest();
- Assert.assertTrue(isValidToken(rpcRequest));
- Assert.assertTrue(isRequestValid(rpcRequest));
+ assertTrue(isValidToken(rpcRequest));
+ assertTrue(isRequestValid(rpcRequest));
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/StreamResourceTest.java b/server/src/test/java/com/vaadin/tests/server/StreamResourceTest.java
index 7f6e17d8f8..438bf31925 100644
--- a/server/src/test/java/com/vaadin/tests/server/StreamResourceTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/StreamResourceTest.java
@@ -15,8 +15,10 @@
*/
package com.vaadin.tests.server;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
import org.easymock.EasyMock;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.server.StreamResource;
@@ -33,7 +35,7 @@ public class StreamResourceTest {
StreamResource resource1 = new StreamResource(null, null);
StreamResource resource2 = new StreamResource(null, null);
- Assert.assertEquals(resource1, resource2);
+ assertEquals(resource1, resource2);
}
@Test
@@ -42,7 +44,7 @@ public class StreamResourceTest {
StreamResource resource2 = new StreamResource(
EasyMock.createMock(StreamSource.class), "");
- Assert.assertNotEquals(resource1, resource2);
+ assertNotEquals(resource1, resource2);
}
@Test
diff --git a/server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java b/server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java
index 2203635430..8a31b8cf98 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/AbstractListenerMethodsTestBase.java
@@ -1,5 +1,8 @@
package com.vaadin.tests.server.component;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
@@ -7,7 +10,6 @@ import java.util.HashSet;
import java.util.Set;
import org.easymock.EasyMock;
-import org.junit.Assert;
import com.vaadin.shared.Registration;
import com.vaadin.tests.VaadinClasses;
@@ -54,13 +56,11 @@ public abstract class AbstractListenerMethodsTestBase {
.getName()
+ ";");
System.out.println("import " + c.getName() + ";");
- System.out
- .println(
- "public class " + c.getSimpleName()
- + "Listeners extends "
- + AbstractListenerMethodsTestBase.class
- .getSimpleName()
- + " {");
+ System.out.println("public class " + c.getSimpleName()
+ + "Listeners extends "
+ + AbstractListenerMethodsTestBase.class
+ .getSimpleName()
+ + " {");
}
String listenerClassName = m.getParameterTypes()[0]
@@ -163,11 +163,10 @@ public abstract class AbstractListenerMethodsTestBase {
SecurityException, IllegalAccessException,
InvocationTargetException, NoSuchMethodException {
Collection<?> registeredListeners = getListeners(c, eventClass);
- Assert.assertEquals("Number of listeners", expectedListeners.length,
+ assertEquals("Number of listeners", expectedListeners.length,
registeredListeners.size());
- Assert.assertArrayEquals(expectedListeners,
- registeredListeners.toArray());
+ assertArrayEquals(expectedListeners, registeredListeners.toArray());
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/ComponentSizeParseTest.java b/server/src/test/java/com/vaadin/tests/server/component/ComponentSizeParseTest.java
index c0de675414..6403f9f956 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/ComponentSizeParseTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/ComponentSizeParseTest.java
@@ -16,7 +16,8 @@
package com.vaadin.tests.server.component;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
import com.vaadin.server.Sizeable.Unit;
@@ -49,13 +50,13 @@ public class ComponentSizeParseTest {
LabelWithPublicState label = new LabelWithPublicState();
label.setHeight(string);
- Assert.assertEquals(amout, label.getHeight(), 0);
- Assert.assertEquals(unit, label.getHeightUnits());
+ assertEquals(amout, label.getHeight(), 0);
+ assertEquals(unit, label.getHeightUnits());
label = new LabelWithPublicState();
label.setHeight(10, unit);
label.beforeClientResponse(true);
- Assert.assertEquals(string, label.getState().height);
+ assertEquals(string, label.getState().height);
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/DeclarativeMarginTestBase.java b/server/src/test/java/com/vaadin/tests/server/component/DeclarativeMarginTestBase.java
index 66f6076f7b..f90b69bf1c 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/DeclarativeMarginTestBase.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/DeclarativeMarginTestBase.java
@@ -15,7 +15,8 @@
*/
package com.vaadin.tests.server.component;
-import org.junit.Assert;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.tests.design.DeclarativeTestBase;
@@ -34,7 +35,7 @@ public abstract class DeclarativeMarginTestBase<L extends Layout & MarginHandler
}
design += " />";
L layout = read(design);
- Assert.assertTrue(layout.isSpacing());
+ assertTrue(layout.isSpacing());
testWrite(design, layout);
// Spacing off
@@ -44,7 +45,7 @@ public abstract class DeclarativeMarginTestBase<L extends Layout & MarginHandler
}
design += " />";
layout = read(design);
- Assert.assertFalse(layout.isSpacing());
+ assertFalse(layout.isSpacing());
testWrite(design, layout);
}
@@ -65,7 +66,7 @@ public abstract class DeclarativeMarginTestBase<L extends Layout & MarginHandler
// introspection and MarginInfo is not a proper bean. It ends up
// considering *all* MarginInfo objects equal... (#18229)
L layout = read(design);
- Assert.assertEquals("For tag: " + design, marginToTest,
+ assertEquals("For tag: " + design, marginToTest,
layout.getMargin());
testWrite(design, layout);
diff --git a/server/src/test/java/com/vaadin/tests/server/component/FinalMethodTest.java b/server/src/test/java/com/vaadin/tests/server/component/FinalMethodTest.java
index 71d423808e..718f9d0222 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/FinalMethodTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/FinalMethodTest.java
@@ -1,10 +1,11 @@
package com.vaadin.tests.server.component;
+import static org.junit.Assert.assertTrue;
+
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.HashSet;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.tests.VaadinClasses;
@@ -29,7 +30,7 @@ public class FinalMethodTest {
ensureNoFinalMethods(c, tested);
count++;
}
- Assert.assertTrue(count > 0);
+ assertTrue(count > 0);
}
private void ensureNoFinalMethods(Class<?> clazz,
diff --git a/server/src/test/java/com/vaadin/tests/server/component/ItemCaptionGeneratorTest.java b/server/src/test/java/com/vaadin/tests/server/component/ItemCaptionGeneratorTest.java
index 1f80e46476..a9f9b48471 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/ItemCaptionGeneratorTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/ItemCaptionGeneratorTest.java
@@ -1,9 +1,10 @@
package com.vaadin.tests.server.component;
+import static org.junit.Assert.assertEquals;
+
import java.util.ArrayList;
import java.util.Collection;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.provider.DataGenerator;
@@ -71,9 +72,8 @@ public class ItemCaptionGeneratorTest {
listing.getDataCommunicator().addDataGenerator(dataGenerator);
listing.getDataCommunicator().beforeClientResponse(true);
- Assert.assertEquals(
- listing.getClass().getName()
- + " does not convert null caption from generator to empty string",
+ assertEquals(listing.getClass().getName()
+ + " does not convert null caption from generator to empty string",
"",
dataGenerator.generated.hasKey((String) listing.getData())
? dataGenerator.generated.getString(
diff --git a/server/src/test/java/com/vaadin/tests/server/component/StateGetDoesNotMarkDirtyTest.java b/server/src/test/java/com/vaadin/tests/server/component/StateGetDoesNotMarkDirtyTest.java
index 99c686743c..459a876467 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/StateGetDoesNotMarkDirtyTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/StateGetDoesNotMarkDirtyTest.java
@@ -1,5 +1,7 @@
package com.vaadin.tests.server.component;
+import static org.junit.Assert.assertTrue;
+
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -9,7 +11,6 @@ import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -96,7 +97,7 @@ public class StateGetDoesNotMarkDirtyTest {
}
}
}
- Assert.assertTrue(count > 0);
+ assertTrue(count > 0);
}
private void prepareMockUI(Component newInstance) {
diff --git a/server/src/test/java/com/vaadin/tests/server/component/WriteEmptyDesignTest.java b/server/src/test/java/com/vaadin/tests/server/component/WriteEmptyDesignTest.java
index 4c65744224..c3fe9e4a4b 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/WriteEmptyDesignTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/WriteEmptyDesignTest.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.tests.server.component;
+import static org.junit.Assert.assertEquals;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -22,7 +24,6 @@ import java.io.OutputStream;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.ui.Component;
@@ -54,7 +55,7 @@ public class WriteEmptyDesignTest {
private void checkHtml(String html) {
Document doc = Jsoup.parse(html);
Element body = doc.body();
- Assert.assertEquals("There should be no elements in the html body.", "",
+ assertEquals("There should be no elements in the html body.", "",
body.html());
}
-} \ 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 a3b9e244cf..05e31fc0c1 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
@@ -170,7 +170,7 @@ public abstract class AbstractListingDeclarativeTest<T extends AbstractListing>
private void testReadData(String design, T expected, T read,
DesignContext context) {
- Assert.assertEquals(
+ assertEquals(
read.getDataCommunicator().getDataProvider()
.size(new Query<>()),
expected.getDataCommunicator().getDataProvider()
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 1b11ab11dc..35f7647049 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
@@ -68,7 +68,7 @@ public abstract class AbstractMultiSelectDeclarativeTest<T extends AbstractMulti
DesignContext context = readComponentAndCompare(design, component,
ctxt -> configureContext(type, attribute, component, ctxt));
- Assert.assertEquals(type,
+ assertEquals(type,
context.getCustomAttributes(context.getRootComponent())
.get(attribute));
context = new DesignContext();
@@ -97,7 +97,7 @@ public abstract class AbstractMultiSelectDeclarativeTest<T extends AbstractMulti
DesignContext context = readComponentAndCompare(design, component,
ctxt -> configureContext(type, attribute, component, ctxt));
- Assert.assertEquals(type,
+ assertEquals(type,
context.getCustomAttributes(context.getRootComponent())
.get(attribute));
context = new DesignContext();
diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/LayoutSettingsOnReplaceTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/LayoutSettingsOnReplaceTest.java
index 79164dabd7..39d3a00d50 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/LayoutSettingsOnReplaceTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/LayoutSettingsOnReplaceTest.java
@@ -15,7 +15,8 @@
*/
package com.vaadin.tests.server.component.abstractorderedlayout;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
import com.vaadin.ui.AbstractComponent;
@@ -52,7 +53,7 @@ public class LayoutSettingsOnReplaceTest {
};
layout.replaceComponent(first, replace);
- Assert.assertEquals(
+ assertEquals(
"Expand ratio for replaced component is not "
+ "the same as for previous one",
ratio, layout.getExpandRatio(replace), 0.0001);
@@ -79,7 +80,7 @@ public class LayoutSettingsOnReplaceTest {
};
layout.replaceComponent(first, replace);
- Assert.assertEquals(
+ assertEquals(
"Alignment for replaced component is not "
+ "the same as for previous one",
alignment, layout.getComponentAlignment(replace));
diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractsinglecomponentcontainer/RemoveFromParentLockingTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractsinglecomponentcontainer/RemoveFromParentLockingTest.java
index f963152960..6295b9a0e7 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/abstractsinglecomponentcontainer/RemoveFromParentLockingTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/abstractsinglecomponentcontainer/RemoveFromParentLockingTest.java
@@ -15,8 +15,9 @@
*/
package com.vaadin.tests.server.component.abstractsinglecomponentcontainer;
+import static org.junit.Assert.assertEquals;
+
import org.junit.After;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -66,7 +67,7 @@ public class RemoveFromParentLockingTest {
throw new AssertionError(
"Moving component when not holding its sessions's lock should throw");
} catch (IllegalStateException e) {
- Assert.assertEquals(
+ assertEquals(
"Cannot remove from parent when the session is not locked.",
e.getMessage());
}
@@ -99,7 +100,7 @@ public class RemoveFromParentLockingTest {
throw new AssertionError(
"Moving component when not holding its sessions's lock should throw");
} catch (IllegalStateException e) {
- Assert.assertEquals(
+ assertEquals(
"Cannot remove from parent when the session is not locked."
+ " Furthermore, there is another locked session, indicating that the component might be about to be moved from one session to another.",
e.getMessage());
diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractsingleselect/AbstractSingleSelectDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractsingleselect/AbstractSingleSelectDeclarativeTest.java
index 6e46658b86..9dcbb31246 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/abstractsingleselect/AbstractSingleSelectDeclarativeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/abstractsingleselect/AbstractSingleSelectDeclarativeTest.java
@@ -64,7 +64,7 @@ public abstract class AbstractSingleSelectDeclarativeTest<T extends AbstractSing
component.setSelectedItem("bar");
DesignContext context = readComponentAndCompare(design, component);
- Assert.assertEquals(type,
+ assertEquals(type,
context.getCustomAttributes(context.getRootComponent())
.get(attribute));
context = new DesignContext();
@@ -93,7 +93,7 @@ public abstract class AbstractSingleSelectDeclarativeTest<T extends AbstractSing
component.setValue("bar");
DesignContext context = readComponentAndCompare(design, component);
- Assert.assertEquals(type,
+ assertEquals(type,
context.getCustomAttributes(context.getRootComponent())
.get(attribute));
context = new DesignContext();
diff --git a/server/src/test/java/com/vaadin/tests/server/component/audio/AudioStateTest.java b/server/src/test/java/com/vaadin/tests/server/component/audio/AudioStateTest.java
index d96b6b3bc9..89dc4f547c 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/audio/AudioStateTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/audio/AudioStateTest.java
@@ -15,7 +15,8 @@
*/
package com.vaadin.tests.server.component.audio;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
import com.vaadin.shared.ui.audio.AudioState;
@@ -30,7 +31,7 @@ public class AudioStateTest {
public void getState_audioHasCustomState() {
TestAudio audio = new TestAudio();
AudioState state = audio.getState();
- Assert.assertEquals("Unexpected state class", AudioState.class,
+ assertEquals("Unexpected state class", AudioState.class,
state.getClass());
}
@@ -38,14 +39,14 @@ public class AudioStateTest {
public void getPrimaryStyleName_audioHasCustomPrimaryStyleName() {
Audio audio = new Audio();
AudioState state = new AudioState();
- Assert.assertEquals("Unexpected primary style name",
- state.primaryStyleName, audio.getPrimaryStyleName());
+ assertEquals("Unexpected primary style name", state.primaryStyleName,
+ audio.getPrimaryStyleName());
}
@Test
public void audioStateHasCustomPrimaryStyleName() {
AudioState state = new AudioState();
- Assert.assertEquals("Unexpected primary style name", "v-audio",
+ assertEquals("Unexpected primary style name", "v-audio",
state.primaryStyleName);
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/button/ButtonClickTest.java b/server/src/test/java/com/vaadin/tests/server/component/button/ButtonClickTest.java
index 00bba9cd1d..2adbfe2df8 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/button/ButtonClickTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/button/ButtonClickTest.java
@@ -1,8 +1,11 @@
package com.vaadin.tests.server.component.button;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.concurrent.atomic.AtomicInteger;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.server.VaadinRequest;
@@ -25,13 +28,13 @@ public class ButtonClickTest {
});
b.click();
- Assert.assertEquals(1, counter.get());
+ assertEquals(1, counter.get());
}
@Test
public void testClick() {
getButton().click();
- Assert.assertTrue("Button doesn't fire clicks", clicked);
+ assertTrue("Button doesn't fire clicks", clicked);
}
@Test
@@ -39,7 +42,7 @@ public class ButtonClickTest {
Button b = getButton();
b.setEnabled(false);
b.click();
- Assert.assertFalse("Disabled button fires click events", clicked);
+ assertFalse("Disabled button fires click events", clicked);
}
private Button getButton() {
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 70f93e7cff..408a7ca3b1 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
@@ -81,23 +81,23 @@ public class ButtonDeclarativeTest extends DeclarativeTestBase<Button> {
String expectedCaptionPlainText = "> One";
Button read = read(designPlainText);
- Assert.assertEquals(expectedCaptionPlainText, read.getCaption());
+ assertEquals(expectedCaptionPlainText, read.getCaption());
designPlainText = designPlainText.replace("vaadin-button",
"vaadin-native-button");
Button nativeButton = read(designPlainText);
- Assert.assertEquals(expectedCaptionPlainText,
+ assertEquals(expectedCaptionPlainText,
nativeButton.getCaption());
String designHtml = "<vaadin-button>&gt; One</vaadin-button>";
String expectedCaptionHtml = "&gt; One";
read = read(designHtml);
- Assert.assertEquals(expectedCaptionHtml, read.getCaption());
+ assertEquals(expectedCaptionHtml, read.getCaption());
designHtml = designHtml.replace("vaadin-button",
"vaadin-native-button");
nativeButton = read(designHtml);
- Assert.assertEquals(expectedCaptionHtml, nativeButton.getCaption());
+ assertEquals(expectedCaptionHtml, nativeButton.getCaption());
read = new Button("&amp; Test");
read.setCaptionAsHtml(true);
diff --git a/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxFilteringTest.java b/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxFilteringTest.java
index 35c28eba17..9db40d2ed6 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxFilteringTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxFilteringTest.java
@@ -15,13 +15,15 @@
*/
package com.vaadin.tests.server.component.combobox;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -42,8 +44,8 @@ import com.vaadin.ui.ComboBox;
* @author Vaadin Ltd
*/
public class ComboBoxFilteringTest {
- private static final String[] PERSON_NAMES = {
- "Enrique Iglesias", "Henry Dunant", "Erwin Engelbrecht" };
+ private static final String[] PERSON_NAMES = { "Enrique Iglesias",
+ "Henry Dunant", "Erwin Engelbrecht" };
private ComboBox<Person> comboBox;
@@ -196,28 +198,26 @@ public class ComboBoxFilteringTest {
comboBox.setDataProvider(provider);
- Assert.assertSame(provider, comboBox.getDataProvider());
+ assertSame(provider, comboBox.getDataProvider());
}
@Test
public void setItems_hasListDataProvider() {
comboBox.setItems();
- Assert.assertEquals(ListDataProvider.class,
+ assertEquals(ListDataProvider.class,
comboBox.getDataProvider().getClass());
}
private void checkFiltering(String filterText, String nonMatchingFilterText,
int totalMatches, int matchingResults) {
- Assert.assertEquals(
- "ComboBox filtered out results with no filter applied",
+ assertEquals("ComboBox filtered out results with no filter applied",
totalMatches, comboBoxSizeWithFilter(null));
- Assert.assertEquals(
- "ComboBox filtered out results with empty filter string",
+ assertEquals("ComboBox filtered out results with empty filter string",
totalMatches, comboBoxSizeWithFilter(""));
- Assert.assertEquals("ComboBox filtered out wrong number of results",
+ assertEquals("ComboBox filtered out wrong number of results",
matchingResults, comboBoxSizeWithFilter(filterText));
- Assert.assertEquals(
+ assertEquals(
"ComboBox should have no results with a non-matching filter", 0,
comboBoxSizeWithFilter(nonMatchingFilterText));
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/customlayout/CustomLayoutTest.java b/server/src/test/java/com/vaadin/tests/server/component/customlayout/CustomLayoutTest.java
index 9d60628e12..8ebc620328 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/customlayout/CustomLayoutTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/customlayout/CustomLayoutTest.java
@@ -15,6 +15,10 @@
*/
package com.vaadin.tests.server.component.customlayout;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.ByteArrayInputStream;
import java.io.FilterInputStream;
import java.io.IOException;
@@ -26,7 +30,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.ui.CustomLayout;
@@ -52,9 +55,9 @@ public class CustomLayoutTest {
InputStreamImpl stream = new InputStreamImpl(inputStream, buffer / 2);
new CustomLayout(stream);
- Assert.assertTrue("Stream is not closed in CustomLayout CTOR ",
+ assertTrue("Stream is not closed in CustomLayout CTOR ",
stream.isClosed());
- Assert.assertEquals("Number of read bytes is incorrect", bytes.length,
+ assertEquals("Number of read bytes is incorrect", bytes.length,
stream.getCount());
}
@@ -78,7 +81,7 @@ public class CustomLayoutTest {
}
}
}
- Assert.assertNotNull(
+ assertNotNull(
"Unable to find default buffer size in CustomLayout class",
field);
field.setAccessible(true);
diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/EditorImplTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/EditorImplTest.java
index 61fd282edf..d85f9028c8 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/grid/EditorImplTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/grid/EditorImplTest.java
@@ -15,11 +15,13 @@
*/
package com.vaadin.tests.server.component.grid;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import java.util.Optional;
import java.util.stream.Stream;
-import com.vaadin.ui.Grid;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -29,6 +31,7 @@ import com.vaadin.data.PropertyDefinition;
import com.vaadin.data.PropertySet;
import com.vaadin.shared.communication.ServerRpc;
import com.vaadin.shared.ui.grid.editor.EditorServerRpc;
+import com.vaadin.ui.Grid;
import com.vaadin.ui.components.grid.EditorCancelEvent;
import com.vaadin.ui.components.grid.EditorCancelListener;
import com.vaadin.ui.components.grid.EditorImpl;
@@ -87,13 +90,13 @@ public class EditorImplTest {
@Override
public void onEditorCancel(EditorCancelEvent<Object> event) {
- Assert.assertNull(cancelEvent);
+ assertNull(cancelEvent);
cancelEvent = event;
}
@Override
public void onEditorSave(EditorSaveEvent<Object> event) {
- Assert.assertNull(saveEvent);
+ assertNull(saveEvent);
saveEvent = event;
}
@@ -128,23 +131,23 @@ public class EditorImplTest {
editor.save();
- Assert.assertNotNull(editor.saveEvent);
- Assert.assertNull(editor.cancelEvent);
+ assertNotNull(editor.saveEvent);
+ assertNull(editor.cancelEvent);
- Assert.assertEquals(editor, editor.saveEvent.getSource());
- Assert.assertEquals(beanToEdit, editor.saveEvent.getBean());
+ assertEquals(editor, editor.saveEvent.getSource());
+ assertEquals(beanToEdit, editor.saveEvent.getBean());
}
@Test
public void cancel_eventIsFired() {
editor.cancel();
- Assert.assertNull(editor.saveEvent);
- Assert.assertNotNull(editor.cancelEvent);
+ assertNull(editor.saveEvent);
+ assertNotNull(editor.cancelEvent);
- Assert.assertEquals(editor, editor.cancelEvent.getSource());
+ assertEquals(editor, editor.cancelEvent.getSource());
- Assert.assertEquals(beanToEdit, editor.cancelEvent.getBean());
+ assertEquals(beanToEdit, editor.cancelEvent.getBean());
}
@Test
@@ -153,31 +156,31 @@ public class EditorImplTest {
editor.rpc.save();
- Assert.assertNotNull(editor.saveEvent);
- Assert.assertNull(editor.cancelEvent);
+ assertNotNull(editor.saveEvent);
+ assertNull(editor.cancelEvent);
- Assert.assertEquals(editor, editor.saveEvent.getSource());
+ assertEquals(editor, editor.saveEvent.getSource());
- Assert.assertEquals(beanToEdit, editor.saveEvent.getBean());
+ assertEquals(beanToEdit, editor.saveEvent.getBean());
}
@Test
public void cancelFromClient_eventIsFired() {
editor.rpc.cancel(false);
- Assert.assertNull(editor.saveEvent);
- Assert.assertNotNull(editor.cancelEvent);
+ assertNull(editor.saveEvent);
+ assertNotNull(editor.cancelEvent);
- Assert.assertEquals(editor, editor.cancelEvent.getSource());
+ assertEquals(editor, editor.cancelEvent.getSource());
- Assert.assertEquals(beanToEdit, editor.cancelEvent.getBean());
+ assertEquals(beanToEdit, editor.cancelEvent.getBean());
}
@Test
public void cancelAfterSaveFromClient_eventIsNotFired() {
editor.rpc.cancel(true);
- Assert.assertNull(editor.saveEvent);
- Assert.assertNull(editor.cancelEvent);
+ assertNull(editor.saveEvent);
+ assertNull(editor.cancelEvent);
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/GridChildrenTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/GridChildrenTest.java
index 97cfe6ebc7..6a8e329f20 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/grid/GridChildrenTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/grid/GridChildrenTest.java
@@ -15,9 +15,12 @@
*/
package com.vaadin.tests.server.component.grid;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+
import java.util.Iterator;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -48,8 +51,8 @@ public class GridChildrenTest {
Label label = new Label();
merged.setComponent(label);
Iterator<Component> i = grid.iterator();
- Assert.assertEquals(label, i.next());
- Assert.assertFalse(i.hasNext());
+ assertEquals(label, i.next());
+ assertFalse(i.hasNext());
}
@Test
@@ -58,9 +61,9 @@ public class GridChildrenTest {
"baz");
Label label = new Label();
merged.setComponent(label);
- Assert.assertEquals(grid, label.getParent());
+ assertEquals(grid, label.getParent());
merged.setText("foo");
- Assert.assertNull(label.getParent());
+ assertNull(label.getParent());
}
@Test
@@ -69,9 +72,9 @@ public class GridChildrenTest {
"baz");
Label label = new Label();
merged.setComponent(label);
- Assert.assertEquals(grid, label.getParent());
+ assertEquals(grid, label.getParent());
grid.removeHeaderRow(0);
- Assert.assertNull(label.getParent());
+ assertNull(label.getParent());
}
@Test
@@ -79,9 +82,9 @@ public class GridChildrenTest {
FooterCell merged = grid.addFooterRowAt(0).join("foo", "bar", "baz");
Label label = new Label();
merged.setComponent(label);
- Assert.assertEquals(grid, label.getParent());
+ assertEquals(grid, label.getParent());
merged.setText("foo");
- Assert.assertNull(label.getParent());
+ assertNull(label.getParent());
}
@Test
@@ -89,9 +92,9 @@ public class GridChildrenTest {
FooterCell merged = grid.addFooterRowAt(0).join("foo", "bar", "baz");
Label label = new Label();
merged.setComponent(label);
- Assert.assertEquals(grid, label.getParent());
+ assertEquals(grid, label.getParent());
grid.removeFooterRow(0);
- Assert.assertNull(label.getParent());
+ assertNull(label.getParent());
}
@Test
@@ -100,8 +103,8 @@ public class GridChildrenTest {
Label label = new Label();
merged.setComponent(label);
Iterator<Component> i = grid.iterator();
- Assert.assertEquals(label, i.next());
- Assert.assertFalse(i.hasNext());
- Assert.assertEquals(grid, label.getParent());
+ assertEquals(label, i.next());
+ assertFalse(i.hasNext());
+ assertEquals(grid, label.getParent());
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/GridCustomPropertySetTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/GridCustomPropertySetTest.java
index c1726d77ba..ba773ca68d 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/grid/GridCustomPropertySetTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/grid/GridCustomPropertySetTest.java
@@ -15,10 +15,11 @@
*/
package com.vaadin.tests.server.component.grid;
+import static org.junit.Assert.assertEquals;
+
import java.util.Optional;
import java.util.stream.Stream;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.PropertyDefinition;
@@ -166,20 +167,20 @@ public class GridCustomPropertySetTest {
@Test
public void customPropertySet() {
GridWithCustomPropertySet customGrid = new GridWithCustomPropertySet();
- Assert.assertEquals(0, customGrid.getColumns().size());
+ assertEquals(0, customGrid.getColumns().size());
Column<MyBeanWithoutGetters, Integer> numberColumn = (Column<MyBeanWithoutGetters, Integer>) customGrid
.addColumn("numbah");
- Assert.assertEquals(1, customGrid.getColumns().size());
- Assert.assertEquals("The Number", numberColumn.getCaption());
- Assert.assertEquals(24, (int) numberColumn.getValueProvider()
+ assertEquals(1, customGrid.getColumns().size());
+ assertEquals("The Number", numberColumn.getCaption());
+ assertEquals(24, (int) numberColumn.getValueProvider()
.apply(new MyBeanWithoutGetters("foo", 24)));
Column<MyBeanWithoutGetters, String> stringColumn = (Column<MyBeanWithoutGetters, String>) customGrid
.addColumn("string");
- Assert.assertEquals(2, customGrid.getColumns().size());
- Assert.assertEquals("The String", stringColumn.getCaption());
- Assert.assertEquals("foo", stringColumn.getValueProvider()
+ assertEquals(2, customGrid.getColumns().size());
+ assertEquals("The String", stringColumn.getCaption());
+ assertEquals("foo", stringColumn.getValueProvider()
.apply(new MyBeanWithoutGetters("foo", 24)));
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java
index 52af306ec5..8d1d6c6955 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/grid/GridDeclarativeTest.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.tests.server.component.grid;
+import static org.junit.Assert.assertNull;
+
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
@@ -26,7 +28,6 @@ import org.jsoup.nodes.Element;
import org.jsoup.parser.Tag;
import org.jsoup.select.Elements;
import org.jsoup.select.Selector;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.data.SelectionModel.Multi;
@@ -109,19 +110,17 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
String headerRowText3 = "foobar";
join.setText(headerRowText3);
- String design = String.format(
- "<%s><table><colgroup>" + "<col column-id='column0' sortable>"
- + "<col column-id='id' sortable>"
- + "<col column-id='mail' sortable>"
- + "</colgroup><thead>"
- + "<tr default><th plain-text column-ids='column0'>First Name</th>"
- + "<th plain-text column-ids='id'>Id</th>"
- + "<th plain-text column-ids='mail'>Mail</th></tr>"
- + "<tr><th plain-text column-ids='column0'>%s</th>"
- + "<th colspan='2' plain-text column-ids='id,mail'>foobar</th></tr>"
- + "</thead></table></%s>",
- getComponentTag(), headerRowText1, headerRowText3,
- getComponentTag());
+ String design = String.format("<%s><table><colgroup>"
+ + "<col column-id='column0' sortable>"
+ + "<col column-id='id' sortable>"
+ + "<col column-id='mail' sortable>" + "</colgroup><thead>"
+ + "<tr default><th plain-text column-ids='column0'>First Name</th>"
+ + "<th plain-text column-ids='id'>Id</th>"
+ + "<th plain-text column-ids='mail'>Mail</th></tr>"
+ + "<tr><th plain-text column-ids='column0'>%s</th>"
+ + "<th colspan='2' plain-text column-ids='id,mail'>foobar</th></tr>"
+ + "</thead></table></%s>", getComponentTag(), headerRowText1,
+ headerRowText3, getComponentTag());
testRead(design, grid);
testWrite(design, grid);
@@ -150,19 +149,17 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
String footerRowText2 = "foobar";
footer.join(cell2, cell3).setHtml(footerRowText2);
- String design = String.format(
- "<%s><table><colgroup>" + "<col column-id='column0' sortable>"
- + "<col column-id='id' sortable>"
- + "<col column-id='mail' sortable>"
- + "</colgroup><thead>"
- + "<tr default><th plain-text column-ids='column0'>First Name</th>"
- + "<th plain-text column-ids='id'>Id</th>"
- + "<th plain-text column-ids='mail'>Mail</th></tr></thead>"
- + "<tfoot><tr><td plain-text column-ids='column0'>%s</td>"
- + "<td colspan='2' column-ids='id,mail'>%s</td></tr></tfoot>"
- + "</table></%s>",
- getComponentTag(), footerRowText1, footerRowText2,
- getComponentTag());
+ String design = String.format("<%s><table><colgroup>"
+ + "<col column-id='column0' sortable>"
+ + "<col column-id='id' sortable>"
+ + "<col column-id='mail' sortable>" + "</colgroup><thead>"
+ + "<tr default><th plain-text column-ids='column0'>First Name</th>"
+ + "<th plain-text column-ids='id'>Id</th>"
+ + "<th plain-text column-ids='mail'>Mail</th></tr></thead>"
+ + "<tfoot><tr><td plain-text column-ids='column0'>%s</td>"
+ + "<td colspan='2' column-ids='id,mail'>%s</td></tr></tfoot>"
+ + "</table></%s>", getComponentTag(), footerRowText1,
+ footerRowText2, getComponentTag());
testRead(design, grid);
testWrite(design, grid);
@@ -203,17 +200,15 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
int expandRatio = 83;
column2.setExpandRatio(expandRatio);
- String design = String.format(
- "<%s><table><colgroup>"
- + "<col column-id='column0' sortable='%s' editable resizable='%s' hidable hidden>"
- + "<col column-id='id' sortable hiding-toggle-caption='%s' width='%s' min-width='%s' max-width='%s' expand='%s'>"
- + "</colgroup><thead>"
- + "<tr default><th plain-text column-ids='column0'>%s</th>"
- + "<th plain-text column-ids='id'>%s</th>"
- + "</tr></thead>" + "</table></%s>",
- getComponentTag(), sortable, resizable, hidingToggleCaption,
- width, minWidth, maxWidth, expandRatio, caption, "Id",
- getComponentTag());
+ String design = String.format("<%s><table><colgroup>"
+ + "<col column-id='column0' sortable='%s' editable resizable='%s' hidable hidden>"
+ + "<col column-id='id' sortable hiding-toggle-caption='%s' width='%s' min-width='%s' max-width='%s' expand='%s'>"
+ + "</colgroup><thead>"
+ + "<tr default><th plain-text column-ids='column0'>%s</th>"
+ + "<th plain-text column-ids='id'>%s</th>" + "</tr></thead>"
+ + "</table></%s>", getComponentTag(), sortable, resizable,
+ hidingToggleCaption, width, minWidth, maxWidth, expandRatio,
+ caption, "Id", getComponentTag());
testRead(design, grid, true);
testWrite(design, grid);
@@ -232,15 +227,14 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
footerRow.getCell(column1).setText("x");
footerRow.getCell(column2).setHtml("y");
- String design = String.format(
- "<%s><table><colgroup>" + "<col column-id='column0' sortable>"
- + "<col column-id='id' sortable></colgroup><thead>"
- + "<tr default><th plain-text column-ids='column0'>First Name</th>"
- + "<th plain-text column-ids='id'>Id</th></tr>"
- + "</thead><tbody></tbody>"
- + "<tfoot><tr><td plain-text column-ids='column0'>x</td>"
- + "<td column-ids='id'>y</td></tr></tfoot>"
- + "</table></%s>",
+ String design = String.format("<%s><table><colgroup>"
+ + "<col column-id='column0' sortable>"
+ + "<col column-id='id' sortable></colgroup><thead>"
+ + "<tr default><th plain-text column-ids='column0'>First Name</th>"
+ + "<th plain-text column-ids='id'>Id</th></tr>"
+ + "</thead><tbody></tbody>"
+ + "<tfoot><tr><td plain-text column-ids='column0'>x</td>"
+ + "<td column-ids='id'>y</td></tr></tfoot>" + "</table></%s>",
getComponentTag(), getComponentTag());
testRead(design, grid);
@@ -259,22 +253,22 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
grid.addColumn(Person::getFirstName).setCaption("First Name");
grid.addColumn(Person::getLastName).setId("id").setCaption("Id");
- String design = String.format(
- "<%s><table><colgroup>" + "<col column-id='column0' sortable>"
- + "<col column-id='id' sortable></colgroup><thead>"
- + "<tr default><th plain-text column-ids='column0'>First Name</th>"
- + "<th plain-text column-ids='id'>Id</th></tr>"
- + "</thead><tbody>"
- + "<tr item='%s'><td>%s</td><td>%s</td></tr>"
- + "<tr item='%s'><td>%s</td><td>%s</td></tr>"
- + "</tbody></table></%s>",
- getComponentTag(), person1.toString(), person1.getFirstName(),
+ String design = String.format("<%s><table><colgroup>"
+ + "<col column-id='column0' sortable>"
+ + "<col column-id='id' sortable></colgroup><thead>"
+ + "<tr default><th plain-text column-ids='column0'>First Name</th>"
+ + "<th plain-text column-ids='id'>Id</th></tr>"
+ + "</thead><tbody>"
+ + "<tr item='%s'><td>%s</td><td>%s</td></tr>"
+ + "<tr item='%s'><td>%s</td><td>%s</td></tr>"
+ + "</tbody></table></%s>", getComponentTag(),
+ person1.toString(), person1.getFirstName(),
person1.getLastName(), person2.toString(),
person2.getFirstName(), person2.getLastName(),
getComponentTag());
Grid<?> readGrid = testRead(design, grid, true, true);
- Assert.assertEquals(2, readGrid.getDataProvider().size(new Query<>()));
+ assertEquals(2, readGrid.getDataProvider().size(new Query<>()));
testWrite(design, grid, true);
}
@@ -324,7 +318,7 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
person3.getLastName(), getComponentTag());
Grid<?> readGrid = testRead(design, grid, true, true);
- Assert.assertEquals(3, readGrid.getDataProvider().size(new Query<>()));
+ assertEquals(3, readGrid.getDataProvider().size(new Query<>()));
testWrite(design, grid, true);
}
@@ -344,22 +338,22 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
.setSelectionMode(SelectionMode.SINGLE);
model.select(person2);
- String design = String.format(
- "<%s><table><colgroup>" + "<col column-id='column0' sortable>"
- + "<col column-id='id' sortable></colgroup><thead>"
- + "<tr default><th plain-text column-ids='column0'>First Name</th>"
- + "<th plain-text column-ids='id'>Id</th></tr>"
- + "</thead><tbody>"
- + "<tr item='%s'><td>%s</td><td>%s</td></tr>"
- + "<tr item='%s' selected><td>%s</td><td>%s</td></tr>"
- + "</tbody></table></%s>",
- getComponentTag(), person1.toString(), person1.getFirstName(),
+ String design = String.format("<%s><table><colgroup>"
+ + "<col column-id='column0' sortable>"
+ + "<col column-id='id' sortable></colgroup><thead>"
+ + "<tr default><th plain-text column-ids='column0'>First Name</th>"
+ + "<th plain-text column-ids='id'>Id</th></tr>"
+ + "</thead><tbody>"
+ + "<tr item='%s'><td>%s</td><td>%s</td></tr>"
+ + "<tr item='%s' selected><td>%s</td><td>%s</td></tr>"
+ + "</tbody></table></%s>", getComponentTag(),
+ person1.toString(), person1.getFirstName(),
person1.getLastName(), person2.toString(),
person2.getFirstName(), person2.getLastName(),
getComponentTag());
Grid<?> readGrid = testRead(design, grid, true, true);
- Assert.assertEquals(2, readGrid.getDataProvider().size(new Query<>()));
+ assertEquals(2, readGrid.getDataProvider().size(new Query<>()));
testWrite(design, grid, true);
}
@@ -395,7 +389,7 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
person2.getLastName(), getComponentTag());
Grid<?> readGrid = testRead(design, grid, true, true);
- Assert.assertEquals(2, readGrid.getDataProvider().size(new Query<>()));
+ assertEquals(2, readGrid.getDataProvider().size(new Query<>()));
testWrite(design, grid, true);
grid.setSelectionMode(SelectionMode.SINGLE);
@@ -408,7 +402,7 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
getComponentTag());
readGrid = testRead(design, grid, true, true);
- Assert.assertEquals(2, readGrid.getDataProvider().size(new Query<>()));
+ assertEquals(2, readGrid.getDataProvider().size(new Query<>()));
testWrite(design, grid, true);
}
@@ -540,8 +534,8 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
String actualFooter = grid.getFooterRow(0).getCell(id).getText();
String expected = "> Test";
- Assert.assertEquals(expected, actualHeader);
- Assert.assertEquals(expected, actualFooter);
+ assertEquals(expected, actualHeader);
+ assertEquals(expected, actualFooter);
design = design.replace(plainText, "");
grid = read(design);
@@ -549,8 +543,8 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
actualFooter = grid.getFooterRow(0).getCell(id).getHtml();
expected = "&gt; Test";
- Assert.assertEquals(expected, actualHeader);
- Assert.assertEquals(expected, actualFooter);
+ assertEquals(expected, actualHeader);
+ assertEquals(expected, actualFooter);
grid = new Grid<>();
Column<Person, String> column = grid.addColumn(Person::getFirstName)
@@ -566,9 +560,9 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
Element root = new Element(Tag.valueOf(getComponentTag()), "");
grid.writeDesign(root, new DesignContext());
- Assert.assertEquals("&amp;amp; Test",
+ assertEquals("&amp;amp; Test",
root.getElementsByTag("th").get(0).html());
- Assert.assertEquals("&amp;amp; Test",
+ assertEquals("&amp;amp; Test",
root.getElementsByTag("td").get(0).html());
header = grid.addHeaderRowAt(0);
@@ -581,10 +575,8 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
root = new Element(Tag.valueOf(getComponentTag()), "");
grid.writeDesign(root, new DesignContext());
- Assert.assertEquals("&amp; Test",
- root.getElementsByTag("th").get(0).html());
- Assert.assertEquals("&amp; Test",
- root.getElementsByTag("td").get(0).html());
+ assertEquals("&amp; Test", root.getElementsByTag("th").get(0).html());
+ assertEquals("&amp; Test", root.getElementsByTag("td").get(0).html());
}
@@ -617,14 +609,14 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
}
private void compareHeaders(Grid<?> expected, Grid<?> actual) {
- Assert.assertEquals("Different header row count",
- expected.getHeaderRowCount(), actual.getHeaderRowCount());
+ assertEquals("Different header row count", expected.getHeaderRowCount(),
+ actual.getHeaderRowCount());
for (int i = 0; i < expected.getHeaderRowCount(); ++i) {
HeaderRow expectedRow = expected.getHeaderRow(i);
HeaderRow actualRow = actual.getHeaderRow(i);
if (expectedRow.equals(expected.getDefaultHeaderRow())) {
- Assert.assertEquals("Different index for default header row",
+ assertEquals("Different index for default header row",
actual.getDefaultHeaderRow(), actualRow);
}
@@ -636,11 +628,11 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
switch (expectedCell.getCellType()) {
case TEXT:
- Assert.assertEquals(baseError + "Text content",
+ assertEquals(baseError + "Text content",
expectedCell.getText(), actualCell.getText());
break;
case HTML:
- Assert.assertEquals(baseError + "HTML content",
+ assertEquals(baseError + "HTML content",
expectedCell.getHtml(), actualCell.getHtml());
break;
case WIDGET:
@@ -654,8 +646,8 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
}
private void compareFooters(Grid<?> expected, Grid<?> actual) {
- Assert.assertEquals("Different footer row count",
- expected.getFooterRowCount(), actual.getFooterRowCount());
+ assertEquals("Different footer row count", expected.getFooterRowCount(),
+ actual.getFooterRowCount());
for (int i = 0; i < expected.getFooterRowCount(); ++i) {
FooterRow expectedRow = expected.getFooterRow(i);
FooterRow actualRow = actual.getFooterRow(i);
@@ -668,11 +660,11 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
switch (expectedCell.getCellType()) {
case TEXT:
- Assert.assertEquals(baseError + "Text content",
+ assertEquals(baseError + "Text content",
expectedCell.getText(), actualCell.getText());
break;
case HTML:
- Assert.assertEquals(baseError + "HTML content",
+ assertEquals(baseError + "HTML content",
expectedCell.getHtml(), actualCell.getHtml());
break;
case WIDGET:
@@ -688,7 +680,7 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
private void compareGridColumns(Grid<?> expected, Grid<?> actual) {
List<?> columns = expected.getColumns();
List<?> actualColumns = actual.getColumns();
- Assert.assertEquals("Different amount of columns", columns.size(),
+ assertEquals("Different amount of columns", columns.size(),
actualColumns.size());
for (int i = 0; i < columns.size(); ++i) {
Column<?, ?> col1 = (Column<?, ?>) columns.get(i);
@@ -762,7 +754,7 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
@SuppressWarnings("unchecked")
Grid<Person> grid = read(design);
- Assert.assertEquals(beanClass, grid.getBeanType());
+ assertEquals(beanClass, grid.getBeanType());
testWrite(design, grid);
}
@@ -786,31 +778,29 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
Document html = Jsoup.parse(design);
Elements cols = Selector.select("vaadin-grid", html)
.select("colgroup > col");
- Assert.assertEquals("Number of columns in the design file", i,
- cols.size());
+ assertEquals("Number of columns in the design file", i, cols.size());
}
private void assertColumns(int expectedCount,
List<Column<Person, ?>> expectedColumns,
List<Column<Person, ?>> columns, Person testPerson) {
- Assert.assertEquals(expectedCount, expectedColumns.size());
- Assert.assertEquals(expectedCount, columns.size());
+ assertEquals(expectedCount, expectedColumns.size());
+ assertEquals(expectedCount, columns.size());
for (int i = 0; i < expectedColumns.size(); i++) {
Column<Person, ?> expectedColumn = expectedColumns.get(i);
Column<Person, ?> column = columns.get(i);
// Property mapping
- Assert.assertEquals(expectedColumn.getId(), column.getId());
+ assertEquals(expectedColumn.getId(), column.getId());
// Header caption
- Assert.assertEquals(expectedColumn.getCaption(),
- column.getCaption());
+ assertEquals(expectedColumn.getCaption(), column.getCaption());
// Value providers are not stored in the declarative file
// so this only works for bean properties
if (column.getId() != null
&& !column.getId().equals("column" + i)) {
- Assert.assertEquals(
+ assertEquals(
expectedColumn.getValueProvider().apply(testPerson),
column.getValueProvider().apply(testPerson));
}
@@ -834,8 +824,8 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
assertColumns(0, grid.getColumns(), readGrid.getColumns(), testPerson);
// Can add a mapped property
- Assert.assertEquals("The email", readGrid.addColumn("email")
- .getValueProvider().apply(testPerson));
+ assertEquals("The email", readGrid.addColumn("email").getValueProvider()
+ .apply(testPerson));
}
@Test
@@ -856,11 +846,11 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
assertColumns(1, grid.getColumns(), readGrid.getColumns(), testPerson);
// First name should not be mapped to the property
- Assert.assertNull(readGrid.getColumns().get(0).getValueProvider()
+ assertNull(readGrid.getColumns().get(0).getValueProvider()
.apply(testPerson));
// Can add a mapped property
- Assert.assertEquals("the last", readGrid.addColumn("lastName")
+ assertEquals("the last", readGrid.addColumn("lastName")
.getValueProvider().apply(testPerson));
}
@@ -882,7 +872,7 @@ public class GridDeclarativeTest extends AbstractListingDeclarativeTest<Grid> {
assertColumns(12, grid.getColumns(), readGrid.getColumns(), testPerson);
// First and last name should not be mapped to anything but should exist
- Assert.assertNull(readGrid.getColumns().get(11).getValueProvider()
+ assertNull(readGrid.getColumns().get(11).getValueProvider()
.apply(testPerson));
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/GridDetailsTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/GridDetailsTest.java
index 454b5d3b3d..08abc4b7b4 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/grid/GridDetailsTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/grid/GridDetailsTest.java
@@ -1,11 +1,14 @@
package com.vaadin.tests.server.component.grid;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -57,13 +60,10 @@ public class GridDetailsTest {
for (Component c : grid) {
if (c instanceof Label) {
String value = ((Label) c).getValue();
- Assert.assertTrue(
- "Unexpected label in component iterator with value "
- + value,
- data.remove(value));
+ assertTrue("Unexpected label in component iterator with value "
+ + value, data.remove(value));
} else {
- Assert.fail(
- "Iterator contained a component that is not a label.");
+ fail("Iterator contained a component that is not a label.");
}
}
}
@@ -78,10 +78,10 @@ public class GridDetailsTest {
@Test
public void testGridComponentIteratorIsEmptyAfterHidingDetails() {
- Assert.assertTrue("Component iterator should have components.",
+ assertTrue("Component iterator should have components.",
grid.iterator().hasNext());
data.forEach(s -> grid.setDetailsVisible(s, false));
- Assert.assertFalse("Component iterator should not have components.",
+ assertFalse("Component iterator should not have components.",
grid.iterator().hasNext());
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java
index 5f8327bb8d..cb0459dc90 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java
@@ -1,8 +1,12 @@
package com.vaadin.tests.server.component.grid;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -23,15 +27,14 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import com.vaadin.data.provider.DataCommunicator;
import org.easymock.Capture;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import com.vaadin.data.Binder.Binding;
import com.vaadin.data.ValidationException;
import com.vaadin.data.ValueProvider;
+import com.vaadin.data.provider.DataCommunicator;
import com.vaadin.data.provider.DataGenerator;
import com.vaadin.data.provider.GridSortOrder;
import com.vaadin.data.provider.QuerySortOrder;
@@ -75,7 +78,8 @@ public class GridTest {
public void testCreateGridWithDataCommunicator() {
DataCommunicator specificDataCommunicator = new DataCommunicator<>();
- TestGrid<String> grid = new TestGrid(String.class, specificDataCommunicator);
+ TestGrid<String> grid = new TestGrid(String.class,
+ specificDataCommunicator);
assertEquals(specificDataCommunicator, grid.getDataCommunicator());
}
@@ -184,7 +188,7 @@ public class GridTest {
assertEquals("foo", event.getFirstSelectedItem().get());
assertEquals("foo",
event.getAllSelectedItems().stream().findFirst().get());
- Assert.assertArrayEquals(new String[] { "foo", "bar" },
+ assertArrayEquals(new String[] { "foo", "bar" },
event.getAllSelectedItems().toArray(new String[2]));
grid.getSelectionModel().deselect("foo");
@@ -195,7 +199,7 @@ public class GridTest {
assertEquals("bar", event.getFirstSelectedItem().get());
assertEquals("bar",
event.getAllSelectedItems().stream().findFirst().get());
- Assert.assertArrayEquals(new String[] { "bar" },
+ assertArrayEquals(new String[] { "bar" },
event.getAllSelectedItems().toArray(new String[1]));
grid.getSelectionModel().deselectAll();
@@ -211,8 +215,7 @@ public class GridTest {
public void testAddSelectionListener_noSelectionMode() {
grid.setSelectionMode(SelectionMode.NONE);
- grid.addSelectionListener(
- event -> Assert.fail("never ever happens (tm)"));
+ grid.addSelectionListener(event -> fail("never ever happens (tm)"));
}
@Test
@@ -221,8 +224,8 @@ public class GridTest {
grid.sort(column);
GridSortOrder<String> sortOrder = grid.getSortOrder().get(0);
- Assert.assertEquals(column, sortOrder.getSorted());
- Assert.assertEquals(SortDirection.ASCENDING, sortOrder.getDirection());
+ assertEquals(column, sortOrder.getSorted());
+ assertEquals(SortDirection.ASCENDING, sortOrder.getDirection());
}
@Test
@@ -231,8 +234,8 @@ public class GridTest {
grid.sort(column, SortDirection.DESCENDING);
GridSortOrder<String> sortOrder = grid.getSortOrder().get(0);
- Assert.assertEquals(column, sortOrder.getSorted());
- Assert.assertEquals(SortDirection.DESCENDING, sortOrder.getDirection());
+ assertEquals(column, sortOrder.getSorted());
+ assertEquals(SortDirection.DESCENDING, sortOrder.getDirection());
}
@Test
@@ -245,13 +248,11 @@ public class GridTest {
grid.setSortOrder(order);
List<GridSortOrder<String>> sortOrder = grid.getSortOrder();
- Assert.assertEquals(column2, sortOrder.get(0).getSorted());
- Assert.assertEquals(SortDirection.DESCENDING,
- sortOrder.get(0).getDirection());
+ assertEquals(column2, sortOrder.get(0).getSorted());
+ assertEquals(SortDirection.DESCENDING, sortOrder.get(0).getDirection());
- Assert.assertEquals(column1, sortOrder.get(1).getSorted());
- Assert.assertEquals(SortDirection.ASCENDING,
- sortOrder.get(1).getDirection());
+ assertEquals(column1, sortOrder.get(1).getSorted());
+ assertEquals(SortDirection.ASCENDING, sortOrder.get(1).getDirection());
}
@Test
@@ -272,15 +273,14 @@ public class GridTest {
List<GridSortOrder<String>> list = new ArrayList<>();
AtomicReference<Boolean> fired = new AtomicReference<>();
grid.addSortListener(event -> {
- Assert.assertTrue(list.isEmpty());
+ assertTrue(list.isEmpty());
fired.set(true);
list.addAll(event.getSortOrder());
});
grid.sort(column1, SortDirection.DESCENDING);
- Assert.assertEquals(column1, list.get(0).getSorted());
- Assert.assertEquals(SortDirection.DESCENDING,
- list.get(0).getDirection());
+ assertEquals(column1, list.get(0).getSorted());
+ assertEquals(SortDirection.DESCENDING, list.get(0).getDirection());
List<GridSortOrder<String>> order = Arrays.asList(
new GridSortOrder<>(column2, SortDirection.DESCENDING),
@@ -289,19 +289,17 @@ public class GridTest {
grid.setSortOrder(order);
- Assert.assertEquals(column2, list.get(0).getSorted());
- Assert.assertEquals(SortDirection.DESCENDING,
- list.get(0).getDirection());
+ assertEquals(column2, list.get(0).getSorted());
+ assertEquals(SortDirection.DESCENDING, list.get(0).getDirection());
- Assert.assertEquals(column1, list.get(1).getSorted());
- Assert.assertEquals(SortDirection.ASCENDING,
- list.get(1).getDirection());
+ assertEquals(column1, list.get(1).getSorted());
+ assertEquals(SortDirection.ASCENDING, list.get(1).getDirection());
list.clear();
fired.set(false);
grid.clearSortOrder();
- Assert.assertEquals(0, list.size());
- Assert.assertTrue(fired.get());
+ assertEquals(0, list.size());
+ assertTrue(fired.get());
}
@Test
@@ -311,19 +309,18 @@ public class GridTest {
Column<Person, ?> nameColumn = grid.getColumn("name");
Column<Person, ?> bornColumn = grid.getColumn("born");
- Assert.assertNotNull(nameColumn);
- Assert.assertNotNull(bornColumn);
+ assertNotNull(nameColumn);
+ assertNotNull(bornColumn);
- Assert.assertEquals("Name", nameColumn.getCaption());
- Assert.assertEquals("Born", bornColumn.getCaption());
+ assertEquals("Name", nameColumn.getCaption());
+ assertEquals("Born", bornColumn.getCaption());
JsonObject json = getRowData(grid, new Person("Lorem", 2000));
Set<String> values = Stream.of(json.keys()).map(json::getString)
.collect(Collectors.toSet());
- Assert.assertEquals(new HashSet<>(Arrays.asList("Lorem", "2000")),
- values);
+ assertEquals(new HashSet<>(Arrays.asList("Lorem", "2000")), values);
assertSingleSortProperty(nameColumn, "name");
assertSingleSortProperty(bornColumn, "born");
@@ -340,18 +337,18 @@ public class GridTest {
Optional<Binding<Person, ?>> maybeBinding = grid.getEditor().getBinder()
.getBinding("name");
- Assert.assertTrue(maybeBinding.isPresent());
+ assertTrue(maybeBinding.isPresent());
Binding<Person, ?> binding = maybeBinding.get();
- Assert.assertSame(nameField, binding.getField());
+ assertSame(nameField, binding.getField());
Person person = new Person("Lorem", 2000);
grid.getEditor().getBinder().setBean(person);
- Assert.assertEquals("Lorem", nameField.getValue());
+ assertEquals("Lorem", nameField.getValue());
nameField.setValue("Ipsum");
- Assert.assertEquals("Ipsum", person.getName());
+ assertEquals("Ipsum", person.getName());
}
@Test(expected = IllegalStateException.class)
@@ -377,17 +374,16 @@ public class GridTest {
grid.addColumn("name");
List<Column<Person, ?>> columns = grid.getColumns();
- Assert.assertEquals(2, columns.size());
- Assert.assertEquals("born", columns.get(0).getId());
- Assert.assertEquals("name", columns.get(1).getId());
+ assertEquals(2, columns.size());
+ assertEquals("born", columns.get(0).getId());
+ assertEquals("name", columns.get(1).getId());
}
@Test
public void removeColumnByColumn() {
grid.removeColumn(fooColumn);
- Assert.assertEquals(
- Arrays.asList(lengthColumn, objectColumn, randomColumn),
+ assertEquals(Arrays.asList(lengthColumn, objectColumn, randomColumn),
grid.getColumns());
}
@@ -397,8 +393,7 @@ public class GridTest {
// Questionable that this doesn't throw, but that's a separate ticket...
grid.removeColumn(fooColumn);
- Assert.assertEquals(
- Arrays.asList(lengthColumn, objectColumn, randomColumn),
+ assertEquals(Arrays.asList(lengthColumn, objectColumn, randomColumn),
grid.getColumns());
}
@@ -412,8 +407,7 @@ public class GridTest {
public void removeColumnById() {
grid.removeColumn("foo");
- Assert.assertEquals(
- Arrays.asList(lengthColumn, objectColumn, randomColumn),
+ assertEquals(Arrays.asList(lengthColumn, objectColumn, randomColumn),
grid.getColumns());
}
@@ -421,14 +415,14 @@ public class GridTest {
public void removeAllColumns() {
grid.removeAllColumns();
- Assert.assertEquals(Collections.emptyList(), grid.getColumns());
+ assertEquals(Collections.emptyList(), grid.getColumns());
}
@Test
public void removeAllColumnsInGridWithoutColumns() {
grid.removeAllColumns();
grid.removeAllColumns();
- Assert.assertEquals(Collections.emptyList(), grid.getColumns());
+ assertEquals(Collections.emptyList(), grid.getColumns());
}
@Test
@@ -474,9 +468,9 @@ public class GridTest {
List<Column<String, ?>> columns = grid.getColumns();
- Assert.assertEquals(2, columns.size());
- Assert.assertEquals("length", columns.get(0).getId());
- Assert.assertEquals("foo", columns.get(1).getId());
+ assertEquals(2, columns.size());
+ assertEquals("length", columns.get(0).getId());
+ assertEquals("foo", columns.get(1).getId());
}
@Test(expected = IllegalStateException.class)
@@ -496,16 +490,16 @@ public class GridTest {
grid.setColumns("born", "name");
List<Column<Person, ?>> columns = grid.getColumns();
- Assert.assertEquals(2, columns.size());
- Assert.assertEquals("born", columns.get(0).getId());
- Assert.assertEquals("name", columns.get(1).getId());
+ assertEquals(2, columns.size());
+ assertEquals("born", columns.get(0).getId());
+ assertEquals("name", columns.get(1).getId());
}
@Test
public void setColumnOrder_byColumn() {
grid.setColumnOrder(randomColumn, lengthColumn);
- Assert.assertEquals(Arrays.asList(randomColumn, lengthColumn, fooColumn,
+ assertEquals(Arrays.asList(randomColumn, lengthColumn, fooColumn,
objectColumn), grid.getColumns());
}
@@ -519,7 +513,7 @@ public class GridTest {
public void setColumnOrder_byString() {
grid.setColumnOrder("randomColumnId", "length");
- Assert.assertEquals(Arrays.asList(randomColumn, lengthColumn, fooColumn,
+ assertEquals(Arrays.asList(randomColumn, lengthColumn, fooColumn,
objectColumn), grid.getColumns());
}
@@ -563,12 +557,12 @@ public class GridTest {
.addColumn(ValueProvider.identity())
.getComparator(SortDirection.ASCENDING);
- Assert.assertNotNull(comparator);
+ assertNotNull(comparator);
List<Object> values = new ArrayList<>(Arrays.asList(expectedOrder));
Collections.shuffle(values, new Random(42));
- Assert.assertArrayEquals(expectedOrder,
+ assertArrayEquals(expectedOrder,
values.stream().sorted(comparator).toArray());
}
@@ -587,7 +581,7 @@ public class GridTest {
String formattedValue = Stream.of(rowData.keys())
.map(rowData::getString).filter(value -> !value.equals("Name"))
.findFirst().orElse(null);
- Assert.assertEquals(formattedValue, "2,017");
+ assertEquals(formattedValue, "2,017");
}
@Test(expected = IllegalArgumentException.class)
@@ -605,7 +599,7 @@ public class GridTest {
@Test
public void columnId_sortProperty_noId() {
- Assert.assertEquals(0,
+ assertEquals(0,
objectColumn.getSortOrder(SortDirection.ASCENDING).count());
}
@@ -623,10 +617,9 @@ public class GridTest {
.getSortOrder(SortDirection.ASCENDING)
.toArray(QuerySortOrder[]::new);
- Assert.assertEquals(1, sortOrders.length);
- Assert.assertEquals(SortDirection.ASCENDING,
- sortOrders[0].getDirection());
- Assert.assertEquals(expectedProperty, sortOrders[0].getSorted());
+ assertEquals(1, sortOrders.length);
+ assertEquals(SortDirection.ASCENDING, sortOrders[0].getDirection());
+ assertEquals(expectedProperty, sortOrders[0].getSorted());
}
private static <T> JsonObject getRowData(Grid<T> grid, T row) {
diff --git a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/DefaultAlignmentTest.java b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/DefaultAlignmentTest.java
index 9b6368474f..c682a43674 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/DefaultAlignmentTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/DefaultAlignmentTest.java
@@ -1,6 +1,7 @@
package com.vaadin.tests.server.component.gridlayout;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Before;
import org.junit.Test;
@@ -24,10 +25,9 @@ public class DefaultAlignmentTest {
TextField tf = new TextField("A TextField");
gridLayout.addComponent(label);
gridLayout.addComponent(tf);
- Assert.assertEquals(Alignment.TOP_LEFT,
+ assertEquals(Alignment.TOP_LEFT,
gridLayout.getComponentAlignment(label));
- Assert.assertEquals(Alignment.TOP_LEFT,
- gridLayout.getComponentAlignment(tf));
+ assertEquals(Alignment.TOP_LEFT, gridLayout.getComponentAlignment(tf));
}
@Test
@@ -37,9 +37,9 @@ public class DefaultAlignmentTest {
gridLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
gridLayout.addComponent(label);
gridLayout.addComponent(tf);
- Assert.assertEquals(Alignment.MIDDLE_CENTER,
+ assertEquals(Alignment.MIDDLE_CENTER,
gridLayout.getComponentAlignment(label));
- Assert.assertEquals(Alignment.MIDDLE_CENTER,
+ assertEquals(Alignment.MIDDLE_CENTER,
gridLayout.getComponentAlignment(tf));
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java
index 0ca92e4ed5..a63ec8b20a 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutDeclarativeTest.java
@@ -239,7 +239,7 @@ public class GridLayoutDeclarativeTest
continue;
}
- Assert.assertEquals(expected.getComponentAlignment(eC),
+ assertEquals(expected.getComponentAlignment(eC),
result.getComponentAlignment(rC));
}
@@ -297,7 +297,7 @@ public class GridLayoutDeclarativeTest
Component component = Design.read(input);
GridLayout readLayout = (GridLayout) component;
- Assert.assertEquals(layout.getRows(), readLayout.getRows());
+ assertEquals(layout.getRows(), readLayout.getRows());
}
@Test
@@ -333,15 +333,15 @@ public class GridLayoutDeclarativeTest
+ "</vaadin-grid-layout>";
DesignContext context = Design
.read(new ByteArrayInputStream(design.getBytes(UTF_8)), null);
- Assert.assertEquals(null, context.getCustomAttributes(
+ assertEquals(null, context.getCustomAttributes(
context.getComponentByLocalId("marginComponent")));
- Assert.assertEquals(null, context.getCustomAttributes(
+ assertEquals(null, context.getCustomAttributes(
context.getComponentByLocalId("marginLeftComponent")));
- Assert.assertEquals(null, context.getCustomAttributes(
+ assertEquals(null, context.getCustomAttributes(
context.getComponentByLocalId("marginRightComponent")));
- Assert.assertEquals(null, context.getCustomAttributes(
+ assertEquals(null, context.getCustomAttributes(
context.getComponentByLocalId("marginTopComponent")));
- Assert.assertEquals(null, context.getCustomAttributes(
+ assertEquals(null, context.getCustomAttributes(
context.getComponentByLocalId("marginBottomComponent")));
}
@@ -355,8 +355,8 @@ public class GridLayoutDeclarativeTest
PreconfiguredGridLayout myLayout = (PreconfiguredGridLayout) Design
.read(new ByteArrayInputStream(design.getBytes(UTF_8)));
- Assert.assertEquals(2, myLayout.getRows());
- Assert.assertEquals(2, myLayout.getColumns());
+ assertEquals(2, myLayout.getRows());
+ assertEquals(2, myLayout.getColumns());
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/label/LabelDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/label/LabelDeclarativeTest.java
index 7a0a8957b0..d6eeb13d84 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/label/LabelDeclarativeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/label/LabelDeclarativeTest.java
@@ -94,23 +94,23 @@ public class LabelDeclarativeTest extends DeclarativeTestBase<Label> {
public void testHtmlEntities() {
String design = "<vaadin-label plain-text=\"true\">&gt; Test</vaadin-label>";
Label read = read(design);
- Assert.assertEquals("> Test", read.getValue());
+ assertEquals("> Test", read.getValue());
design = design.replace("plain-text=\"true\"", "");
read = read(design);
- Assert.assertEquals("&gt; Test", read.getValue());
+ assertEquals("&gt; Test", read.getValue());
Label label = new Label("&amp; Test");
label.setContentMode(ContentMode.TEXT);
Element root = new Element(Tag.valueOf("vaadin-label"), "");
label.writeDesign(root, new DesignContext());
- Assert.assertEquals("&amp;amp; Test", root.html());
+ assertEquals("&amp;amp; Test", root.html());
label.setContentMode(ContentMode.HTML);
root = new Element(Tag.valueOf("vaadin-label"), "");
label.writeDesign(root, new DesignContext());
- Assert.assertEquals("&amp; Test", root.html());
+ assertEquals("&amp; Test", root.html());
}
/**
diff --git a/server/src/test/java/com/vaadin/tests/server/component/loginform/LoginFormTest.java b/server/src/test/java/com/vaadin/tests/server/component/loginform/LoginFormTest.java
index a69c3f32a2..b37eea5188 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/loginform/LoginFormTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/loginform/LoginFormTest.java
@@ -1,8 +1,9 @@
package com.vaadin.tests.server.component.loginform;
+import static org.junit.Assert.assertEquals;
+
import java.util.Iterator;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -27,9 +28,9 @@ public class LoginFormTest {
@Test
public void defaultCaptions() {
- Assert.assertEquals("Username", loginForm.getUsernameCaption());
- Assert.assertEquals("Password", loginForm.getPasswordCaption());
- Assert.assertEquals("Login", loginForm.getLoginButtonCaption());
+ assertEquals("Username", loginForm.getUsernameCaption());
+ assertEquals("Password", loginForm.getPasswordCaption());
+ assertEquals("Login", loginForm.getLoginButtonCaption());
}
@Test
@@ -38,9 +39,9 @@ public class LoginFormTest {
loginForm.setPasswordCaption("p");
loginForm.setLoginButtonCaption("l");
- Assert.assertEquals("u", loginForm.getUsernameCaption());
- Assert.assertEquals("p", loginForm.getPasswordCaption());
- Assert.assertEquals("l", loginForm.getLoginButtonCaption());
+ assertEquals("u", loginForm.getUsernameCaption());
+ assertEquals("p", loginForm.getPasswordCaption());
+ assertEquals("l", loginForm.getLoginButtonCaption());
}
@Test
@@ -51,9 +52,9 @@ public class LoginFormTest {
loginForm.setPasswordCaption("p");
loginForm.setLoginButtonCaption("l");
- Assert.assertEquals("u", loginForm.getUsernameCaption());
- Assert.assertEquals("p", loginForm.getPasswordCaption());
- Assert.assertEquals("l", loginForm.getLoginButtonCaption());
+ assertEquals("u", loginForm.getUsernameCaption());
+ assertEquals("p", loginForm.getPasswordCaption());
+ assertEquals("l", loginForm.getLoginButtonCaption());
}
@Test
@@ -68,9 +69,9 @@ public class LoginFormTest {
loginForm.setPasswordCaption("p");
loginForm.setLoginButtonCaption("l");
- Assert.assertEquals("u", loginForm.getUsernameCaption());
- Assert.assertEquals("p", loginForm.getPasswordCaption());
- Assert.assertEquals("l", loginForm.getLoginButtonCaption());
+ assertEquals("u", loginForm.getUsernameCaption());
+ assertEquals("p", loginForm.getPasswordCaption());
+ assertEquals("l", loginForm.getLoginButtonCaption());
}
@Test
@@ -100,8 +101,8 @@ public class LoginFormTest {
ui.setContent(customForm);
Iterator<Component> i = ((HasComponents) customForm.iterator().next())
.iterator();
- Assert.assertEquals("Username caption", i.next().getCaption());
- Assert.assertEquals("Password caption", i.next().getCaption());
- Assert.assertEquals("Do it", i.next().getCaption());
+ assertEquals("Username caption", i.next().getCaption());
+ assertEquals("Password caption", i.next().getCaption());
+ assertEquals("Do it", i.next().getCaption());
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/menubar/MenuBarIdsTest.java b/server/src/test/java/com/vaadin/tests/server/component/menubar/MenuBarIdsTest.java
index bd8c2dd443..d06e1d438e 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/menubar/MenuBarIdsTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/menubar/MenuBarIdsTest.java
@@ -1,9 +1,11 @@
package com.vaadin.tests.server.component.menubar;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+
import java.util.HashSet;
import java.util.Set;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -81,7 +83,7 @@ public class MenuBarIdsTest implements Command {
private static void assertUniqueIds(Set<Object> ids, MenuItem item) {
int id = item.getId();
System.out.println("Item " + item.getText() + ", id: " + id);
- Assert.assertFalse(ids.contains(id));
+ assertFalse(ids.contains(id));
ids.add(id);
if (item.getChildren() != null) {
for (MenuItem subItem : item.getChildren()) {
@@ -92,8 +94,7 @@ public class MenuBarIdsTest implements Command {
@Override
public void menuSelected(MenuItem selectedItem) {
- Assert.assertNull(
- "lastSelectedItem was not cleared before selecting an item",
+ assertNull("lastSelectedItem was not cleared before selecting an item",
lastSelectedItem);
lastSelectedItem = selectedItem;
diff --git a/server/src/test/java/com/vaadin/tests/server/component/orderedlayout/DefaultAlignmentTest.java b/server/src/test/java/com/vaadin/tests/server/component/orderedlayout/DefaultAlignmentTest.java
index 7560c21adb..f0d9e9832a 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/orderedlayout/DefaultAlignmentTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/orderedlayout/DefaultAlignmentTest.java
@@ -1,6 +1,7 @@
package com.vaadin.tests.server.component.orderedlayout;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Before;
import org.junit.Test;
@@ -37,10 +38,8 @@ public class DefaultAlignmentTest {
TextField tf = new TextField("A TextField");
layout.addComponent(label);
layout.addComponent(tf);
- Assert.assertEquals(Alignment.TOP_LEFT,
- layout.getComponentAlignment(label));
- Assert.assertEquals(Alignment.TOP_LEFT,
- layout.getComponentAlignment(tf));
+ assertEquals(Alignment.TOP_LEFT, layout.getComponentAlignment(label));
+ assertEquals(Alignment.TOP_LEFT, layout.getComponentAlignment(tf));
}
@Test
@@ -59,9 +58,8 @@ public class DefaultAlignmentTest {
layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
layout.addComponent(label);
layout.addComponent(tf);
- Assert.assertEquals(Alignment.MIDDLE_CENTER,
+ assertEquals(Alignment.MIDDLE_CENTER,
layout.getComponentAlignment(label));
- Assert.assertEquals(Alignment.MIDDLE_CENTER,
- layout.getComponentAlignment(tf));
+ assertEquals(Alignment.MIDDLE_CENTER, layout.getComponentAlignment(tf));
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/tabsheet/TabSheetTest.java b/server/src/test/java/com/vaadin/tests/server/component/tabsheet/TabSheetTest.java
index 91cfe7712a..54fb58a9c3 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/tabsheet/TabSheetTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/tabsheet/TabSheetTest.java
@@ -1,15 +1,16 @@
package com.vaadin.tests.server.component.tabsheet;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
import java.util.Iterator;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.shared.ui.tabsheet.TabsheetServerRpc;
@@ -35,7 +36,7 @@ public class TabSheetTest {
Iterator<Component> iter = tabSheet.getComponentIterator();
assertEquals(c, iter.next());
- Assert.assertFalse(iter.hasNext());
+ assertFalse(iter.hasNext());
assertNotNull(tabSheet.getTab(c));
}
@@ -207,10 +208,10 @@ public class TabSheetTest {
tabSheet.replaceComponent(lbl1, lbl2);
assertSame(tab1, tabSheet.getTab(lbl1));
assertSame(tab2, tabSheet.getTab(lbl2));
- Assert.assertFalse(tab1.isClosable());
- Assert.assertTrue(tab2.isClosable());
- Assert.assertFalse(tab1.isEnabled());
- Assert.assertTrue(tab2.isEnabled());
+ assertFalse(tab1.isClosable());
+ assertTrue(tab2.isClosable());
+ assertFalse(tab1.isEnabled());
+ assertTrue(tab2.isEnabled());
assertEquals("description", tab1.getDescription());
assertEquals(null, tab2.getDescription());
assertEquals(3, tabSheet.getComponentCount());
@@ -226,7 +227,7 @@ public class TabSheetTest {
assertNull(tabSheet.getTab(lbl1));
assertNull(tab1.getComponent());
assertNotNull(tabSheet.getTab(lbl3));
- Assert.assertFalse(tabSheet.getTab(lbl3).isEnabled());
+ assertFalse(tabSheet.getTab(lbl3).isEnabled());
assertEquals("description", tab1.getDescription());
assertEquals(1, tabSheet.getTabPosition(tabSheet.getTab(lbl3)));
}
@@ -322,18 +323,18 @@ public class TabSheetTest {
});
tabsheet.setSelectedTab(b2);
- Assert.assertFalse(userOriginated.get());
- Assert.assertEquals(b2, selected.get());
+ assertFalse(userOriginated.get());
+ assertEquals(b2, selected.get());
TabsheetServerRpc rpc = ComponentTest.getRpcProxy(tabsheet,
TabsheetServerRpc.class);
rpc.setSelected(tabsheet.getKey(b1));
- Assert.assertTrue(userOriginated.get());
- Assert.assertEquals(b1, selected.get());
+ assertTrue(userOriginated.get());
+ assertEquals(b1, selected.get());
tabsheet.setSelectedTab(tabsheet.getTab(b4));
- Assert.assertFalse(userOriginated.get());
- Assert.assertEquals(b4, selected.get());
+ assertFalse(userOriginated.get());
+ assertEquals(b4, selected.get());
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/textarea/TextAreaDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/textarea/TextAreaDeclarativeTest.java
index ad8d88e9c5..2c830279e9 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/textarea/TextAreaDeclarativeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/textarea/TextAreaDeclarativeTest.java
@@ -68,7 +68,7 @@ public class TextAreaDeclarativeTest
public void testHtmlEntities() throws IOException {
String design = "<vaadin-text-area>&amp; Test</vaadin-text-area>";
TextArea read = read(design);
- Assert.assertEquals("& Test", read.getValue());
+ assertEquals("& Test", read.getValue());
read.setValue("&amp; Test");
@@ -76,7 +76,7 @@ public class TextAreaDeclarativeTest
Element root = new Element(Tag.valueOf("vaadin-text-area"), "");
read.writeDesign(root, dc);
- Assert.assertEquals("&amp;amp; Test", root.html());
+ assertEquals("&amp;amp; Test", root.html());
}
@Test
diff --git a/server/src/test/java/com/vaadin/tests/server/component/tree/TreeDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/tree/TreeDeclarativeTest.java
index a8f7741f1b..b2c0c8ae21 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/tree/TreeDeclarativeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/tree/TreeDeclarativeTest.java
@@ -1,6 +1,7 @@
package com.vaadin.tests.server.component.tree;
-import org.junit.Assert;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import com.vaadin.data.TreeData;
@@ -32,28 +33,26 @@ public class TreeDeclarativeTest
Tree<Person> tree = new Tree<>();
tree.setTreeData(data);
tree.setItemCaptionGenerator(item -> item.getFirstName());
-
- String designString = String.format("<%s>"
- + "<node item='%s'>%s</node>"
- + "<node item='%s' parent='%s'>%s</node>"
- + "<node item='%s' parent='%s'>%s</node>"
- + "<node item='%s' parent='%s'>%s</node>"
- + "<node item='%s'>%s</node>"
- + "</%s>", getComponentTag(),
- person1.toString(), person1.getFirstName(),
+
+ String designString = String.format(
+ "<%s>" + "<node item='%s'>%s</node>"
+ + "<node item='%s' parent='%s'>%s</node>"
+ + "<node item='%s' parent='%s'>%s</node>"
+ + "<node item='%s' parent='%s'>%s</node>"
+ + "<node item='%s'>%s</node>" + "</%s>",
+ getComponentTag(), person1.toString(), person1.getFirstName(),
person2.toString(), person1.toString(), person2.getFirstName(),
person3.toString(), person1.toString(), person3.getFirstName(),
person4.toString(), person3.toString(), person4.getFirstName(),
- person5.toString(), person5.getFirstName(),
- getComponentTag());
+ person5.toString(), person5.getFirstName(), getComponentTag());
testWrite(designString, tree, true);
Tree<String> readTree = testRead(designString, tree);
- Assert.assertEquals(2, readTree.getDataProvider()
+ assertEquals(2, readTree.getDataProvider()
.getChildCount(new HierarchicalQuery<>(null, null)));
- Assert.assertEquals(2, readTree.getDataProvider().getChildCount(
+ assertEquals(2, readTree.getDataProvider().getChildCount(
new HierarchicalQuery<>(null, person1.toString())));
- Assert.assertEquals(1, readTree.getDataProvider().getChildCount(
+ assertEquals(1, readTree.getDataProvider().getChildCount(
new HierarchicalQuery<>(null, person3.toString())));
}
@@ -154,11 +153,11 @@ public class TreeDeclarativeTest
@Override
protected void assertEquals(String message, Object o1, Object o2) {
if (o1 instanceof ItemCaptionGenerator) {
- Assert.assertTrue(o2 instanceof ItemCaptionGenerator);
+ assertTrue(o2 instanceof ItemCaptionGenerator);
return;
}
if (o1 instanceof IconGenerator) {
- Assert.assertTrue(o2 instanceof IconGenerator);
+ assertTrue(o2 instanceof IconGenerator);
return;
}
super.assertEquals(message, o1, o2);
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 a13ba357ef..5905d8d767 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
@@ -68,13 +68,13 @@ public class TreeGridDeclarativeTest
person7.getLastName(), getComponentTag());
TreeGrid<String> readGrid = testRead(design, grid);
- Assert.assertEquals(3, readGrid.getDataProvider()
+ assertEquals(3, readGrid.getDataProvider()
.size(new HierarchicalQuery<>(null, null)));
- Assert.assertEquals(2, readGrid.getDataProvider()
+ assertEquals(2, readGrid.getDataProvider()
.size(new HierarchicalQuery<>(null, person1.toString())));
- Assert.assertEquals(1, readGrid.getDataProvider()
+ assertEquals(1, readGrid.getDataProvider()
.size(new HierarchicalQuery<>(null, person5.toString())));
- Assert.assertEquals(1, readGrid.getDataProvider()
+ assertEquals(1, readGrid.getDataProvider()
.size(new HierarchicalQuery<>(null, person6.toString())));
testWrite(design, grid, true);
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/upload/UploadDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/upload/UploadDeclarativeTest.java
index 22695f3918..d43491f00c 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/upload/UploadDeclarativeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/upload/UploadDeclarativeTest.java
@@ -15,7 +15,9 @@
*/
package com.vaadin.tests.server.component.upload;
-import org.junit.Assert;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import com.vaadin.tests.design.DeclarativeTestBase;
@@ -62,12 +64,11 @@ public class UploadDeclarativeTest extends DeclarativeTestBase<Upload> {
@Test
public void testImmediateModeDefault() {
- Assert.assertTrue(
- testRead("<v-upload />", new Upload()).isImmediateMode());
+ assertTrue(testRead("<v-upload />", new Upload()).isImmediateMode());
Upload upload = new Upload();
upload.setImmediateMode(false);
- Assert.assertFalse(testRead("<v-upload immediate-mode=false />", upload)
+ assertFalse(testRead("<v-upload immediate-mode=false />", upload)
.isImmediateMode());
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/upload/UploadTest.java b/server/src/test/java/com/vaadin/tests/server/component/upload/UploadTest.java
index a2364b132d..a453769c66 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/upload/UploadTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/upload/UploadTest.java
@@ -15,7 +15,10 @@
*/
package com.vaadin.tests.server.component.upload;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import com.vaadin.server.StreamVariable;
@@ -38,14 +41,14 @@ public class UploadTest {
variable.streamingFailed(new TestStreamingErrorEvent());
} catch (Exception e) {
}
- Assert.assertFalse(upload.isUploading());
+ assertFalse(upload.isUploading());
}
@Test
public void setImmediateMode_defaultTrue() {
Upload upload = new Upload();
- Assert.assertTrue("Upload should be in immediate mode by default",
+ assertTrue("Upload should be in immediate mode by default",
upload.isImmediateMode());
}
@@ -53,7 +56,7 @@ public class UploadTest {
public void getState_uploadHasCustomState() {
TestUpload upload = new TestUpload();
UploadState state = upload.getState();
- Assert.assertEquals("Unexpected state class", UploadState.class,
+ assertEquals("Unexpected state class", UploadState.class,
state.getClass());
}
@@ -61,14 +64,14 @@ public class UploadTest {
public void getPrimaryStyleName_uploadHasCustomPrimaryStyleName() {
Upload upload = new Upload();
UploadState state = new UploadState();
- Assert.assertEquals("Unexpected primary style name",
- state.primaryStyleName, upload.getPrimaryStyleName());
+ assertEquals("Unexpected primary style name", state.primaryStyleName,
+ upload.getPrimaryStyleName());
}
@Test
public void uploadStateHasCustomPrimaryStyleName() {
UploadState state = new UploadState();
- Assert.assertEquals("Unexpected primary style name", "v-upload",
+ assertEquals("Unexpected primary style name", "v-upload",
state.primaryStyleName);
}
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 8416a216c1..cd7570e7b6 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
@@ -226,7 +226,7 @@ public class AttachDetachWindowTest {
eventFired[0] = event.getAttachedComponent().equals(window);
});
ui.addWindow(window);
- Assert.assertTrue("Attach event is not fired for added window",
+ assertTrue("Attach event is not fired for added window",
eventFired[0]);
}
@@ -242,7 +242,7 @@ public class AttachDetachWindowTest {
ui.addWindow(window);
ui.removeWindow(window);
- Assert.assertTrue("Detach event is not fired for removed window",
+ assertTrue("Detach event is not fired for removed window",
eventFired[0]);
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/window/WindowDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/window/WindowDeclarativeTest.java
index ab4ef3b40f..a832ce6341 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/window/WindowDeclarativeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/window/WindowDeclarativeTest.java
@@ -15,7 +15,8 @@
*/
package com.vaadin.tests.server.component.window;
-import org.junit.Assert;
+import static org.junit.Assert.fail;
+
import org.junit.Test;
import com.vaadin.event.ShortcutAction.KeyCode;
@@ -134,7 +135,7 @@ public class WindowDeclarativeTest extends DeclarativeTestBase<Window> {
protected void assertInvalidPosition(String position) {
try {
read("<vaadin-window position='" + position + "'>");
- Assert.fail("Invalid position '" + position + "' should throw");
+ fail("Invalid position '" + position + "' should throw");
} catch (Exception e) {
// expected
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/window/WindowTest.java b/server/src/test/java/com/vaadin/tests/server/component/window/WindowTest.java
index d743c4f009..aedcfbc5f0 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/window/WindowTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/window/WindowTest.java
@@ -15,7 +15,8 @@
*/
package com.vaadin.tests.server.component.window;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Before;
import org.junit.Test;
@@ -38,23 +39,23 @@ public class WindowTest {
Button b2 = new Button("button 2");
window.setAssistiveDescription(l1, b2);
- Assert.assertEquals(2, window.getAssistiveDescription().length);
- Assert.assertEquals(l1, window.getAssistiveDescription()[0]);
- Assert.assertEquals(b2, window.getAssistiveDescription()[1]);
+ assertEquals(2, window.getAssistiveDescription().length);
+ assertEquals(l1, window.getAssistiveDescription()[0]);
+ assertEquals(b2, window.getAssistiveDescription()[1]);
// Modifying return value must not change actual value
window.getAssistiveDescription()[0] = null;
- Assert.assertEquals(2, window.getAssistiveDescription().length);
- Assert.assertEquals(l1, window.getAssistiveDescription()[0]);
- Assert.assertEquals(b2, window.getAssistiveDescription()[1]);
+ assertEquals(2, window.getAssistiveDescription().length);
+ assertEquals(l1, window.getAssistiveDescription()[0]);
+ assertEquals(b2, window.getAssistiveDescription()[1]);
}
@Test
public void testSetPosition() {
window.setPosition(100, 200);
- Assert.assertEquals(100, window.getPositionX());
- Assert.assertEquals(200, window.getPositionY());
+ assertEquals(100, window.getPositionX());
+ assertEquals(200, window.getPositionY());
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/componentcontainer/AddRemoveComponentTest.java b/server/src/test/java/com/vaadin/tests/server/componentcontainer/AddRemoveComponentTest.java
index e5537992c0..89c95ffeb8 100644
--- a/server/src/test/java/com/vaadin/tests/server/componentcontainer/AddRemoveComponentTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/componentcontainer/AddRemoveComponentTest.java
@@ -1,11 +1,13 @@
package com.vaadin.tests.server.componentcontainer;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.util.List;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.tests.VaadinClasses;
@@ -23,7 +25,7 @@ public class AddRemoveComponentTest {
List<Class<? extends ComponentContainer>> containerClasses = VaadinClasses
.getComponentContainersSupportingAddRemoveComponent();
- Assert.assertTrue(containerClasses.size() > 0);
+ assertTrue(containerClasses.size() > 0);
// No default constructor, special case
containerClasses.remove(CustomLayout.class);
@@ -52,7 +54,7 @@ public class AddRemoveComponentTest {
hl.addComponent(label);
componentContainer.removeComponent(label);
- Assert.assertEquals(
+ assertEquals(
"Parent no longer correct for " + componentContainer.getClass(),
hl, label.getParent());
}
diff --git a/server/src/test/java/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java b/server/src/test/java/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java
index 53bb87717f..10dc79da5b 100644
--- a/server/src/test/java/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java
@@ -1,5 +1,6 @@
package com.vaadin.tests.server.componentcontainer;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.fail;
@@ -7,7 +8,6 @@ import static org.junit.Assert.fail;
import java.util.Iterator;
import java.util.NoSuchElementException;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.shared.ui.orderedlayout.FormLayoutState;
@@ -43,8 +43,8 @@ public class FormLayoutTest extends AbstractIndexedLayoutTestBase {
return getLayout().getComponentCount();
}
- 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() {
@@ -63,7 +63,7 @@ public class FormLayoutTest extends AbstractIndexedLayoutTestBase {
public void getState_formLayoutHasCustomState() {
TestFormLayout layout = new TestFormLayout();
FormLayoutState state = layout.getState();
- Assert.assertEquals("Unexpected state class", FormLayoutState.class,
+ assertEquals("Unexpected state class", FormLayoutState.class,
state.getClass());
}
@@ -71,14 +71,14 @@ public class FormLayoutTest extends AbstractIndexedLayoutTestBase {
public void getPrimaryStyleName_formLayoutHasCustomPrimaryStyleName() {
FormLayout layout = new FormLayout();
FormLayoutState state = new FormLayoutState();
- Assert.assertEquals("Unexpected primary style name",
- state.primaryStyleName, layout.getPrimaryStyleName());
+ assertEquals("Unexpected primary style name", state.primaryStyleName,
+ layout.getPrimaryStyleName());
}
@Test
public void formLayoutStateHasCustomPrimaryStyleName() {
FormLayoutState state = new FormLayoutState();
- Assert.assertEquals("Unexpected primary style name", "v-formlayout",
+ assertEquals("Unexpected primary style name", "v-formlayout",
state.primaryStyleName);
}
diff --git a/server/src/test/java/com/vaadin/tests/server/componentcontainer/HorizontalLayoutTest.java b/server/src/test/java/com/vaadin/tests/server/componentcontainer/HorizontalLayoutTest.java
index 12f235011e..ec5784e7c4 100644
--- a/server/src/test/java/com/vaadin/tests/server/componentcontainer/HorizontalLayoutTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/componentcontainer/HorizontalLayoutTest.java
@@ -1,6 +1,8 @@
package com.vaadin.tests.server.componentcontainer;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
import org.junit.Test;
import com.vaadin.ui.Button;
@@ -46,30 +48,30 @@ public class HorizontalLayoutTest extends AbstractIndexedLayoutTestBase {
layout.addComponentsAndExpand(b1, b2);
- Assert.assertEquals(3, layout.getComponentCount());
+ assertEquals(3, layout.getComponentCount());
- Assert.assertSame(b3, layout.getComponent(0));
- Assert.assertSame(b1, layout.getComponent(1));
- Assert.assertSame(b2, layout.getComponent(2));
+ assertSame(b3, layout.getComponent(0));
+ assertSame(b1, layout.getComponent(1));
+ assertSame(b2, layout.getComponent(2));
- Assert.assertEquals(0, layout.getExpandRatio(b3), 0);
- Assert.assertEquals(1, layout.getExpandRatio(b1), 0);
- Assert.assertEquals(1, layout.getExpandRatio(b2), 0);
+ assertEquals(0, layout.getExpandRatio(b3), 0);
+ assertEquals(1, layout.getExpandRatio(b1), 0);
+ assertEquals(1, layout.getExpandRatio(b2), 0);
- Assert.assertEquals(-1, b3.getWidth(), 0);
- Assert.assertEquals(100, b1.getWidth(), 0);
- Assert.assertEquals(100, b2.getWidth(), 0);
+ assertEquals(-1, b3.getWidth(), 0);
+ assertEquals(100, b1.getWidth(), 0);
+ assertEquals(100, b2.getWidth(), 0);
}
@Test
public void addAndExpand_undefinedHeightUpdated() {
HorizontalLayout layout = getLayout();
- Assert.assertEquals(-1, layout.getWidth(), 0);
+ assertEquals(-1, layout.getWidth(), 0);
layout.addComponentsAndExpand();
- Assert.assertEquals(100, layout.getWidth(), 0);
+ assertEquals(100, layout.getWidth(), 0);
}
@Test
@@ -80,7 +82,7 @@ public class HorizontalLayoutTest extends AbstractIndexedLayoutTestBase {
layout.addComponentsAndExpand();
- Assert.assertEquals(150, layout.getWidth(), 0);
+ assertEquals(150, layout.getWidth(), 0);
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/componentcontainer/VerticalLayoutTest.java b/server/src/test/java/com/vaadin/tests/server/componentcontainer/VerticalLayoutTest.java
index 2bb5d3a433..037b97c5a1 100644
--- a/server/src/test/java/com/vaadin/tests/server/componentcontainer/VerticalLayoutTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/componentcontainer/VerticalLayoutTest.java
@@ -1,6 +1,8 @@
package com.vaadin.tests.server.componentcontainer;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
import org.junit.Test;
import com.vaadin.ui.Button;
@@ -46,30 +48,30 @@ public class VerticalLayoutTest extends AbstractIndexedLayoutTestBase {
layout.addComponentsAndExpand(b1, b2);
- Assert.assertEquals(3, layout.getComponentCount());
+ assertEquals(3, layout.getComponentCount());
- Assert.assertSame(b3, layout.getComponent(0));
- Assert.assertSame(b1, layout.getComponent(1));
- Assert.assertSame(b2, layout.getComponent(2));
+ assertSame(b3, layout.getComponent(0));
+ assertSame(b1, layout.getComponent(1));
+ assertSame(b2, layout.getComponent(2));
- Assert.assertEquals(0, layout.getExpandRatio(b3), 0);
- Assert.assertEquals(1, layout.getExpandRatio(b1), 0);
- Assert.assertEquals(1, layout.getExpandRatio(b2), 0);
+ assertEquals(0, layout.getExpandRatio(b3), 0);
+ assertEquals(1, layout.getExpandRatio(b1), 0);
+ assertEquals(1, layout.getExpandRatio(b2), 0);
- Assert.assertEquals(-1, b3.getHeight(), 0);
- Assert.assertEquals(100, b1.getHeight(), 0);
- Assert.assertEquals(100, b2.getHeight(), 0);
+ assertEquals(-1, b3.getHeight(), 0);
+ assertEquals(100, b1.getHeight(), 0);
+ assertEquals(100, b2.getHeight(), 0);
}
@Test
public void addAndExpand_undefinedHeightUpdated() {
VerticalLayout layout = getLayout();
- Assert.assertEquals(-1, layout.getHeight(), 0);
+ assertEquals(-1, layout.getHeight(), 0);
layout.addComponentsAndExpand();
- Assert.assertEquals(100, layout.getHeight(), 0);
+ assertEquals(100, layout.getHeight(), 0);
}
@Test
@@ -80,7 +82,7 @@ public class VerticalLayoutTest extends AbstractIndexedLayoutTestBase {
layout.addComponentsAndExpand();
- Assert.assertEquals(150, layout.getHeight(), 0);
+ assertEquals(150, layout.getHeight(), 0);
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java b/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java
index 019c13698d..2a756da1cb 100644
--- a/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java
@@ -17,9 +17,11 @@
package com.vaadin.tests.server.navigator;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.LinkedList;
@@ -31,7 +33,6 @@ import java.util.concurrent.atomic.AtomicReference;
import org.easymock.EasyMock;
import org.easymock.IArgumentMatcher;
import org.easymock.IMocksControl;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.navigator.NavigationStateManager;
@@ -370,24 +371,23 @@ public class NavigatorTest {
TestNavigatorWithFragments navigator = new TestNavigatorWithFragments(
ui);
- Assert.assertTrue("Add URI fragment Page method has not been called",
+ assertTrue("Add URI fragment Page method has not been called",
page.addUriFragmentCalled());
- Assert.assertFalse("Unexpected remove URI fragment Page method call",
+ assertFalse("Unexpected remove URI fragment Page method call",
page.removeUriFragmentCalled());
- Assert.assertNotNull("Navigator is null in UI", ui.getNavigator());
+ assertNotNull("Navigator is null in UI", ui.getNavigator());
navigator.destroy();
- Assert.assertTrue(
+ assertTrue(
"Remove URI fragment Page method has not been called after destroy",
page.removeUriFragmentCalled());
- Assert.assertNull("Navigator is not null in UI after destroy",
+ assertNull("Navigator is not null in UI after destroy",
ui.getNavigator());
try {
page.setUriFragment("foobar", true); // This should throw
- Assert.fail(
- "Expected null pointer exception after call uriFragmentChanged "
- + "for destroyed navigator");
+ fail("Expected null pointer exception after call uriFragmentChanged "
+ + "for destroyed navigator");
} catch (NullPointerException e) {
// All ok.
}
@@ -399,25 +399,24 @@ public class NavigatorTest {
UI ui = new TestPushStateUI(page);
TestNavigator navigator = new TestNavigator(ui);
- Assert.assertTrue("Add URI fragment Page method has not been called",
+ assertTrue("Add URI fragment Page method has not been called",
page.addPopstateCalled());
- Assert.assertFalse("Unexpected remove URI fragment Page method call",
+ assertFalse("Unexpected remove URI fragment Page method call",
page.removePopstateCalled());
- Assert.assertNotNull("Navigator is null in UI", ui.getNavigator());
+ assertNotNull("Navigator is null in UI", ui.getNavigator());
navigator.destroy();
- Assert.assertTrue(
+ assertTrue(
"Remove URI fragment Page method has not been called after destroy",
page.removePopstateCalled());
- Assert.assertNull("Navigator is not null in UI after destroy",
+ assertNull("Navigator is not null in UI after destroy",
ui.getNavigator());
try {
page.updateLocation("http://server/path/info", true, true);
- Assert.fail(
- "Expected null pointer exception after call uriFragmentChanged "
- + "for destroyed navigator");
+ fail("Expected null pointer exception after call uriFragmentChanged "
+ + "for destroyed navigator");
} catch (NullPointerException e) {
// All ok.
}
@@ -531,12 +530,12 @@ public class NavigatorTest {
navigator.addProvider(provider);
navigator.navigateTo("test2");
- Assert.assertEquals("", view2.getParams());
- Assert.assertEquals(null, view1.getParams());
+ assertEquals("", view2.getParams());
+ assertEquals(null, view1.getParams());
navigator.navigateTo("");
- Assert.assertEquals("", view1.getParams());
+ assertEquals("", view1.getParams());
navigator.navigateTo("test1/params");
- Assert.assertEquals("params", view1.getParams());
+ assertEquals("params", view1.getParams());
}
@Test
@@ -1005,11 +1004,11 @@ public class NavigatorTest {
// First time navigation
navigator.navigateTo(viewName);
- Assert.assertEquals(1, count[0]);
+ assertEquals(1, count[0]);
// Second time navigation to the same view
navigator.navigateTo(viewName);
- Assert.assertEquals(1, count[0]);
+ assertEquals(1, count[0]);
}
public static class ViewIsNotAComponent implements View {
@@ -1065,8 +1064,8 @@ public class NavigatorTest {
navigator.addView("foo", ViewIsNotAComponent.class);
navigator.navigateTo("foo");
- Assert.assertEquals(HorizontalLayout.class, ui.getContent().getClass());
- Assert.assertEquals("Hello",
+ assertEquals(HorizontalLayout.class, ui.getContent().getClass());
+ assertEquals("Hello",
((Label) ((HorizontalLayout) ui.getContent()).getComponent(0))
.getValue());
}
@@ -1074,14 +1073,14 @@ public class NavigatorTest {
@Test
public void parameterMap_noViewSeparator() {
Navigator navigator = createNavigatorWithState("fooview");
- Assert.assertTrue(navigator.getStateParameterMap().isEmpty());
- Assert.assertTrue(navigator.getStateParameterMap("foo").isEmpty());
+ assertTrue(navigator.getStateParameterMap().isEmpty());
+ assertTrue(navigator.getStateParameterMap("foo").isEmpty());
}
@Test
public void parameterMap_noParameters() {
Navigator navigator = createNavigatorWithState("fooview/");
- Assert.assertTrue(navigator.getStateParameterMap().isEmpty());
+ assertTrue(navigator.getStateParameterMap().isEmpty());
}
@Test
@@ -1119,12 +1118,12 @@ public class NavigatorTest {
@SafeVarargs
private final void assertMap(Map<String, String> map,
Entry<String, String>... entries) {
- Assert.assertEquals(entries.length, map.size());
+ assertEquals(entries.length, map.size());
for (Entry<String, String> entry : entries) {
- Assert.assertTrue(
+ assertTrue(
"Map should contain a key called '" + entry.getKey() + "'",
map.containsKey(entry.getKey()));
- Assert.assertEquals(entry.getValue(), map.get(entry.getKey()));
+ assertEquals(entry.getValue(), map.get(entry.getKey()));
}
}
@@ -1179,8 +1178,8 @@ public class NavigatorTest {
navigator.navigateTo("view1");
- Assert.assertTrue(mapRef.get().isEmpty());
- Assert.assertTrue(mapRefB.get().isEmpty());
+ assertTrue(mapRef.get().isEmpty());
+ assertTrue(mapRefB.get().isEmpty());
navigator.navigateTo("view1/a&b=c&d");
assertMap(mapRef.get(), entry("a", ""), entry("b", "c"),
@@ -1208,7 +1207,7 @@ public class NavigatorTest {
navigator.addView("view2", view2);
navigator.navigateTo("view1");
navigator.navigateTo("view2");
- Assert.assertEquals("view1", navigator.getState());
+ assertEquals("view1", navigator.getState());
}
@Test
@@ -1231,7 +1230,7 @@ public class NavigatorTest {
navigator.addView("view2", view2);
navigator.navigateTo("view1");
navigator.navigateTo("view2");
- Assert.assertEquals("view2", navigator.getState());
+ assertEquals("view2", navigator.getState());
}
@@ -1256,9 +1255,9 @@ public class NavigatorTest {
navigator.addView("view2", view2);
navigator.navigateTo("view1");
navigator.navigateTo("view2");
- Assert.assertEquals("view1", navigator.getState());
+ assertEquals("view1", navigator.getState());
eventRef.get().navigate();
- Assert.assertEquals("view2", navigator.getState());
+ assertEquals("view2", navigator.getState());
}
@@ -1287,9 +1286,9 @@ public class NavigatorTest {
navigator.runAfterLeaveConfirmation(() -> {
leaveCount.incrementAndGet();
});
- Assert.assertEquals(0, leaveCount.get());
+ assertEquals(0, leaveCount.get());
eventRef.get().navigate();
- Assert.assertEquals(1, leaveCount.get());
- Assert.assertEquals("view1", navigator.getState());
+ assertEquals(1, leaveCount.get());
+ assertEquals("view1", navigator.getState());
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java b/server/src/test/java/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java
index 230f2f2a65..66742dd7a1 100644
--- a/server/src/test/java/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java
@@ -16,9 +16,12 @@
package com.vaadin.tests.server.navigator;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.easymock.EasyMock;
import org.easymock.IMocksControl;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.navigator.Navigator;
@@ -40,10 +43,9 @@ public class UriFragmentManagerTest {
EasyMock.replay(page);
// test manager using the mock
- Assert.assertEquals("Incorrect fragment value", "", manager.getState());
+ assertEquals("Incorrect fragment value", "", manager.getState());
manager.setState("test");
- Assert.assertEquals("Incorrect fragment value", "test",
- manager.getState());
+ assertEquals("Incorrect fragment value", "test", manager.getState());
}
@Test
@@ -71,10 +73,10 @@ public class UriFragmentManagerTest {
UriFragmentManager manager = new UriFragmentManager(page);
manager.setNavigator(EasyMock.createMock(Navigator.class));
- Assert.assertTrue(
+ assertTrue(
"addUriFragmentChangedListener() method is not called for the Page",
page.addUriFragmentCalled());
- Assert.assertFalse(
+ assertFalse(
"removeUriFragmentChangedListener() method is called for the Page",
page.removeUriFragmentCalled());
}
@@ -87,7 +89,7 @@ public class UriFragmentManagerTest {
manager.setNavigator(EasyMock.createMock(Navigator.class));
manager.setNavigator(null);
- Assert.assertTrue(
+ assertTrue(
"removeUriFragmentChangedListener() method is not called for the Page",
page.removeUriFragmentCalled());
}
diff --git a/server/src/test/java/com/vaadin/tests/util/TestUtil.java b/server/src/test/java/com/vaadin/tests/util/TestUtil.java
index eb5bd5e525..e98d6c07ab 100644
--- a/server/src/test/java/com/vaadin/tests/util/TestUtil.java
+++ b/server/src/test/java/com/vaadin/tests/util/TestUtil.java
@@ -1,13 +1,14 @@
package com.vaadin.tests.util;
-import java.util.Iterator;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
-import org.junit.Assert;
+import java.util.Iterator;
public class TestUtil {
public static void assertArrays(Object[] actualObjects,
Object[] expectedObjects) {
- Assert.assertEquals(
+ assertEquals(
"Actual contains a different number of values than was expected",
expectedObjects.length, actualObjects.length);
@@ -15,8 +16,7 @@ public class TestUtil {
Object actual = actualObjects[i];
Object expected = expectedObjects[i];
- Assert.assertEquals("Item[" + i + "] does not match", expected,
- actual);
+ assertEquals("Item[" + i + "] does not match", expected, actual);
}
}
@@ -29,18 +29,15 @@ public class TestUtil {
while (i1.hasNext()) {
Object o1 = i1.next();
if (!i2.hasNext()) {
- Assert.fail(
- "The second iterable contains fewer items than the first. The object "
- + o1 + " has no match in the second iterable.");
+ fail("The second iterable contains fewer items than the first. The object "
+ + o1 + " has no match in the second iterable.");
}
Object o2 = i2.next();
- Assert.assertEquals(o1, o2);
+ assertEquals(o1, o2);
}
if (i2.hasNext()) {
- Assert.fail(
- "The second iterable contains more items than the first. The object "
- + i2.next()
- + " has no match in the first iterable.");
+ fail("The second iterable contains more items than the first. The object "
+ + i2.next() + " has no match in the first iterable.");
}
}
diff --git a/server/src/test/java/com/vaadin/ui/AbstractListingTest.java b/server/src/test/java/com/vaadin/ui/AbstractListingTest.java
index deafe8368e..86f6929d38 100644
--- a/server/src/test/java/com/vaadin/ui/AbstractListingTest.java
+++ b/server/src/test/java/com/vaadin/ui/AbstractListingTest.java
@@ -1,5 +1,9 @@
package com.vaadin.ui;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
@@ -7,7 +11,6 @@ import java.util.List;
import java.util.stream.Stream;
import org.jsoup.nodes.Element;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -73,8 +76,7 @@ public class AbstractListingTest {
}
}
- private static final String[] ITEM_ARRAY = { "Foo", "Bar",
- "Baz" };
+ private static final String[] ITEM_ARRAY = { "Foo", "Bar", "Baz" };
private TestListing listing;
private List<String> items;
@@ -89,20 +91,20 @@ public class AbstractListingTest {
public void testSetItemsWithCollection() {
listing.setItems(items);
List<String> list = new LinkedList<>(items);
- listing.getDataProvider().fetch(new Query()).forEach(
- str -> Assert.assertTrue("Unexpected item in data provider",
+ listing.getDataProvider().fetch(new Query())
+ .forEach(str -> assertTrue("Unexpected item in data provider",
list.remove(str)));
- Assert.assertTrue("Not all items from list were in data provider",
+ assertTrue("Not all items from list were in data provider",
list.isEmpty());
}
@Test
public void testSetItemsWithVarargs() {
listing.setItems(ITEM_ARRAY);
- listing.getDataProvider().fetch(new Query()).forEach(
- str -> Assert.assertTrue("Unexpected item in data provider",
+ listing.getDataProvider().fetch(new Query())
+ .forEach(str -> assertTrue("Unexpected item in data provider",
items.remove(str)));
- Assert.assertTrue("Not all items from list were in data provider",
+ assertTrue("Not all items from list were in data provider",
items.isEmpty());
}
@@ -111,14 +113,14 @@ public class AbstractListingTest {
ListDataProvider<String> dataProvider = DataProvider
.ofCollection(items);
listing.setDataProvider(dataProvider);
- Assert.assertEquals("setDataProvider did not set data provider",
- dataProvider, listing.getDataProvider());
+ assertEquals("setDataProvider did not set data provider", dataProvider,
+ listing.getDataProvider());
listing.setDataProvider(
DataProvider.fromCallbacks(
query -> Stream.of(ITEM_ARRAY).skip(query.getOffset())
.limit(query.getLimit()),
query -> ITEM_ARRAY.length));
- Assert.assertNotEquals("setDataProvider did not replace data provider",
+ assertNotEquals("setDataProvider did not replace data provider",
dataProvider, listing.getDataProvider());
}
@@ -128,7 +130,7 @@ public class AbstractListingTest {
generator.extend(listing);
listing.setItems("Foo");
listing.runDataGeneration();
- Assert.assertEquals("Generator should have been called once", 1,
+ assertEquals("Generator should have been called once", 1,
generator.callCount);
}
@@ -138,7 +140,7 @@ public class AbstractListingTest {
listing.setItems("Foo");
generator.extend(listing);
listing.runDataGeneration();
- Assert.assertEquals("Generator should have been called once", 1,
+ assertEquals("Generator should have been called once", 1,
generator.callCount);
}
@@ -148,10 +150,10 @@ public class AbstractListingTest {
CountGenerator generator = new CountGenerator();
generator.extend(listing);
listing.runDataGeneration();
- Assert.assertEquals("Generator should have been called once", 1,
+ assertEquals("Generator should have been called once", 1,
generator.callCount);
listing.runDataGeneration();
- Assert.assertEquals("Generator should not have been called again", 1,
+ assertEquals("Generator should not have been called again", 1,
generator.callCount);
}
@@ -162,7 +164,7 @@ public class AbstractListingTest {
generator.extend(listing);
generator.remove();
listing.runDataGeneration();
- Assert.assertEquals("Generator should not have been called", 0,
+ assertEquals("Generator should not have been called", 0,
generator.callCount);
}
@@ -172,11 +174,11 @@ public class AbstractListingTest {
CountGenerator generator = new CountGenerator();
generator.extend(listing);
listing.runDataGeneration();
- Assert.assertEquals("Generator should have been called once", 1,
+ assertEquals("Generator should have been called once", 1,
generator.callCount);
generator.refresh("Foo");
listing.runDataGeneration();
- Assert.assertEquals("Generator should have been called again", 2,
+ assertEquals("Generator should have been called again", 2,
generator.callCount);
}
}
diff --git a/server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java b/server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java
index 0dcef85579..6bbd314761 100644
--- a/server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java
+++ b/server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java
@@ -15,6 +15,12 @@
*/
package com.vaadin.ui;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -29,7 +35,6 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.After;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -124,7 +129,7 @@ public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String>> {
registration = selectToTest.addSelectionListener(event -> {
listenerCount.incrementAndGet();
- Assert.assertFalse(event.isUserOriginated());
+ assertFalse(event.isUserOriginated());
});
selectToTest.select("1");
@@ -136,23 +141,23 @@ public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String>> {
selectToTest.select("2", "3", "4");
selectToTest.deselect("1", "4");
- Assert.assertEquals(6, listenerCount.get());
+ assertEquals(6, listenerCount.get());
// select partly selected
selectToTest.select("2", "3", "4");
- Assert.assertEquals(7, listenerCount.get());
+ assertEquals(7, listenerCount.get());
// select completely selected
selectToTest.select("2", "3", "4");
- Assert.assertEquals(7, listenerCount.get());
+ assertEquals(7, listenerCount.get());
// deselect partly not selected
selectToTest.select("1", "4");
- Assert.assertEquals(8, listenerCount.get());
+ assertEquals(8, listenerCount.get());
// deselect completely not selected
selectToTest.select("1", "4");
- Assert.assertEquals(8, listenerCount.get());
+ assertEquals(8, listenerCount.get());
verifyValueChangeEvents();
}
@@ -162,7 +167,7 @@ public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String>> {
registration = selectToTest.addSelectionListener(event -> {
listenerCount.incrementAndGet();
- Assert.assertTrue(event.isUserOriginated());
+ assertTrue(event.isUserOriginated());
});
rpcSelect("1");
@@ -177,58 +182,58 @@ public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String>> {
rpcDeselectItems("1", "3");
assertSelectionOrder("6");
- Assert.assertEquals(5, listenerCount.get());
+ assertEquals(5, listenerCount.get());
// select partly selected
rpcSelect("2", "3", "4");
- Assert.assertEquals(6, listenerCount.get());
+ assertEquals(6, listenerCount.get());
assertSelectionOrder("6", "2", "3", "4");
// select completely selected
rpcSelect("2", "3", "4");
- Assert.assertEquals(6, listenerCount.get());
+ assertEquals(6, listenerCount.get());
assertSelectionOrder("6", "2", "3", "4");
// deselect partly not selected
rpcDeselectItems("1", "4");
- Assert.assertEquals(7, listenerCount.get());
+ assertEquals(7, listenerCount.get());
assertSelectionOrder("6", "2", "3");
// deselect completely not selected
rpcDeselectItems("1", "4");
- Assert.assertEquals(7, listenerCount.get());
+ assertEquals(7, listenerCount.get());
assertSelectionOrder("6", "2", "3");
// select completely selected and deselect completely not selected
rpcUpdateSelection(new String[] { "3" }, new String[] { "1", "4" });
- Assert.assertEquals(7, listenerCount.get());
+ assertEquals(7, listenerCount.get());
assertSelectionOrder("6", "2", "3");
// select partly selected and deselect completely not selected
rpcUpdateSelection(new String[] { "4", "2" },
new String[] { "1", "8" });
- Assert.assertEquals(8, listenerCount.get());
+ assertEquals(8, listenerCount.get());
assertSelectionOrder("6", "2", "3", "4");
// select completely selected and deselect partly not selected
rpcUpdateSelection(new String[] { "4", "3" },
new String[] { "1", "2" });
- Assert.assertEquals(9, listenerCount.get());
+ assertEquals(9, listenerCount.get());
assertSelectionOrder("6", "3", "4");
// duplicate case - ignored
rpcUpdateSelection(new String[] { "2" }, new String[] { "2" });
- Assert.assertEquals(9, listenerCount.get());
+ assertEquals(9, listenerCount.get());
assertSelectionOrder("6", "3", "4");
// duplicate case - duplicate removed
rpcUpdateSelection(new String[] { "2" }, new String[] { "2", "3" });
- Assert.assertEquals(10, listenerCount.get());
+ assertEquals(10, listenerCount.get());
assertSelectionOrder("6", "4");
// duplicate case - duplicate removed
rpcUpdateSelection(new String[] { "6", "8" }, new String[] { "6" });
- Assert.assertEquals(11, listenerCount.get());
+ assertEquals(11, listenerCount.get());
assertSelectionOrder("6", "4", "8");
verifyValueChangeEvents();
}
@@ -237,19 +242,18 @@ public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String>> {
public void getValue() {
selectToTest.select("1");
- Assert.assertEquals(Collections.singleton("1"),
- selectToTest.getValue());
+ assertEquals(Collections.singleton("1"), selectToTest.getValue());
selectToTest.deselectAll();
LinkedHashSet<String> set = new LinkedHashSet<>();
set.add("1");
set.add("5");
selectToTest.select(set.toArray(new String[2]));
- Assert.assertEquals(set, selectToTest.getValue());
+ assertEquals(set, selectToTest.getValue());
set.add("3");
selectToTest.select("3");
- Assert.assertEquals(set, selectToTest.getValue());
+ assertEquals(set, selectToTest.getValue());
verifyValueChangeEvents();
}
@@ -276,7 +280,7 @@ public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String>> {
}
};
- Assert.assertSame(set, select.getValue());
+ assertSame(set, select.getValue());
verifyValueChangeEvents();
}
@@ -284,7 +288,7 @@ public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String>> {
public void setValue() {
selectToTest.setValue(Collections.singleton("1"));
- Assert.assertEquals(Collections.singleton("1"),
+ assertEquals(Collections.singleton("1"),
selectToTest.getSelectedItems());
Set<String> set = new LinkedHashSet<>();
@@ -292,7 +296,7 @@ public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String>> {
set.add("3");
selectToTest.setValue(set);
- Assert.assertEquals(set, selectToTest.getSelectedItems());
+ assertEquals(set, selectToTest.getSelectedItems());
verifyValueChangeEvents();
}
@@ -352,18 +356,18 @@ public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String>> {
AtomicReference<ValueChangeEvent<?>> event = new AtomicReference<>();
Registration actualRegistration = select.addValueChangeListener(evt -> {
- Assert.assertNull(event.get());
+ assertNull(event.get());
event.set(evt);
});
- Assert.assertSame(registration, actualRegistration);
+ assertSame(registration, actualRegistration);
selectionListener.get().selectionChange(new MultiSelectionEvent<>(
select, Mockito.mock(Set.class), true));
- Assert.assertEquals(select, event.get().getComponent());
- Assert.assertEquals(set, event.get().getValue());
- Assert.assertTrue(event.get().isUserOriginated());
+ assertEquals(select, event.get().getComponent());
+ assertEquals(set, event.get().getValue());
+ assertTrue(event.get().isUserOriginated());
}
private void rpcSelect(String... keysToSelect) {
@@ -388,16 +392,16 @@ public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String>> {
}
private void assertSelectionOrder(String... selectionOrder) {
- Assert.assertEquals(Arrays.asList(selectionOrder),
+ assertEquals(Arrays.asList(selectionOrder),
new ArrayList<>(selectToTest.getSelectedItems()));
}
private void verifyValueChangeEvents() {
if (oldValues.size() > 0) {
- Assert.assertTrue(oldValues.get(0).isEmpty());
- Assert.assertEquals(values.size(), oldValues.size());
+ assertTrue(oldValues.get(0).isEmpty());
+ assertEquals(values.size(), oldValues.size());
for (int i = 0; i < oldValues.size() - 1; i++) {
- Assert.assertEquals(values.get(i), oldValues.get(i + 1));
+ assertEquals(values.get(i), oldValues.get(i + 1));
}
}
}
diff --git a/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java b/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java
index 5796f01cc5..d96793bf8e 100644
--- a/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java
+++ b/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java
@@ -17,6 +17,8 @@ package com.vaadin.ui;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
@@ -27,7 +29,6 @@ import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
import org.jsoup.nodes.Element;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
@@ -190,10 +191,10 @@ public class AbstractSingleSelectTest {
public void getValue() {
listing.setSelectedItem(PERSON_B);
- Assert.assertEquals(PERSON_B, listing.getValue());
+ assertEquals(PERSON_B, listing.getValue());
listing.setValue(null);
- Assert.assertNull(listing.getValue());
+ assertNull(listing.getValue());
verifyValueChanges();
}
@@ -205,22 +206,22 @@ public class AbstractSingleSelectTest {
Mockito.when(select.getSelectedItem()).thenReturn(selected);
Mockito.doCallRealMethod().when(select).getValue();
- Assert.assertSame(selected.get(), select.getValue());
+ assertSame(selected.get(), select.getValue());
selected = Optional.empty();
Mockito.when(select.getSelectedItem()).thenReturn(selected);
- Assert.assertNull(select.getValue());
+ assertNull(select.getValue());
}
@Test
public void setValue() {
listing.setValue(PERSON_C);
- Assert.assertEquals(PERSON_C, listing.getSelectedItem().get());
+ assertEquals(PERSON_C, listing.getSelectedItem().get());
listing.setValue(null);
- Assert.assertFalse(listing.getSelectedItem().isPresent());
+ assertFalse(listing.getSelectedItem().isPresent());
verifyValueChanges();
}
@@ -281,18 +282,18 @@ public class AbstractSingleSelectTest {
AtomicReference<ValueChangeEvent<?>> event = new AtomicReference<>();
Registration actualRegistration = select.addValueChangeListener(evt -> {
- Assert.assertNull(event.get());
+ assertNull(event.get());
event.set(evt);
});
- Assert.assertSame(registration, actualRegistration);
+ assertSame(registration, actualRegistration);
selectionListener.get().selectionChange(
new SingleSelectionEvent<>(select, value, true));
- Assert.assertEquals(select, event.get().getComponent());
- Assert.assertEquals(value, event.get().getOldValue());
- Assert.assertEquals(value, event.get().getValue());
- Assert.assertTrue(event.get().isUserOriginated());
+ assertEquals(select, event.get().getComponent());
+ assertEquals(value, event.get().getOldValue());
+ assertEquals(value, event.get().getValue());
+ assertTrue(event.get().isUserOriginated());
}
private void verifyValueChanges() {
diff --git a/server/src/test/java/com/vaadin/ui/CheckBoxTest.java b/server/src/test/java/com/vaadin/ui/CheckBoxTest.java
index 539d6fbf63..d2c280f12d 100644
--- a/server/src/test/java/com/vaadin/ui/CheckBoxTest.java
+++ b/server/src/test/java/com/vaadin/ui/CheckBoxTest.java
@@ -15,9 +15,11 @@
*/
package com.vaadin.ui;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.concurrent.atomic.AtomicBoolean;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.server.ServerRpcManager;
@@ -29,16 +31,16 @@ public class CheckBoxTest {
@Test
public void initiallyFalse() {
CheckBox cb = new CheckBox();
- Assert.assertFalse(cb.getValue());
+ assertFalse(cb.getValue());
}
@Test
public void testSetValue() {
CheckBox cb = new CheckBox();
cb.setValue(true);
- Assert.assertTrue(cb.getValue());
+ assertTrue(cb.getValue());
cb.setValue(false);
- Assert.assertFalse(cb.getValue());
+ assertFalse(cb.getValue());
}
@Test
@@ -53,12 +55,12 @@ public class CheckBoxTest {
ComponentTest.syncToClient(cb);
ServerRpcManager.getRpcProxy(cb, CheckBoxServerRpc.class)
.setChecked(true, new MouseEventDetails());
- Assert.assertTrue(userOriginated.get());
+ assertTrue(userOriginated.get());
userOriginated.set(false);
ComponentTest.syncToClient(cb);
ServerRpcManager.getRpcProxy(cb, CheckBoxServerRpc.class)
.setChecked(false, new MouseEventDetails());
- Assert.assertTrue(userOriginated.get());
+ assertTrue(userOriginated.get());
}
@Test
@@ -71,10 +73,10 @@ public class CheckBoxTest {
userOriginated.set(e.isUserOriginated());
});
cb.setValue(true);
- Assert.assertFalse(userOriginated.get());
+ assertFalse(userOriginated.get());
userOriginated.set(true);
cb.setValue(false);
- Assert.assertFalse(userOriginated.get());
+ assertFalse(userOriginated.get());
}
@Test(expected = NullPointerException.class)
diff --git a/server/src/test/java/com/vaadin/ui/ComponentTest.java b/server/src/test/java/com/vaadin/ui/ComponentTest.java
index 58a8829d5e..23e15e1bff 100644
--- a/server/src/test/java/com/vaadin/ui/ComponentTest.java
+++ b/server/src/test/java/com/vaadin/ui/ComponentTest.java
@@ -15,12 +15,12 @@
*/
package com.vaadin.ui;
+import static org.junit.Assert.assertEquals;
+
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashSet;
-import org.junit.Assert;
-
import com.vaadin.server.ClientConnector;
import com.vaadin.server.LegacyCommunicationManager;
import com.vaadin.server.ServerRpcManager;
@@ -111,8 +111,7 @@ public class ComponentTest {
JsonObject encodeState = connector.encodeState();
// Collect to HashSet so that order doesn't matter
- Assert.assertEquals(message,
- new HashSet<>(Arrays.asList(expectedProperties)),
+ assertEquals(message, new HashSet<>(Arrays.asList(expectedProperties)),
new HashSet<>(Arrays.asList(encodeState.keys())));
}
diff --git a/server/src/test/java/com/vaadin/ui/CustomFieldTest.java b/server/src/test/java/com/vaadin/ui/CustomFieldTest.java
index 94636dcdc0..e193809c1a 100644
--- a/server/src/test/java/com/vaadin/ui/CustomFieldTest.java
+++ b/server/src/test/java/com/vaadin/ui/CustomFieldTest.java
@@ -15,10 +15,14 @@
*/
package com.vaadin.ui;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.util.Iterator;
import java.util.NoSuchElementException;
-import org.junit.Assert;
import org.junit.Test;
public class CustomFieldTest {
@@ -54,10 +58,10 @@ public class CustomFieldTest {
// iterator() can't do it even though it should...
field.getContent();
Iterator<Component> iterator = field.iterator();
- Assert.assertNotNull(iterator);
- Assert.assertTrue(iterator.hasNext());
- Assert.assertEquals(field.button, iterator.next());
- Assert.assertFalse(iterator.hasNext());
+ assertNotNull(iterator);
+ assertTrue(iterator.hasNext());
+ assertEquals(field.button, iterator.next());
+ assertFalse(iterator.hasNext());
iterator.next();
}
}
diff --git a/server/src/test/java/com/vaadin/ui/DateFieldConstructorTest.java b/server/src/test/java/com/vaadin/ui/DateFieldConstructorTest.java
index 6fa83f14d0..7bd7aeda24 100644
--- a/server/src/test/java/com/vaadin/ui/DateFieldConstructorTest.java
+++ b/server/src/test/java/com/vaadin/ui/DateFieldConstructorTest.java
@@ -15,34 +15,37 @@
*/
package com.vaadin.ui;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
import java.time.LocalDate;
-import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import com.vaadin.data.HasValue;
import com.vaadin.shared.ui.datefield.DateResolution;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
public class DateFieldConstructorTest {
@Test
public void initiallyEmpty() {
DateField dateField = new DateField();
- Assert.assertTrue(dateField.isEmpty());
- Assert.assertEquals(DateResolution.DAY, dateField.getResolution());
+ assertTrue(dateField.isEmpty());
+ assertEquals(DateResolution.DAY, dateField.getResolution());
}
@Test
public void testValueConstructor_emptyAfterClear() {
DateField dateField = new DateField(null, LocalDate.now());
- Assert.assertEquals(DateResolution.DAY, dateField.getResolution());
- Assert.assertFalse(dateField.isEmpty());
+ assertEquals(DateResolution.DAY, dateField.getResolution());
+ assertFalse(dateField.isEmpty());
dateField.clear();
- Assert.assertTrue(dateField.isEmpty());
+ assertTrue(dateField.isEmpty());
}
@Test
@@ -50,7 +53,7 @@ public class DateFieldConstructorTest {
HasValue.ValueChangeListener valueChangeListener = Mockito
.mock(HasValue.ValueChangeListener.class);
DateField dateField = new DateField(valueChangeListener);
- Assert.assertEquals(DateResolution.DAY, dateField.getResolution());
+ assertEquals(DateResolution.DAY, dateField.getResolution());
dateField.setValue(LocalDate.now());
@@ -65,7 +68,7 @@ public class DateFieldConstructorTest {
.mock(HasValue.ValueChangeListener.class);
DateField dateField = new DateField("Caption", LocalDate.now(),
valueChangeListener);
- Assert.assertEquals(DateResolution.DAY, dateField.getResolution());
+ assertEquals(DateResolution.DAY, dateField.getResolution());
verify(valueChangeListener, never())
.valueChange(Mockito.any(HasValue.ValueChangeEvent.class));
diff --git a/server/src/test/java/com/vaadin/ui/DateFieldTestCase.java b/server/src/test/java/com/vaadin/ui/DateFieldTestCase.java
index e67d7bde13..f50141df66 100644
--- a/server/src/test/java/com/vaadin/ui/DateFieldTestCase.java
+++ b/server/src/test/java/com/vaadin/ui/DateFieldTestCase.java
@@ -3,10 +3,11 @@ package com.vaadin.ui;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsNull.nullValue;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import java.time.LocalDate;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -33,14 +34,14 @@ public class DateFieldTestCase {
public void rangeStartIsAcceptedAsValue() {
dateField.setRangeStart(date);
dateField.setValue(date);
- Assert.assertNull(dateField.getComponentError());
+ assertNull(dateField.getComponentError());
}
@Test
public void belowRangeStartIsNotAcceptedAsValue() {
dateField.setRangeStart(date);
dateField.setValue(date.minusDays(1));
- Assert.assertNotNull(dateField.getComponentError());
+ assertNotNull(dateField.getComponentError());
}
@Test
@@ -54,13 +55,13 @@ public class DateFieldTestCase {
public void rangeEndIsAcceptedAsValue() {
dateField.setRangeEnd(date);
dateField.setValue(date);
- Assert.assertNull(dateField.getComponentError());
+ assertNull(dateField.getComponentError());
}
@Test
public void aboveRangeEndIsNotAcceptedAsValue() {
dateField.setRangeEnd(date);
dateField.setValue(date.plusDays(1));
- Assert.assertNotNull(dateField.getComponentError());
+ assertNotNull(dateField.getComponentError());
}
}
diff --git a/server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java b/server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java
index 90a452942e..d4675556c3 100644
--- a/server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java
+++ b/server/src/test/java/com/vaadin/ui/DateTimeFieldConstructorTest.java
@@ -15,37 +15,38 @@
*/
package com.vaadin.ui;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
import java.time.LocalDateTime;
-import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import com.vaadin.data.HasValue;
import com.vaadin.shared.ui.datefield.DateTimeResolution;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
public class DateTimeFieldConstructorTest {
@Test
public void initiallyEmpty() {
DateTimeField dateTimeField = new DateTimeField();
- Assert.assertTrue(dateTimeField.isEmpty());
- Assert.assertEquals(DateTimeResolution.MINUTE,
- dateTimeField.getResolution());
+ assertTrue(dateTimeField.isEmpty());
+ assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution());
}
@Test
public void testValueConstructor_emptyAfterClear() {
DateTimeField dateTimeField = new DateTimeField(null,
LocalDateTime.now());
- Assert.assertFalse(dateTimeField.isEmpty());
- Assert.assertEquals(DateTimeResolution.MINUTE,
- dateTimeField.getResolution());
+ assertFalse(dateTimeField.isEmpty());
+ assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution());
dateTimeField.clear();
- Assert.assertTrue(dateTimeField.isEmpty());
+ assertTrue(dateTimeField.isEmpty());
}
@Test
@@ -53,8 +54,7 @@ public class DateTimeFieldConstructorTest {
HasValue.ValueChangeListener valueChangeListener = Mockito
.mock(HasValue.ValueChangeListener.class);
DateTimeField dateTimeField = new DateTimeField(valueChangeListener);
- Assert.assertEquals(DateTimeResolution.MINUTE,
- dateTimeField.getResolution());
+ assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution());
dateTimeField.setValue(LocalDateTime.now());
@@ -69,8 +69,7 @@ public class DateTimeFieldConstructorTest {
.mock(HasValue.ValueChangeListener.class);
DateTimeField dateTimeField = new DateTimeField("Caption",
LocalDateTime.now(), valueChangeListener);
- Assert.assertEquals(DateTimeResolution.MINUTE,
- dateTimeField.getResolution());
+ assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution());
verify(valueChangeListener, never())
.valueChange(Mockito.any(HasValue.ValueChangeEvent.class));
diff --git a/server/src/test/java/com/vaadin/ui/HorizontalSplitPanelTest.java b/server/src/test/java/com/vaadin/ui/HorizontalSplitPanelTest.java
index fcdb0a85ad..2eb3ba5f3c 100644
--- a/server/src/test/java/com/vaadin/ui/HorizontalSplitPanelTest.java
+++ b/server/src/test/java/com/vaadin/ui/HorizontalSplitPanelTest.java
@@ -15,7 +15,8 @@
*/
package com.vaadin.ui;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
import com.vaadin.shared.ui.splitpanel.HorizontalSplitPanelState;
@@ -24,7 +25,7 @@ public class HorizontalSplitPanelTest {
@Test
public void primaryStyleName() {
- Assert.assertEquals(new HorizontalSplitPanelState().primaryStyleName,
+ assertEquals(new HorizontalSplitPanelState().primaryStyleName,
new HorizontalSplitPanel().getPrimaryStyleName());
}
}
diff --git a/server/src/test/java/com/vaadin/ui/InlineDateFieldConstructorTest.java b/server/src/test/java/com/vaadin/ui/InlineDateFieldConstructorTest.java
index 936efcdc03..1bf518460f 100644
--- a/server/src/test/java/com/vaadin/ui/InlineDateFieldConstructorTest.java
+++ b/server/src/test/java/com/vaadin/ui/InlineDateFieldConstructorTest.java
@@ -15,35 +15,37 @@
*/
package com.vaadin.ui;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
import java.time.LocalDate;
-import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import com.vaadin.data.HasValue;
import com.vaadin.shared.ui.datefield.DateResolution;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-
public class InlineDateFieldConstructorTest {
@Test
public void initiallyEmpty() {
InlineDateField dateField = new InlineDateField();
- Assert.assertTrue(dateField.isEmpty());
- Assert.assertEquals(DateResolution.DAY, dateField.getResolution());
+ assertTrue(dateField.isEmpty());
+ assertEquals(DateResolution.DAY, dateField.getResolution());
}
@Test
public void testValueConstructor_emptyAfterClear() {
InlineDateField dateField = new InlineDateField(null, LocalDate.now());
- Assert.assertEquals(DateResolution.DAY, dateField.getResolution());
- Assert.assertFalse(dateField.isEmpty());
+ assertEquals(DateResolution.DAY, dateField.getResolution());
+ assertFalse(dateField.isEmpty());
dateField.clear();
- Assert.assertTrue(dateField.isEmpty());
+ assertTrue(dateField.isEmpty());
}
@Test
@@ -51,7 +53,7 @@ public class InlineDateFieldConstructorTest {
HasValue.ValueChangeListener valueChangeListener = Mockito
.mock(HasValue.ValueChangeListener.class);
InlineDateField dateField = new InlineDateField(valueChangeListener);
- Assert.assertEquals(DateResolution.DAY, dateField.getResolution());
+ assertEquals(DateResolution.DAY, dateField.getResolution());
dateField.setValue(LocalDate.now());
@@ -66,7 +68,7 @@ public class InlineDateFieldConstructorTest {
.mock(HasValue.ValueChangeListener.class);
InlineDateField dateField = new InlineDateField("Caption",
LocalDate.now(), valueChangeListener);
- Assert.assertEquals(DateResolution.DAY, dateField.getResolution());
+ assertEquals(DateResolution.DAY, dateField.getResolution());
verify(valueChangeListener, never())
.valueChange(Mockito.any(HasValue.ValueChangeEvent.class));
diff --git a/server/src/test/java/com/vaadin/ui/InlineDateTimeFieldConstructorTest.java b/server/src/test/java/com/vaadin/ui/InlineDateTimeFieldConstructorTest.java
index 6a2aaca7aa..0c900276b6 100644
--- a/server/src/test/java/com/vaadin/ui/InlineDateTimeFieldConstructorTest.java
+++ b/server/src/test/java/com/vaadin/ui/InlineDateTimeFieldConstructorTest.java
@@ -15,38 +15,38 @@
*/
package com.vaadin.ui;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
import java.time.LocalDateTime;
-import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import com.vaadin.data.HasValue;
import com.vaadin.shared.ui.datefield.DateTimeResolution;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-
public class InlineDateTimeFieldConstructorTest {
@Test
public void initiallyEmpty() {
InlineDateTimeField dateTimeField = new InlineDateTimeField();
- Assert.assertTrue(dateTimeField.isEmpty());
- Assert.assertEquals(DateTimeResolution.MINUTE,
- dateTimeField.getResolution());
+ assertTrue(dateTimeField.isEmpty());
+ assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution());
}
@Test
public void testValueConstructor_emptyAfterClear() {
InlineDateTimeField dateTimeField = new InlineDateTimeField(null,
LocalDateTime.now());
- Assert.assertFalse(dateTimeField.isEmpty());
- Assert.assertEquals(DateTimeResolution.MINUTE,
- dateTimeField.getResolution());
+ assertFalse(dateTimeField.isEmpty());
+ assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution());
dateTimeField.clear();
- Assert.assertTrue(dateTimeField.isEmpty());
+ assertTrue(dateTimeField.isEmpty());
}
@Test
@@ -55,8 +55,7 @@ public class InlineDateTimeFieldConstructorTest {
.mock(HasValue.ValueChangeListener.class);
InlineDateTimeField dateTimeField = new InlineDateTimeField(
valueChangeListener);
- Assert.assertEquals(DateTimeResolution.MINUTE,
- dateTimeField.getResolution());
+ assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution());
dateTimeField.setValue(LocalDateTime.now());
@@ -71,8 +70,7 @@ public class InlineDateTimeFieldConstructorTest {
.mock(HasValue.ValueChangeListener.class);
InlineDateTimeField dateTimeField = new InlineDateTimeField("Caption",
LocalDateTime.now(), valueChangeListener);
- Assert.assertEquals(DateTimeResolution.MINUTE,
- dateTimeField.getResolution());
+ assertEquals(DateTimeResolution.MINUTE, dateTimeField.getResolution());
verify(valueChangeListener, never())
.valueChange(Mockito.any(HasValue.ValueChangeEvent.class));
diff --git a/server/src/test/java/com/vaadin/ui/LabelTest.java b/server/src/test/java/com/vaadin/ui/LabelTest.java
index 5bf082f659..e98c4a0d7b 100644
--- a/server/src/test/java/com/vaadin/ui/LabelTest.java
+++ b/server/src/test/java/com/vaadin/ui/LabelTest.java
@@ -1,25 +1,26 @@
package com.vaadin.ui;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
public class LabelTest {
@Test
public void emptyLabelValue() {
- Assert.assertEquals("", new Label().getValue());
+ assertEquals("", new Label().getValue());
}
@Test
public void labelInitialValue() {
- Assert.assertEquals("initial", new Label("initial").getValue());
+ assertEquals("initial", new Label("initial").getValue());
}
@Test
public void labelSetValue() {
Label label = new Label();
label.setValue("foo");
- Assert.assertEquals("foo", label.getValue());
+ assertEquals("foo", label.getValue());
}
}
diff --git a/server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java b/server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java
index d6f8cc2a5c..a9ad4bbbe5 100644
--- a/server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java
+++ b/server/src/test/java/com/vaadin/ui/PasswordFieldConstructorTest.java
@@ -15,29 +15,31 @@
*/
package com.vaadin.ui;
-import org.junit.Assert;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
import org.junit.Test;
import org.mockito.Mockito;
import com.vaadin.data.HasValue;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
public class PasswordFieldConstructorTest {
@Test
public void initiallyEmpty() {
PasswordField passwordField = new PasswordField();
- Assert.assertTrue(passwordField.isEmpty());
+ assertTrue(passwordField.isEmpty());
}
@Test
public void testValueConstructor_emptyAfterClear() {
PasswordField passwordField = new PasswordField(null, "foobar");
- Assert.assertFalse(passwordField.isEmpty());
+ assertFalse(passwordField.isEmpty());
passwordField.clear();
- Assert.assertTrue(passwordField.isEmpty());
+ assertTrue(passwordField.isEmpty());
}
@Test
diff --git a/server/src/test/java/com/vaadin/ui/PushConfigurationTransportTest.java b/server/src/test/java/com/vaadin/ui/PushConfigurationTransportTest.java
index 6111ccc65b..8841bc70bc 100644
--- a/server/src/test/java/com/vaadin/ui/PushConfigurationTransportTest.java
+++ b/server/src/test/java/com/vaadin/ui/PushConfigurationTransportTest.java
@@ -15,7 +15,10 @@
*/
package com.vaadin.ui;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
import com.vaadin.server.VaadinRequest;
@@ -38,14 +41,13 @@ public class PushConfigurationTransportTest {
};
for (Transport transport : Transport.values()) {
ui.getPushConfiguration().setTransport(transport);
- Assert.assertEquals(ui.getPushConfiguration().getTransport(),
- transport);
+ assertEquals(ui.getPushConfiguration().getTransport(), transport);
if (transport == Transport.WEBSOCKET_XHR) {
- Assert.assertTrue(ui
+ assertTrue(ui
.getState().pushConfiguration.alwaysUseXhrForServerRequests);
} else {
- Assert.assertFalse(ui
+ assertFalse(ui
.getState().pushConfiguration.alwaysUseXhrForServerRequests);
}
}
diff --git a/server/src/test/java/com/vaadin/ui/RadioButtonGroupTest.java b/server/src/test/java/com/vaadin/ui/RadioButtonGroupTest.java
index b87d459517..fd2350685a 100644
--- a/server/src/test/java/com/vaadin/ui/RadioButtonGroupTest.java
+++ b/server/src/test/java/com/vaadin/ui/RadioButtonGroupTest.java
@@ -15,9 +15,12 @@
*/
package com.vaadin.ui;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.concurrent.atomic.AtomicInteger;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -42,7 +45,7 @@ public class RadioButtonGroupTest {
radioButtonGroup.addSelectionListener(event -> {
listenerCount.incrementAndGet();
- Assert.assertFalse(event.isUserOriginated());
+ assertFalse(event.isUserOriginated());
});
radioButtonGroup.setValue("First");
@@ -51,7 +54,7 @@ public class RadioButtonGroupTest {
radioButtonGroup.setValue(null);
radioButtonGroup.setValue(null);
- Assert.assertEquals(3, listenerCount.get());
+ assertEquals(3, listenerCount.get());
}
@Test
@@ -60,7 +63,7 @@ public class RadioButtonGroupTest {
radioButtonGroup.addSelectionListener(event -> {
listenerCount.incrementAndGet();
- Assert.assertTrue(event.isUserOriginated());
+ assertTrue(event.isUserOriginated());
});
SelectionServerRpc rpc = ServerRpcManager.getRpcProxy(radioButtonGroup,
@@ -70,7 +73,7 @@ public class RadioButtonGroupTest {
rpc.select(getItemKey("Second"));
rpc.deselect(getItemKey("Second"));
- Assert.assertEquals(3, listenerCount.get());
+ assertEquals(3, listenerCount.get());
}
private String getItemKey(String dataObject) {
diff --git a/server/src/test/java/com/vaadin/ui/RichTextAreaConstructorTest.java b/server/src/test/java/com/vaadin/ui/RichTextAreaConstructorTest.java
index b77690594c..212ce2da9f 100644
--- a/server/src/test/java/com/vaadin/ui/RichTextAreaConstructorTest.java
+++ b/server/src/test/java/com/vaadin/ui/RichTextAreaConstructorTest.java
@@ -15,29 +15,31 @@
*/
package com.vaadin.ui;
-import org.junit.Assert;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
import org.junit.Test;
import org.mockito.Mockito;
import com.vaadin.data.HasValue;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
public class RichTextAreaConstructorTest {
@Test
public void initiallyEmpty() {
RichTextArea richTextArea = new RichTextArea();
- Assert.assertTrue(richTextArea.isEmpty());
+ assertTrue(richTextArea.isEmpty());
}
@Test
public void testValueConstructor_emptyAfterClear() {
RichTextArea richTextArea = new RichTextArea(null, "foobar");
- Assert.assertFalse(richTextArea.isEmpty());
+ assertFalse(richTextArea.isEmpty());
richTextArea.clear();
- Assert.assertTrue(richTextArea.isEmpty());
+ assertTrue(richTextArea.isEmpty());
}
@Test
diff --git a/server/src/test/java/com/vaadin/ui/RichTextAreaTest.java b/server/src/test/java/com/vaadin/ui/RichTextAreaTest.java
index 7c042df931..3c27ae9820 100644
--- a/server/src/test/java/com/vaadin/ui/RichTextAreaTest.java
+++ b/server/src/test/java/com/vaadin/ui/RichTextAreaTest.java
@@ -18,8 +18,10 @@ package com.vaadin.ui;
import static com.vaadin.ui.ComponentTest.isDirty;
import static com.vaadin.ui.ComponentTest.syncToClient;
import static com.vaadin.ui.ComponentTest.updateDiffState;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.server.ClientConnector;
@@ -33,7 +35,7 @@ public class RichTextAreaTest {
@Test
public void initiallyEmpty() {
RichTextArea tf = new RichTextArea();
- Assert.assertTrue(tf.isEmpty());
+ assertTrue(tf.isEmpty());
}
@Test
@@ -41,7 +43,7 @@ public class RichTextAreaTest {
RichTextArea tf = new RichTextArea();
tf.setReadOnly(true);
tf.setValue("foo");
- Assert.assertEquals("foo", tf.getValue());
+ assertEquals("foo", tf.getValue());
}
@Test
@@ -64,8 +66,8 @@ public class RichTextAreaTest {
// The real value will be sent back as long as the field is marked as
// dirty and diffstate contains what the client has
- Assert.assertEquals("foo", getDiffStateString(rta, "value"));
- Assert.assertTrue("Component should be marked dirty", isDirty(rta));
+ assertEquals("foo", getDiffStateString(rta, "value"));
+ assertTrue("Component should be marked dirty", isDirty(rta));
}
@Test
@@ -78,7 +80,7 @@ public class RichTextAreaTest {
updateDiffState(rta);
ServerRpcManager.getRpcProxy(rta, RichTextAreaServerRpc.class)
.setText("foo");
- Assert.assertEquals("foo", getDiffStateString(rta, "value"));
+ assertEquals("foo", getDiffStateString(rta, "value"));
}
private String getDiffStateString(ClientConnector connector, String key) {
@@ -92,7 +94,7 @@ public class RichTextAreaTest {
tf.setValue("bar");
tf.setReadOnly(true);
tf.setValue("foo", true);
- Assert.assertEquals("bar", tf.getValue());
+ assertEquals("bar", tf.getValue());
}
@Test(expected = NullPointerException.class)
@@ -105,9 +107,9 @@ public class RichTextAreaTest {
public void emptyAfterClear() {
RichTextArea tf = new RichTextArea();
tf.setValue("foobar");
- Assert.assertFalse(tf.isEmpty());
+ assertFalse(tf.isEmpty());
tf.clear();
- Assert.assertTrue(tf.isEmpty());
+ assertTrue(tf.isEmpty());
}
}
diff --git a/server/src/test/java/com/vaadin/ui/TextAreaConstructorTest.java b/server/src/test/java/com/vaadin/ui/TextAreaConstructorTest.java
index c090d86efe..0c89d53051 100644
--- a/server/src/test/java/com/vaadin/ui/TextAreaConstructorTest.java
+++ b/server/src/test/java/com/vaadin/ui/TextAreaConstructorTest.java
@@ -15,29 +15,31 @@
*/
package com.vaadin.ui;
-import org.junit.Assert;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
import org.junit.Test;
import org.mockito.Mockito;
import com.vaadin.data.HasValue;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
public class TextAreaConstructorTest {
@Test
public void initiallyEmpty() {
TextArea textArea = new TextArea();
- Assert.assertTrue(textArea.isEmpty());
+ assertTrue(textArea.isEmpty());
}
@Test
public void testValueConstructor_emptyAfterClear() {
TextArea textArea = new TextArea(null, "foobar");
- Assert.assertFalse(textArea.isEmpty());
+ assertFalse(textArea.isEmpty());
textArea.clear();
- Assert.assertTrue(textArea.isEmpty());
+ assertTrue(textArea.isEmpty());
}
@Test
diff --git a/server/src/test/java/com/vaadin/ui/TextAreaTest.java b/server/src/test/java/com/vaadin/ui/TextAreaTest.java
index 6c3d5fecd5..110fa86eff 100644
--- a/server/src/test/java/com/vaadin/ui/TextAreaTest.java
+++ b/server/src/test/java/com/vaadin/ui/TextAreaTest.java
@@ -15,23 +15,25 @@
*/
package com.vaadin.ui;
-import org.junit.Assert;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
public class TextAreaTest {
@Test
public void initiallyEmpty() {
TextArea textArea = new TextArea();
- Assert.assertTrue(textArea.isEmpty());
+ assertTrue(textArea.isEmpty());
}
@Test
public void emptyAfterClear() {
TextArea textArea = new TextArea();
textArea.setValue("foobar");
- Assert.assertFalse(textArea.isEmpty());
+ assertFalse(textArea.isEmpty());
textArea.clear();
- Assert.assertTrue(textArea.isEmpty());
+ assertTrue(textArea.isEmpty());
}
}
diff --git a/server/src/test/java/com/vaadin/ui/TextFieldConstructorTest.java b/server/src/test/java/com/vaadin/ui/TextFieldConstructorTest.java
index 3bcb457fec..d8b5e986cc 100644
--- a/server/src/test/java/com/vaadin/ui/TextFieldConstructorTest.java
+++ b/server/src/test/java/com/vaadin/ui/TextFieldConstructorTest.java
@@ -15,29 +15,31 @@
*/
package com.vaadin.ui;
-import org.junit.Assert;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
import org.junit.Test;
import org.mockito.Mockito;
import com.vaadin.data.HasValue;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
public class TextFieldConstructorTest {
@Test
public void initiallyEmpty() {
TextField textField = new TextField();
- Assert.assertTrue(textField.isEmpty());
+ assertTrue(textField.isEmpty());
}
@Test
public void testValueConstructor_emptyAfterClear() {
TextField textField = new TextField(null, "foobar");
- Assert.assertFalse(textField.isEmpty());
+ assertFalse(textField.isEmpty());
textField.clear();
- Assert.assertTrue(textField.isEmpty());
+ assertTrue(textField.isEmpty());
}
@Test
diff --git a/server/src/test/java/com/vaadin/ui/UIInitRefreshTest.java b/server/src/test/java/com/vaadin/ui/UIInitRefreshTest.java
index 65bbc59a5b..a1b8394c7b 100644
--- a/server/src/test/java/com/vaadin/ui/UIInitRefreshTest.java
+++ b/server/src/test/java/com/vaadin/ui/UIInitRefreshTest.java
@@ -15,11 +15,14 @@
*/
package com.vaadin.ui;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.Locale;
import org.easymock.EasyMock;
import org.easymock.IMocksControl;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -47,36 +50,36 @@ public class UIInitRefreshTest {
initCalled = true;
- Assert.assertEquals("foo", getPage().getUriFragment());
- Assert.assertEquals(100, getPage().getBrowserWindowWidth());
- Assert.assertEquals(100, getPage().getBrowserWindowHeight());
+ assertEquals("foo", getPage().getUriFragment());
+ assertEquals(100, getPage().getBrowserWindowWidth());
+ assertEquals(100, getPage().getBrowserWindowHeight());
- Assert.assertFalse(fragmentChangeCalled);
- Assert.assertFalse(browserWindowResizeCalled);
+ assertFalse(fragmentChangeCalled);
+ assertFalse(browserWindowResizeCalled);
}
@Override
protected void refresh(VaadinRequest request) {
refreshCalled = true;
- Assert.assertEquals("bar", getPage().getUriFragment());
- Assert.assertEquals(200, getPage().getBrowserWindowWidth());
- Assert.assertEquals(200, getPage().getBrowserWindowHeight());
+ assertEquals("bar", getPage().getUriFragment());
+ assertEquals(200, getPage().getBrowserWindowWidth());
+ assertEquals(200, getPage().getBrowserWindowHeight());
- Assert.assertFalse(fragmentChangeCalled);
- Assert.assertFalse(browserWindowResizeCalled);
+ assertFalse(fragmentChangeCalled);
+ assertFalse(browserWindowResizeCalled);
}
@Override
public void browserWindowResized(BrowserWindowResizeEvent event) {
- Assert.assertEquals(200, event.getWidth());
- Assert.assertEquals(200, event.getHeight());
+ assertEquals(200, event.getWidth());
+ assertEquals(200, event.getHeight());
browserWindowResizeCalled = true;
}
@Override
public void uriFragmentChanged(UriFragmentChangedEvent event) {
- Assert.assertEquals("bar", event.getUriFragment());
+ assertEquals("bar", event.getUriFragment());
fragmentChangeCalled = true;
}
}
@@ -117,14 +120,14 @@ public class UIInitRefreshTest {
ui.setSession(session);
ui.doInit(initRequest, 0, "");
- Assert.assertTrue(initCalled);
- Assert.assertFalse(fragmentChangeCalled);
- Assert.assertFalse(browserWindowResizeCalled);
+ assertTrue(initCalled);
+ assertFalse(fragmentChangeCalled);
+ assertFalse(browserWindowResizeCalled);
ui.doRefresh(reinitRequest);
- Assert.assertTrue(refreshCalled);
- Assert.assertTrue(fragmentChangeCalled);
- Assert.assertTrue(browserWindowResizeCalled);
+ assertTrue(refreshCalled);
+ assertTrue(fragmentChangeCalled);
+ assertTrue(browserWindowResizeCalled);
}
}
diff --git a/server/src/test/java/com/vaadin/ui/UITest.java b/server/src/test/java/com/vaadin/ui/UITest.java
index 8bc3c98470..886dd38087 100644
--- a/server/src/test/java/com/vaadin/ui/UITest.java
+++ b/server/src/test/java/com/vaadin/ui/UITest.java
@@ -1,5 +1,9 @@
package com.vaadin.ui;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
import java.lang.ref.WeakReference;
import java.util.Properties;
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -9,7 +13,6 @@ import java.util.concurrent.locks.ReentrantLock;
import javax.servlet.ServletConfig;
-import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
@@ -132,16 +135,16 @@ public class UITest {
if (websocketThread.isAlive() || uiDisconnectThread.isAlive()) {
websocketThread.interrupt();
uiDisconnectThread.interrupt();
- Assert.fail("Threads are still running");
+ fail("Threads are still running");
}
if (!exceptions.isEmpty()) {
for (Exception e : exceptions) {
e.printStackTrace();
}
- Assert.fail("There were exceptions in the threads");
+ fail("There were exceptions in the threads");
}
- Assert.assertNull(ui.getSession());
+ assertNull(ui.getSession());
// PushConnection is set to null in another thread. We need to wait for
// that to happen
@@ -152,7 +155,7 @@ public class UITest {
Thread.sleep(500);
}
- Assert.assertNull(ui.getPushConnection());
+ assertNull(ui.getPushConnection());
}
@@ -195,7 +198,7 @@ public class UITest {
CurrentInstanceTest.waitUntilGarbageCollected(contentOnlyOnServer);
// Should not clean references for connectors available in the browser
// until the session is unlocked and we know if it has been moved
- Assert.assertNotNull(contentSentToClient.get());
+ assertNotNull(contentSentToClient.get());
session.unlock();
CurrentInstanceTest.waitUntilGarbageCollected(contentSentToClient);
}
diff --git a/server/src/test/java/com/vaadin/ui/VerticalSplitPanelTest.java b/server/src/test/java/com/vaadin/ui/VerticalSplitPanelTest.java
index d77f307d49..bc732177f4 100644
--- a/server/src/test/java/com/vaadin/ui/VerticalSplitPanelTest.java
+++ b/server/src/test/java/com/vaadin/ui/VerticalSplitPanelTest.java
@@ -15,7 +15,8 @@
*/
package com.vaadin.ui;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
import com.vaadin.shared.ui.splitpanel.VerticalSplitPanelState;
@@ -24,7 +25,7 @@ public class VerticalSplitPanelTest {
@Test
public void primaryStyleName() {
- Assert.assertEquals(new VerticalSplitPanelState().primaryStyleName,
+ assertEquals(new VerticalSplitPanelState().primaryStyleName,
new VerticalSplitPanel().getPrimaryStyleName());
}
}
diff --git a/server/src/test/java/com/vaadin/ui/components/grid/StaticSectionTest.java b/server/src/test/java/com/vaadin/ui/components/grid/StaticSectionTest.java
index 1223cfaef8..8ae35e72a3 100644
--- a/server/src/test/java/com/vaadin/ui/components/grid/StaticSectionTest.java
+++ b/server/src/test/java/com/vaadin/ui/components/grid/StaticSectionTest.java
@@ -15,12 +15,13 @@
*/
package com.vaadin.ui.components.grid;
+import static org.junit.Assert.assertEquals;
+
import java.util.Arrays;
import java.util.HashSet;
import org.jsoup.nodes.Element;
import org.jsoup.parser.Tag;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -129,9 +130,9 @@ public class StaticSectionTest {
staticRow.writeDesign(container, null);
- Assert.assertEquals(2, container.children().size());
- Assert.assertEquals("col1,col2", container.child(0).attr("column-ids"));
- Assert.assertEquals("col3", container.child(1).attr("column-ids"));
+ assertEquals(2, container.children().size());
+ assertEquals("col1,col2", container.child(0).attr("column-ids"));
+ assertEquals("col3", container.child(1).attr("column-ids"));
}
}
diff --git a/server/src/test/java/com/vaadin/ui/declarative/DesignTest.java b/server/src/test/java/com/vaadin/ui/declarative/DesignTest.java
index 769a02dedc..928eb3acb6 100644
--- a/server/src/test/java/com/vaadin/ui/declarative/DesignTest.java
+++ b/server/src/test/java/com/vaadin/ui/declarative/DesignTest.java
@@ -15,6 +15,8 @@
*/
package com.vaadin.ui.declarative;
+import static org.junit.Assert.assertEquals;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
@@ -27,7 +29,6 @@ import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
import org.junit.AfterClass;
-import org.junit.Assert;
import org.junit.Test;
import com.vaadin.ui.Component;
@@ -62,7 +63,7 @@ public class DesignTest {
String cp1251Html = getHtml();
setUtf8Charset();
String utf8Html = getHtml();
- Assert.assertEquals(
+ assertEquals(
"Html written with UTF-8 as default encoding "
+ "differs from html written with cp1251 encoding",
cp1251Html, utf8Html);
@@ -74,7 +75,7 @@ public class DesignTest {
IllegalArgumentException, IllegalAccessException {
setCp1251Charset();
String cp1251Html = getHtml();
- Assert.assertEquals(
+ assertEquals(
"Non ascii string parsed from serialized HTML "
+ "differs from expected",
NON_ASCII_STRING, getHtmlLabelValue(cp1251Html));
@@ -86,7 +87,7 @@ public class DesignTest {
IllegalArgumentException, IllegalAccessException {
setUtf8Charset();
String utf8 = getHtml();
- Assert.assertEquals(
+ assertEquals(
"Non ascii string parsed from serialized HTML "
+ "differs from expected",
NON_ASCII_STRING, getHtmlLabelValue(utf8));
diff --git a/server/src/test/java/com/vaadin/util/CurrentInstanceTest.java b/server/src/test/java/com/vaadin/util/CurrentInstanceTest.java
index dd4cc3f543..74b8ce7e6d 100644
--- a/server/src/test/java/com/vaadin/util/CurrentInstanceTest.java
+++ b/server/src/test/java/com/vaadin/util/CurrentInstanceTest.java
@@ -15,7 +15,10 @@
*/
package com.vaadin.util;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
@@ -27,7 +30,6 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.easymock.EasyMock;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -52,8 +54,7 @@ public class CurrentInstanceTest {
@Test
public void testClearedAfterRemove() throws Exception {
CurrentInstance.set(CurrentInstanceTest.class, this);
- Assert.assertEquals(this,
- CurrentInstance.get(CurrentInstanceTest.class));
+ assertEquals(this, CurrentInstance.get(CurrentInstanceTest.class));
CurrentInstance.set(CurrentInstanceTest.class, null);
assertCleared();
@@ -62,8 +63,7 @@ public class CurrentInstanceTest {
@Test
public void testClearedWithClearAll() throws Exception {
CurrentInstance.set(CurrentInstanceTest.class, this);
- Assert.assertEquals(this,
- CurrentInstance.get(CurrentInstanceTest.class));
+ assertEquals(this, CurrentInstance.get(CurrentInstanceTest.class));
CurrentInstance.clearAll();
assertCleared();
@@ -71,7 +71,7 @@ public class CurrentInstanceTest {
private void assertCleared() throws SecurityException, NoSuchFieldException,
IllegalAccessException {
- Assert.assertNull(getInternalCurrentInstanceVariable().get());
+ assertNull(getInternalCurrentInstanceVariable().get());
}
private ThreadLocal<Map<Class<?>, CurrentInstance>> getInternalCurrentInstanceVariable()
@@ -156,7 +156,7 @@ public class CurrentInstanceTest {
CurrentInstance.restoreInstances(previous);
- Assert.assertNull(VaadinSession.getCurrent());
+ assertNull(VaadinSession.getCurrent());
}
public static void waitUntilGarbageCollected(WeakReference<?> ref)
@@ -168,7 +168,7 @@ public class CurrentInstanceTest {
}
Thread.sleep(100);
}
- Assert.fail("Value was not garbage collected.");
+ fail("Value was not garbage collected.");
}
@Test
@@ -177,10 +177,10 @@ public class CurrentInstanceTest {
CurrentInstance.clearAll();
CurrentInstance.set(CurrentInstanceTest.class, this);
- Assert.assertNotNull(CurrentInstance.get(CurrentInstanceTest.class));
+ assertNotNull(CurrentInstance.get(CurrentInstanceTest.class));
Callable<Void> runnable = () -> {
- Assert.assertNull(CurrentInstance.get(CurrentInstanceTest.class));
+ assertNull(CurrentInstance.get(CurrentInstanceTest.class));
return null;
};
ExecutorService service = Executors.newSingleThreadExecutor();
diff --git a/server/src/test/java/com/vaadin/util/EncodeUtilTest.java b/server/src/test/java/com/vaadin/util/EncodeUtilTest.java
index 7bac539968..59efec59ad 100644
--- a/server/src/test/java/com/vaadin/util/EncodeUtilTest.java
+++ b/server/src/test/java/com/vaadin/util/EncodeUtilTest.java
@@ -15,18 +15,19 @@
*/
package com.vaadin.util;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+
import org.junit.Test;
public class EncodeUtilTest {
@Test
public void rfc5987Encode() {
- Assert.assertEquals("A", EncodeUtil.rfc5987Encode("A"));
- Assert.assertEquals("%20", EncodeUtil.rfc5987Encode(" "));
- Assert.assertEquals("%c3%a5", EncodeUtil.rfc5987Encode("å"));
- Assert.assertEquals("%e6%97%a5", EncodeUtil.rfc5987Encode("日"));
+ assertEquals("A", EncodeUtil.rfc5987Encode("A"));
+ assertEquals("%20", EncodeUtil.rfc5987Encode(" "));
+ assertEquals("%c3%a5", EncodeUtil.rfc5987Encode("å"));
+ assertEquals("%e6%97%a5", EncodeUtil.rfc5987Encode("日"));
- Assert.assertEquals("A" + "%20" + "%c3%a5" + "%e6%97%a5",
+ assertEquals("A" + "%20" + "%c3%a5" + "%e6%97%a5",
EncodeUtil.rfc5987Encode("A å日"));
}
}
diff --git a/server/src/test/java/com/vaadin/util/ReflectToolsTest.java b/server/src/test/java/com/vaadin/util/ReflectToolsTest.java
index 353bf0972c..6fba5d761f 100644
--- a/server/src/test/java/com/vaadin/util/ReflectToolsTest.java
+++ b/server/src/test/java/com/vaadin/util/ReflectToolsTest.java
@@ -15,39 +15,40 @@
*/
package com.vaadin.util;
+import static org.junit.Assert.assertSame;
+
import java.io.Serializable;
-import org.junit.Assert;
import org.junit.Test;
public class ReflectToolsTest implements Serializable {
@Test
public void findCommonBaseType_sameType() {
- Assert.assertSame(Number.class,
+ assertSame(Number.class,
ReflectTools.findCommonBaseType(Number.class, Number.class));
}
@Test
public void findCommonBaseType_aExtendsB() {
- Assert.assertSame(Number.class,
+ assertSame(Number.class,
ReflectTools.findCommonBaseType(Integer.class, Number.class));
}
@Test
public void findCommonBaseType_bExtendsA() {
- Assert.assertSame(Number.class,
+ assertSame(Number.class,
ReflectTools.findCommonBaseType(Number.class, Integer.class));
}
@Test
public void findCommonBaseType_commonBase() {
- Assert.assertSame(Number.class,
+ assertSame(Number.class,
ReflectTools.findCommonBaseType(Double.class, Integer.class));
}
@Test
public void findCommonBaseType_noCommonBase() {
- Assert.assertSame(Object.class,
+ assertSame(Object.class,
ReflectTools.findCommonBaseType(String.class, Number.class));
}
}