From e76be7da699a8e6fcf670deee77e3d25fccf5249 Mon Sep 17 00:00:00 2001 From: marcin <106965834+MarcinVaadin@users.noreply.github.com> Date: Mon, 24 Oct 2022 11:17:25 +0200 Subject: [PATCH 1/4] feat: separation of unit tests into junit4/junit5 --- pom.xml | 8 +- vaadin-testbench-core-junit5/pom.xml | 8 +- vaadin-testbench-unit-junit5/pom.xml | 296 ++++++++++ .../src/license/cvdl4/header.txt | 7 + .../testbench/unit/SpringUIUnitTest.java | 3 +- .../unit/TreeOnFailureExtension.java | 2 +- .../com/vaadin/testbench/unit/UIUnitTest.java | 0 .../test/java/com/example/SingleParam.java | 27 + .../test/java/com/example/TemplatedParam.java | 27 + .../test/java/com/example/base/ErrorView.java | 28 + .../java/com/example/base/HelloWorldView.java | 21 + .../com/example/base/ParametrizedView.java | 30 + .../java/com/example/base/ParentView.java | 18 + .../java/com/example/base/WelcomeView.java | 26 + .../com/example/base/child/ChildView.java | 20 + .../navigation/NavigationPostponeView.java | 35 ++ .../com/testapp/MyRouteNotFoundError.java | 29 + .../java/com/testapp/security/LoginView.java | 20 + .../com/testapp/security/ProtectedView.java | 23 + .../accordion/AccordionTesterTest.java | 2 +- .../component/accordion/AccordionView.java | 2 +- .../component/button/ButtonTesterTest.java | 2 +- .../flow/component/button/ButtonView.java | 2 +- .../charts/ChartTesterSeriesValueTest.java | 3 +- .../component/charts/ChartTesterTest.java | 3 +- .../component/charts/ColumnChartView.java | 3 +- .../checkbox/CheckboxGroupTesterTest.java | 3 +- .../checkbox/CheckboxTesterTest.java | 3 +- .../flow/component/checkbox/CheckboxView.java | 4 +- .../combobox/ComboBoxTesterTest.java | 2 +- .../flow/component/combobox/ComboBoxView.java | 2 +- .../ConfirmDialogTesterTest.java | 2 +- .../confirmdialog/ConfirmDialogView.java | 2 +- .../contextmenu/ContextMenuTesterTest.java | 3 +- .../contextmenu/ContextMenuView.java | 3 +- .../datepicker/DatePickerTesterTest.java | 2 +- .../component/datepicker/DatePickerView.java | 3 +- .../DateTimePickerTesterTest.java | 2 +- .../datetimepicker/DateTimePickerView.java | 2 +- .../component/details/DetailsTesterTest.java | 4 +- .../flow/component/details/DetailsView.java | 3 +- .../component/dialog/DialogTesterTest.java | 2 +- .../flow/component/dialog/DialogView.java | 2 +- .../vaadin/flow/component/grid/Address.java | 2 +- .../component/grid/BasicGridTesterTest.java | 2 +- .../flow/component/grid/BasicGridView.java | 2 +- .../component/grid/BeanGridTesterTest.java | 2 +- .../flow/component/grid/BeanGridView.java | 2 +- .../vaadin/flow/component/grid/CheckBox.java | 2 +- .../vaadin/flow/component/grid/Country.java | 2 +- .../grid/GetTextCellRendererTest.java | 3 +- .../component/grid/GridTesterSortTest.java | 3 +- .../vaadin/flow/component/grid/Person.java | 2 +- .../flow/component/grid/RendererGridView.java | 3 +- .../flow/component/grid/SortGridView.java | 2 +- .../html/testbench/AnchorTesterTest.java | 4 +- .../component/html/testbench/AnchorView.java | 2 +- .../component/listbox/ListBoxTesterTest.java | 2 +- .../flow/component/listbox/ListBoxView.java | 2 +- .../listbox/MultiSelectListBoxTesterTest.java | 2 +- .../component/login/LoginFormTesterTest.java | 2 +- .../flow/component/login/LoginFormView.java | 2 +- .../login/LoginOverlayTesterTest.java | 2 +- .../component/login/LoginOverlayView.java | 2 +- .../component/menubar/MenuBarTesterTest.java | 3 +- .../flow/component/menubar/MenuBarView.java | 3 +- .../messages/MessageInputTesterTest.java | 2 +- .../messages/MessageListTesterTest.java | 2 +- .../flow/component/messages/MessagesView.java | 2 +- .../notification/NotificationTesterTest.java | 2 +- .../notification/NotificationView.java | 3 +- .../RadioButtonGroupTesterTest.java | 2 +- .../radiobutton/RadioButtonTesterTest.java | 3 +- .../radiobutton/RadioButtonView.java | 3 +- .../component/select/SelectTesterTest.java | 4 +- .../flow/component/select/SelectView.java | 2 +- .../flow/component/tabs/TabsTesterTest.java | 3 +- .../vaadin/flow/component/tabs/TabsView.java | 3 +- .../textfield/NumberFieldTesterTest.java | 2 +- .../component/textfield/NumberFieldView.java | 2 +- .../textfield/TextAreaTesterTest.java | 2 +- .../component/textfield/TextAreaView.java | 2 +- .../textfield/TextFieldTesterTest.java | 2 +- .../component/textfield/TextFieldView.java | 2 +- .../timepicker/TimePickerTesterTest.java | 4 +- .../component/timepicker/TimePickerView.java | 3 +- .../component/upload/UploadTesterTest.java | 3 +- .../flow/component/upload/UploadView.java | 3 +- .../testbench/unit/ComponentQueryTest.java | 2 +- .../testbench/unit/ComponentTesterTest.java | 241 ++++++++ .../testbench/unit/ElementConditionsTest.java | 4 +- .../testbench/unit/NonGenericTestTester.java | 2 +- .../testbench/unit/SecurityTestConfig.java | 68 +++ .../unit/SpringUIUnitBaseClassTest.java | 3 +- .../unit/SpringUnitSecurityTest.java | 3 +- .../vaadin/testbench/unit/TestComponent.java | 2 +- .../unit/TestComponentForConcreteTester.java | 2 +- .../unit/TestCustomInstantiatorFactory.java | 27 + .../com/vaadin/testbench/unit/TestTester.java | 2 +- .../testbench/unit/TesterResolutionTest.java | 2 +- .../testbench/unit/UIUnitBaseClassTest.java | 90 ++- .../testbench/unit/UIUnitNavigationTest.java | 10 +- .../testbench/unit/UIUnitShortcutTest.java | 4 +- ...overRoutesInAnnotatedClassPackageTest.java | 3 +- .../ViewPackagesTestView.java | 3 +- .../DiscoverRoutesInPackageByClassTest.java | 3 +- .../DiscoverRoutesInPackageByNameTest.java | 3 +- ...overRoutesInPackageByClassAndNameTest.java | 3 +- .../vaadin/testbench/unit/TestInitListener.kt | 38 ++ .../com/vaadin/testbench/unit/TestUtils.kt | 24 + .../testbench/unit/internal/AllTests.kt | 74 +++ .../testbench/unit/internal/AsyncTest.kt | 152 +++++ .../unit/internal/AttachedTextField.kt | 22 + .../testbench/unit/internal/BasicUtilsTest.kt | 117 ++++ .../unit/internal/ComponentUtilsTest.kt | 275 +++++++++ .../internal/DepthFirstTreeIteratorTest.kt | 41 ++ .../unit/internal/ElementUtilsTest.kt | 111 ++++ .../testbench/unit/internal/LocatorTest.kt | 413 +++++++++++++ .../testbench/unit/internal/MockVaadinTest.kt | 557 ++++++++++++++++++ .../unit/internal/PrettyPrintTreeTest.kt | 293 +++++++++ .../testbench/unit/internal/RoutesTest.kt | 116 ++++ .../testbench/unit/internal/SearchSpecTest.kt | 113 ++++ .../testbench/unit/internal/ShortcutsTest.kt | 146 +++++ .../testbench/unit/mocks/MockContextTest.kt | 63 ++ .../unit/mocks/MockHttpSessionTest.kt | 100 ++++ .../testbench/unit/mocks/MockRequestTest.kt | 97 +++ .../testbench/unit/mocks/MockResponseTest.kt | 44 ++ .../unit/mocks/SessionAttributeMapTest.kt | 122 ++++ .../com/vaadin/testbench/unit/mocks/Utils.kt | 18 + ...adin.flow.server.VaadinServiceInitListener | 1 + .../webapp/VAADIN/themes/default/img/1.txt | 0 vaadin-testbench-unit-shared/pom.xml | 391 ++++++++++++ .../src/license/cvdl4/header.txt | 7 + .../component/accordion/AccordionTester.java | 2 +- .../flow/component/button/ButtonTester.java | 2 +- .../flow/component/charts/ChartTester.java | 3 +- .../checkbox/CheckboxGroupTester.java | 3 +- .../component/checkbox/CheckboxTester.java | 3 +- .../component/combobox/ComboBoxTester.java | 2 +- .../confirmdialog/ConfirmDialogTester.java | 2 +- .../contextmenu/ContextMenuTester.java | 3 +- .../datepicker/DatePickerTester.java | 2 +- .../datetimepicker/DateTimePickerTester.java | 2 +- .../flow/component/details/DetailsTester.java | 3 +- .../flow/component/dialog/DialogTester.java | 2 +- .../flow/component/grid/GridTester.java | 2 +- .../html/testbench/AnchorTester.java | 2 +- .../html/testbench/ClickHandler.java | 2 +- .../html/testbench/DescriptionListTester.java | 2 +- .../component/html/testbench/DivTester.java | 2 +- .../html/testbench/EmphasisTester.java | 2 +- .../component/html/testbench/H1Tester.java | 2 +- .../component/html/testbench/H2Tester.java | 2 +- .../component/html/testbench/H3Tester.java | 2 +- .../component/html/testbench/H4Tester.java | 2 +- .../component/html/testbench/H5Tester.java | 2 +- .../component/html/testbench/H6Tester.java | 2 +- .../component/html/testbench/HrTester.java | 2 +- .../html/testbench/HtmlClickContainer.java | 2 +- .../html/testbench/HtmlComponentTester.java | 2 +- .../html/testbench/HtmlContainerTester.java | 2 +- .../component/html/testbench/ImageTester.java | 2 +- .../component/html/testbench/InputTester.java | 2 +- .../component/html/testbench/LabelTester.java | 2 +- .../html/testbench/ListItemTester.java | 2 +- .../html/testbench/NativeButtonTester.java | 2 +- .../html/testbench/NativeDetailsTester.java | 2 +- .../html/testbench/OrderedListTester.java | 2 +- .../html/testbench/ParagraphTester.java | 2 +- .../component/html/testbench/PreTester.java | 2 +- .../component/html/testbench/SpanTester.java | 2 +- .../html/testbench/UnorderedListTester.java | 2 +- .../flow/component/listbox/ListBoxTester.java | 2 +- .../listbox/MultiSelectListBoxTester.java | 2 +- .../component/login/AbstractLoginTester.java | 2 +- .../flow/component/login/LoginFormTester.java | 2 +- .../component/login/LoginOverlayTester.java | 2 +- .../flow/component/menubar/MenuBarTester.java | 3 +- .../messages/MessageInputTester.java | 2 +- .../component/messages/MessageListTester.java | 2 +- .../notification/NotificationTester.java | 2 +- .../radiobutton/RadioButtonGroupTester.java | 2 +- .../radiobutton/RadioButtonTester.java | 2 +- .../flow/component/select/SelectTester.java | 2 +- .../flow/component/tabs/TabsTester.java | 3 +- .../textfield/NumberFieldTester.java | 2 +- .../component/textfield/TextAreaTester.java | 2 +- .../component/textfield/TextFieldTester.java | 2 +- .../timepicker/TimePickerTester.java | 2 +- .../flow/component/upload/UploadTester.java | 3 +- .../vaadin/testbench/unit/BaseUIUnitTest.java | 0 .../vaadin/testbench/unit/ComponentQuery.java | 2 +- .../testbench/unit/ComponentTester.java | 0 .../unit/ComponentTesterPackages.java | 2 +- .../testbench/unit/ElementConditions.java | 3 +- .../com/vaadin/testbench/unit/MetaKeys.java | 2 +- .../vaadin/testbench/unit/MouseButton.java | 2 +- .../vaadin/testbench/unit/TesterWrappers.java | 2 +- .../java/com/vaadin/testbench/unit/Tests.java | 2 +- .../unit/UITestSpringLookupInitializer.java | 3 +- .../unit/UIUnitTestSetupException.java | 3 +- .../vaadin/testbench/unit/ViewPackages.java | 3 +- .../unit/mocks/MockSpringServlet.java | 3 +- .../unit/mocks/MockSpringServletService.java | 3 +- .../unit/mocks/MockSpringVaadinSession.java | 3 +- .../unit/mocks/MockWebApplicationContext.java | 3 +- .../SpringSecurityRequestCustomizer.java | 3 +- .../vaadin/testbench/unit/component/Grid.kt | 0 .../testbench/unit/internal/BasicUtils.kt | 0 .../testbench/unit/internal/ComponentUtils.kt | 0 .../unit/internal/DepthFirstTreeIterator.kt | 0 .../testbench/unit/internal/ElementUtils.kt | 0 .../vaadin/testbench/unit/internal/Locator.kt | 0 .../testbench/unit/internal/MockVaadin.kt | 0 .../unit/internal/PrettyPrintTree.kt | 0 .../testbench/unit/internal/Renderers.kt | 0 .../vaadin/testbench/unit/internal/Routes.kt | 0 .../testbench/unit/internal/Shortcuts.kt | 0 .../unit/internal/TestingLifecycleHook.kt | 5 +- .../vaadin/testbench/unit/internal/Utils.kt | 0 .../testbench/unit/mocks/MockContext.kt | 0 .../unit/mocks/MockHttpEnvironment.kt | 0 .../testbench/unit/mocks/MockHttpSession.kt | 0 .../testbench/unit/mocks/MockInstantiator.kt | 0 .../testbench/unit/mocks/MockRequest.kt | 0 .../testbench/unit/mocks/MockResponse.kt | 0 .../testbench/unit/mocks/MockService.kt | 0 .../testbench/unit/mocks/MockVaadinHelper.kt | 0 .../testbench/unit/mocks/MockVaadinServlet.kt | 0 .../testbench/unit/mocks/MockVaadinSession.kt | 0 .../vaadin/testbench/unit/mocks/MockedUI.kt | 0 .../unit/mocks/SessionAttributeMap.kt | 0 .../testbench/unit/testbench.properties | 0 vaadin-testbench-unit/pom.xml | 111 +--- .../testbench/unit/SpringUIUnit4Test.java | 3 +- .../java/com/testapp/security/LoginView.java | 3 +- .../com/testapp/security/ProtectedView.java | 3 +- .../testbench/unit/ComponentTesterTest.java | 94 +-- .../testbench/unit/SecurityTestConfig.java | 3 +- .../unit/SpringUIUnit4BaseClassTest.java | 3 +- .../unit/SpringUnit4SecurityTest.java | 3 +- .../unit/TestCustomInstantiatorFactory.java | 3 +- .../testbench/unit/UIUnit4BaseClassTest.java | 14 +- ...overRoutesInAnnotatedClassPackageTest.java | 3 +- .../ViewPackagesTest4View.java | 3 +- .../DiscoverRoutesInPackageByClassTest.java | 3 +- .../DiscoverRoutesInPackageByNameTest.java | 3 +- ...overRoutesInPackageByClassAndNameTest.java | 3 +- .../com/vaadin/testbench/unit/TestUtils.kt | 2 +- .../testbench/unit/internal/AllTests.kt | 6 +- .../testbench/unit/internal/AsyncTest.kt | 12 +- .../unit/internal/ComponentUtilsTest.kt | 1 - .../internal/DepthFirstTreeIteratorTest.kt | 6 +- .../unit/internal/ElementUtilsTest.kt | 5 +- .../testbench/unit/internal/LocatorTest.kt | 2 +- .../testbench/unit/internal/MockVaadinTest.kt | 32 +- .../unit/internal/PrettyPrintTreeTest.kt | 30 +- .../testbench/unit/internal/RoutesTest.kt | 28 +- .../testbench/unit/mocks/MockContextTest.kt | 2 +- .../unit/mocks/MockHttpSessionTest.kt | 6 +- .../testbench/unit/mocks/MockRequestTest.kt | 2 +- .../testbench/unit/mocks/MockResponseTest.kt | 4 +- .../unit/mocks/SessionAttributeMapTest.kt | 2 +- 263 files changed, 4653 insertions(+), 518 deletions(-) create mode 100644 vaadin-testbench-unit-junit5/pom.xml create mode 100644 vaadin-testbench-unit-junit5/src/license/cvdl4/header.txt rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/main/java/com/vaadin/testbench/unit/SpringUIUnitTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/main/java/com/vaadin/testbench/unit/TreeOnFailureExtension.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/main/java/com/vaadin/testbench/unit/UIUnitTest.java (100%) create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/example/SingleParam.java create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/example/TemplatedParam.java create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/example/base/ErrorView.java create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/example/base/HelloWorldView.java create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/example/base/ParametrizedView.java create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/example/base/ParentView.java create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/example/base/WelcomeView.java create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/example/base/child/ChildView.java create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/example/base/navigation/NavigationPostponeView.java create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/testapp/MyRouteNotFoundError.java create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/testapp/security/LoginView.java create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/testapp/security/ProtectedView.java rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/accordion/AccordionTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/accordion/AccordionView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/button/ButtonTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/button/ButtonView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/charts/ChartTesterSeriesValueTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/charts/ChartTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/charts/ColumnChartView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/checkbox/CheckboxGroupTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/checkbox/CheckboxTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/checkbox/CheckboxView.java (98%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/combobox/ComboBoxTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/combobox/ComboBoxView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/datepicker/DatePickerTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/datepicker/DatePickerView.java (90%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/details/DetailsTesterTest.java (98%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/details/DetailsView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/dialog/DialogTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/dialog/DialogView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/grid/Address.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/grid/BasicGridTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/grid/BasicGridView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/grid/BeanGridTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/grid/BeanGridView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/grid/CheckBox.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/grid/Country.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/grid/GetTextCellRendererTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/grid/GridTesterSortTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/grid/Person.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/grid/RendererGridView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/grid/SortGridView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/html/testbench/AnchorTesterTest.java (97%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/html/testbench/AnchorView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/listbox/ListBoxTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/listbox/ListBoxView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/listbox/MultiSelectListBoxTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/login/LoginFormTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/login/LoginFormView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/login/LoginOverlayTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/login/LoginOverlayView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/menubar/MenuBarTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/menubar/MenuBarView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/messages/MessageInputTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/messages/MessageListTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/messages/MessagesView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/notification/NotificationTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/notification/NotificationView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonGroupTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/select/SelectTesterTest.java (97%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/select/SelectView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/tabs/TabsTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/tabs/TabsView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/textfield/NumberFieldTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/textfield/NumberFieldView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/textfield/TextAreaTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/textfield/TextAreaView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/textfield/TextFieldTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/textfield/TextFieldView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/timepicker/TimePickerTesterTest.java (96%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/timepicker/TimePickerView.java (90%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/upload/UploadTesterTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/flow/component/upload/UploadView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/ComponentQueryTest.java (99%) create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/ComponentTesterTest.java rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/ElementConditionsTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/NonGenericTestTester.java (99%) create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/SecurityTestConfig.java rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/SpringUIUnitBaseClassTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/SpringUnitSecurityTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/TestComponent.java (98%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/TestComponentForConcreteTester.java (99%) create mode 100644 vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TestCustomInstantiatorFactory.java rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/TestTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/TesterResolutionTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/UIUnitBaseClassTest.java (70%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/UIUnitNavigationTest.java (92%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/UIUnitShortcutTest.java (98%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/DiscoverRoutesInAnnotatedClassPackageTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/ViewPackagesTestView.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/viewscan/byclasses/DiscoverRoutesInPackageByClassTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagename/DiscoverRoutesInPackageByNameTest.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-junit5}/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagenameandclass/DiscoverRoutesInPackageByClassAndNameTest.java (99%) create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/TestInitListener.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/TestUtils.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/AllTests.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/AsyncTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/AttachedTextField.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/BasicUtilsTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/ComponentUtilsTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/DepthFirstTreeIteratorTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/ElementUtilsTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/LocatorTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/MockVaadinTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/PrettyPrintTreeTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/RoutesTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/SearchSpecTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/ShortcutsTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/mocks/MockContextTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/mocks/MockHttpSessionTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/mocks/MockRequestTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/mocks/MockResponseTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/mocks/SessionAttributeMapTest.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/mocks/Utils.kt create mode 100644 vaadin-testbench-unit-junit5/src/test/resources/META-INF/services/com.vaadin.flow.server.VaadinServiceInitListener create mode 100644 vaadin-testbench-unit-junit5/src/test/webapp/VAADIN/themes/default/img/1.txt create mode 100644 vaadin-testbench-unit-shared/pom.xml create mode 100644 vaadin-testbench-unit-shared/src/license/cvdl4/header.txt rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/accordion/AccordionTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/button/ButtonTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/charts/ChartTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/checkbox/CheckboxGroupTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/checkbox/CheckboxTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/combobox/ComboBoxTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/contextmenu/ContextMenuTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/datepicker/DatePickerTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/datetimepicker/DateTimePickerTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/details/DetailsTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/dialog/DialogTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/grid/GridTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/AnchorTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/ClickHandler.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/DescriptionListTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/DivTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/EmphasisTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/H1Tester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/H2Tester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/H3Tester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/H4Tester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/H5Tester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/H6Tester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/HrTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/HtmlClickContainer.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/HtmlComponentTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/HtmlContainerTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/ImageTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/InputTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/LabelTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/ListItemTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/NativeButtonTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/NativeDetailsTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/OrderedListTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/ParagraphTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/PreTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/SpanTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/html/testbench/UnorderedListTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/listbox/ListBoxTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/listbox/MultiSelectListBoxTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/login/AbstractLoginTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/login/LoginFormTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/login/LoginOverlayTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/menubar/MenuBarTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/messages/MessageInputTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/messages/MessageListTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/notification/NotificationTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/radiobutton/RadioButtonGroupTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/radiobutton/RadioButtonTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/select/SelectTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/tabs/TabsTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/textfield/NumberFieldTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/textfield/TextAreaTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/textfield/TextFieldTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/timepicker/TimePickerTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/flow/component/upload/UploadTester.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/BaseUIUnitTest.java (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/ComponentQuery.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/ComponentTester.java (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/ComponentTesterPackages.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/ElementConditions.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/MetaKeys.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/MouseButton.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/TesterWrappers.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/Tests.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/UITestSpringLookupInitializer.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/UIUnitTestSetupException.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/ViewPackages.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/mocks/MockSpringServlet.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/mocks/MockSpringServletService.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/mocks/MockSpringVaadinSession.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/mocks/MockWebApplicationContext.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/java/com/vaadin/testbench/unit/mocks/SpringSecurityRequestCustomizer.java (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/component/Grid.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/internal/BasicUtils.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/internal/ComponentUtils.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/internal/DepthFirstTreeIterator.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/internal/ElementUtils.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/internal/Locator.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/internal/MockVaadin.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/internal/PrettyPrintTree.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/internal/Renderers.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/internal/Routes.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/internal/Shortcuts.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/internal/TestingLifecycleHook.kt (99%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/internal/Utils.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/mocks/MockContext.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/mocks/MockHttpEnvironment.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/mocks/MockHttpSession.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/mocks/MockInstantiator.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/mocks/MockRequest.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/mocks/MockResponse.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/mocks/MockService.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/mocks/MockVaadinHelper.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/mocks/MockVaadinServlet.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/mocks/MockVaadinSession.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/mocks/MockedUI.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/kotlin/com/vaadin/testbench/unit/mocks/SessionAttributeMap.kt (100%) rename {vaadin-testbench-unit => vaadin-testbench-unit-shared}/src/main/resources/com/vaadin/testbench/unit/testbench.properties (100%) diff --git a/pom.xml b/pom.xml index ae3859354..6e6c3d7cb 100644 --- a/pom.xml +++ b/pom.xml @@ -41,12 +41,14 @@ vaadin-testbench-bom - vaadin-testbench-unit - vaadin-testbench-core - vaadin-testbench-integration-tests vaadin-testbench-shared + vaadin-testbench-core vaadin-testbench-core-junit5 + vaadin-testbench-integration-tests vaadin-testbench-integration-tests-junit5 + vaadin-testbench-unit-shared + vaadin-testbench-unit + vaadin-testbench-unit-junit5 diff --git a/vaadin-testbench-core-junit5/pom.xml b/vaadin-testbench-core-junit5/pom.xml index e86c459dd..f690ed5bd 100644 --- a/vaadin-testbench-core-junit5/pom.xml +++ b/vaadin-testbench-core-junit5/pom.xml @@ -242,14 +242,8 @@ com.vaadin - vaadin-testbench-unit + vaadin-testbench-unit-junit5 ${project.version} - - - junit - junit - - com.vaadin diff --git a/vaadin-testbench-unit-junit5/pom.xml b/vaadin-testbench-unit-junit5/pom.xml new file mode 100644 index 000000000..96f445833 --- /dev/null +++ b/vaadin-testbench-unit-junit5/pom.xml @@ -0,0 +1,296 @@ + + + 4.0.0 + + com.vaadin + vaadin-testbench-parent + 9.0-SNAPSHOT + + vaadin-testbench-unit-junit5 + jar + Vaadin Testbench UI Unit Test JUnit5 + Vaadin Testbench UI Unit Tests JUnit5 + http://vaadin.com + 2022 + + + + vaadin-prereleases + https://maven.vaadin.com/vaadin-prereleases/ + + + + + + Commercial Vaadin Developer License version 4.0 + https://vaadin.com/license/cvdl-4.0 + manual + + + + + 24.0-SNAPSHOT + 1.6.21 + 1.6.21 + 5.9.1 + + + + + com.vaadin + vaadin + ${vaadin.version} + provided + + + com.vaadin + vaadin-spring + ${vaadin.version} + provided + true + + + + com.github.mvysny.dynatest + dynatest + 0.24 + test + + + com.github.mvysny.karibudsl + karibu-dsl + 1.0.8 + test + + + + com.vaadin + vaadin-testbench-unit-shared + ${project.version} + + + + org.junit.jupiter + junit-jupiter-api + ${junit5.version} + provided + + + + org.junit.jupiter + junit-jupiter + ${junit5.version} + test + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-reflect + ${kotlin.version} + + + + org.springframework + spring-test + 6.0.0-M6 + provided + true + + + org.springframework.security + spring-security-core + 6.0.0-M7 + provided + true + + + org.springframework.security + spring-security-test + 6.0.0-M7 + provided + true + + + + + + + src/main/resources + true + + + + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + compile + + compile + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/main/java + + + + + test-compile + + test-compile + + + + ${project.basedir}/src/test/kotlin + ${project.basedir}/src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.9.0 + + + + default-compile + none + + + + default-testCompile + none + + + java-compile + compile + + compile + + + + java-test-compile + test-compile + + testCompile + + + + + + org.jetbrains.dokka + dokka-maven-plugin + ${dokka.version} + + ${maven.compiler.source} + + ${project.basedir}/src/main/java + ${project.basedir}/src/main/kotlin + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + add-kotlin-sources-for-source-jar + package + + add-source + + + + src/main/kotlin + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.22.2 + + + + integration-test + verify + + + + + + com.mycila + license-maven-plugin + 2.6 + + ${basedir} +
${basedir}/src/license/cvdl4/header.txt
+ false + true + false + true + true + UTF-8 + + ${project.inceptionYear} + + + target/** + **/*.xml + src/license/**/* + **/*.txt + +
+ + + + format + + + +
+
+
+ + +
\ No newline at end of file diff --git a/vaadin-testbench-unit-junit5/src/license/cvdl4/header.txt b/vaadin-testbench-unit-junit5/src/license/cvdl4/header.txt new file mode 100644 index 000000000..0b02704ab --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/license/cvdl4/header.txt @@ -0,0 +1,7 @@ +Copyright (C) ${year} Vaadin Ltd + +This program is available under Commercial Vaadin Developer License +4.0 (CVDLv4). + + +For the full License, see . diff --git a/vaadin-testbench-unit/src/main/java/com/vaadin/testbench/unit/SpringUIUnitTest.java b/vaadin-testbench-unit-junit5/src/main/java/com/vaadin/testbench/unit/SpringUIUnitTest.java similarity index 99% rename from vaadin-testbench-unit/src/main/java/com/vaadin/testbench/unit/SpringUIUnitTest.java rename to vaadin-testbench-unit-junit5/src/main/java/com/vaadin/testbench/unit/SpringUIUnitTest.java index 17f18819a..52474672d 100644 --- a/vaadin-testbench-unit/src/main/java/com/vaadin/testbench/unit/SpringUIUnitTest.java +++ b/vaadin-testbench-unit-junit5/src/main/java/com/vaadin/testbench/unit/SpringUIUnitTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.testbench.unit; import java.util.Set; diff --git a/vaadin-testbench-unit/src/main/java/com/vaadin/testbench/unit/TreeOnFailureExtension.java b/vaadin-testbench-unit-junit5/src/main/java/com/vaadin/testbench/unit/TreeOnFailureExtension.java similarity index 99% rename from vaadin-testbench-unit/src/main/java/com/vaadin/testbench/unit/TreeOnFailureExtension.java rename to vaadin-testbench-unit-junit5/src/main/java/com/vaadin/testbench/unit/TreeOnFailureExtension.java index 66a812e0b..1ddb32bad 100644 --- a/vaadin-testbench-unit/src/main/java/com/vaadin/testbench/unit/TreeOnFailureExtension.java +++ b/vaadin-testbench-unit-junit5/src/main/java/com/vaadin/testbench/unit/TreeOnFailureExtension.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/main/java/com/vaadin/testbench/unit/UIUnitTest.java b/vaadin-testbench-unit-junit5/src/main/java/com/vaadin/testbench/unit/UIUnitTest.java similarity index 100% rename from vaadin-testbench-unit/src/main/java/com/vaadin/testbench/unit/UIUnitTest.java rename to vaadin-testbench-unit-junit5/src/main/java/com/vaadin/testbench/unit/UIUnitTest.java diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/example/SingleParam.java b/vaadin-testbench-unit-junit5/src/test/java/com/example/SingleParam.java new file mode 100644 index 000000000..11b4ec5ac --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/example/SingleParam.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.example; + +import com.vaadin.flow.component.Component; +import com.vaadin.flow.component.Tag; +import com.vaadin.flow.router.BeforeEvent; +import com.vaadin.flow.router.HasUrlParameter; +import com.vaadin.flow.router.Route; + +@Route("param") +@Tag("div") +public class SingleParam extends Component implements HasUrlParameter { + public String parameter; + + @Override + public void setParameter(BeforeEvent event, String parameter) { + this.parameter = parameter; + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/example/TemplatedParam.java b/vaadin-testbench-unit-junit5/src/test/java/com/example/TemplatedParam.java new file mode 100644 index 000000000..38008351d --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/example/TemplatedParam.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.example; + +import com.vaadin.flow.component.Component; +import com.vaadin.flow.component.Tag; +import com.vaadin.flow.router.BeforeEnterEvent; +import com.vaadin.flow.router.BeforeEnterObserver; +import com.vaadin.flow.router.Route; + +@Route("template/:param") +@Tag("div") +public class TemplatedParam extends Component implements BeforeEnterObserver { + public String parameter; + + @Override + public void beforeEnter(BeforeEnterEvent event) { + parameter = event.getRouteParameters().get("param").get(); + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/example/base/ErrorView.java b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/ErrorView.java new file mode 100644 index 000000000..9e37bb9d2 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/ErrorView.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.example.base; + +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.BeforeEnterEvent; +import com.vaadin.flow.router.ErrorParameter; +import com.vaadin.flow.router.HasErrorParameter; +import com.vaadin.flow.router.NotFoundException; + +public class ErrorView extends VerticalLayout + implements HasErrorParameter { + @Override + public int setErrorParameter(BeforeEnterEvent event, + ErrorParameter parameter) { + if (parameter.getException() instanceof NotFoundException) { + throw (NotFoundException) parameter.getException(); + } + throw new RuntimeException(parameter.getCaughtException()); + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/example/base/HelloWorldView.java b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/HelloWorldView.java new file mode 100644 index 000000000..9a77dbdf9 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/HelloWorldView.java @@ -0,0 +1,21 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.example.base; + +import com.vaadin.flow.component.button.Button; +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.Route; + +@Route("helloworld") +public class HelloWorldView extends VerticalLayout { + public HelloWorldView() { + add(new Button("Hello, World!")); + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/example/base/ParametrizedView.java b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/ParametrizedView.java new file mode 100644 index 000000000..a1c8745d1 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/ParametrizedView.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.example.base; + +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.BeforeEvent; +import com.vaadin.flow.router.HasUrlParameter; +import com.vaadin.flow.router.QueryParameters; +import com.vaadin.flow.router.Route; + +@Route("params") +public class ParametrizedView extends VerticalLayout + implements HasUrlParameter { + + Integer parameter; + QueryParameters qp; + + @Override + public void setParameter(BeforeEvent event, Integer parameter) { + this.parameter = parameter; + qp = event.getLocation().getQueryParameters(); + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/example/base/ParentView.java b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/ParentView.java new file mode 100644 index 000000000..cf295ba7f --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/ParentView.java @@ -0,0 +1,18 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.example.base; + +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.RoutePrefix; +import com.vaadin.flow.router.RouterLayout; + +@RoutePrefix("parent") +public class ParentView extends VerticalLayout implements RouterLayout { +} diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/example/base/WelcomeView.java b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/WelcomeView.java new file mode 100644 index 000000000..6ff7a0fcf --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/WelcomeView.java @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.example.base; + +import com.vaadin.flow.component.Text; +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.Route; +import com.vaadin.flow.router.RouteAlias; +import com.vaadin.flow.server.PWA; + +@Route("welcome") +@RouteAlias("") +@PWA(name = "My Foo PWA", shortName = "Foo PWA") +public class WelcomeView extends VerticalLayout { + public WelcomeView() { + setWidth(null); + add(new Text("Welcome!")); + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/example/base/child/ChildView.java b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/child/ChildView.java new file mode 100644 index 000000000..bbcb2ec18 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/child/ChildView.java @@ -0,0 +1,20 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.example.base.child; + +import com.example.base.ParentView; + +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.Route; + +@Route(value = "child", layout = ParentView.class) +public class ChildView extends VerticalLayout { + +} diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/example/base/navigation/NavigationPostponeView.java b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/navigation/NavigationPostponeView.java new file mode 100644 index 000000000..b5c3c2052 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/example/base/navigation/NavigationPostponeView.java @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.example.base.navigation; + +import com.vaadin.flow.component.button.Button; +import com.vaadin.flow.component.dialog.Dialog; +import com.vaadin.flow.component.html.Span; +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.BeforeLeaveEvent; +import com.vaadin.flow.router.BeforeLeaveObserver; +import com.vaadin.flow.router.Route; + +@Route("navigation-postpone") +public class NavigationPostponeView extends VerticalLayout + implements BeforeLeaveObserver { + @Override + public void beforeLeave(BeforeLeaveEvent event) { + BeforeLeaveEvent.ContinueNavigationAction action = event.postpone(); + Dialog dialog = new Dialog(); + dialog.add(new Span( + "Are you sure you want to leave such a beautiful view?"), + new Button("Yes", ev -> { + action.proceed(); + dialog.close(); + }), new Button("No", ev -> dialog.close())); + dialog.open(); + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/testapp/MyRouteNotFoundError.java b/vaadin-testbench-unit-junit5/src/test/java/com/testapp/MyRouteNotFoundError.java new file mode 100644 index 000000000..ba7543c48 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/testapp/MyRouteNotFoundError.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.testapp; + +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.router.BeforeEnterEvent; +import com.vaadin.flow.router.ErrorParameter; +import com.vaadin.flow.router.HasErrorParameter; +import com.vaadin.flow.router.NotFoundException; + +/** + * Having an app-custom [NotFoundException] handler should not crash the mocking + * process: https://github.com/mvysny/karibu-testing/issues/50 + */ +public class MyRouteNotFoundError extends VerticalLayout + implements HasErrorParameter { + @Override + public int setErrorParameter(BeforeEnterEvent event, + ErrorParameter parameter) { + throw new RuntimeException(parameter.getException()); + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/testapp/security/LoginView.java b/vaadin-testbench-unit-junit5/src/test/java/com/testapp/security/LoginView.java new file mode 100644 index 000000000..6250cddb0 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/testapp/security/LoginView.java @@ -0,0 +1,20 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.testapp.security; + +import com.vaadin.flow.component.Component; +import com.vaadin.flow.component.HasComponents; +import com.vaadin.flow.component.Tag; +import com.vaadin.flow.router.Route; + +@Tag("div") +@Route(value = "login", registerAtStartup = false) +public class LoginView extends Component implements HasComponents { +} diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/testapp/security/ProtectedView.java b/vaadin-testbench-unit-junit5/src/test/java/com/testapp/security/ProtectedView.java new file mode 100644 index 000000000..aa38a57ff --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/testapp/security/ProtectedView.java @@ -0,0 +1,23 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.testapp.security; + +import jakarta.annotation.security.PermitAll; + +import com.vaadin.flow.component.Component; +import com.vaadin.flow.component.HasComponents; +import com.vaadin.flow.component.Tag; +import com.vaadin.flow.router.Route; + +@Tag("div") +@Route(value = "", registerAtStartup = false) +@PermitAll +public class ProtectedView extends Component implements HasComponents { +} diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/accordion/AccordionTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/accordion/AccordionTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/accordion/AccordionTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/accordion/AccordionTesterTest.java index 76d95f8b4..9a3684d2b 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/accordion/AccordionTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/accordion/AccordionTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/accordion/AccordionView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/accordion/AccordionView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/accordion/AccordionView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/accordion/AccordionView.java index 81207731a..f3a5355fb 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/accordion/AccordionView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/accordion/AccordionView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/button/ButtonTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/button/ButtonTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/button/ButtonTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/button/ButtonTesterTest.java index cfc91f016..d433066f4 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/button/ButtonTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/button/ButtonTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/button/ButtonView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/button/ButtonView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/button/ButtonView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/button/ButtonView.java index d6aade08b..5c1d59dd7 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/button/ButtonView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/button/ButtonView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/charts/ChartTesterSeriesValueTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/charts/ChartTesterSeriesValueTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/charts/ChartTesterSeriesValueTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/charts/ChartTesterSeriesValueTest.java index b9527730b..d501297f2 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/charts/ChartTesterSeriesValueTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/charts/ChartTesterSeriesValueTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.charts; import java.util.ArrayList; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/charts/ChartTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/charts/ChartTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/charts/ChartTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/charts/ChartTesterTest.java index ce6e36a99..e3c77b816 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/charts/ChartTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/charts/ChartTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.charts; import java.util.List; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/charts/ColumnChartView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/charts/ColumnChartView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/charts/ColumnChartView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/charts/ColumnChartView.java index 3d21e69cf..b686d77f1 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/charts/ColumnChartView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/charts/ColumnChartView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.charts; import com.vaadin.flow.component.Component; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/checkbox/CheckboxGroupTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/checkbox/CheckboxGroupTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/checkbox/CheckboxGroupTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/checkbox/CheckboxGroupTesterTest.java index 5e74e4c9d..cfe156795 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/checkbox/CheckboxGroupTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/checkbox/CheckboxGroupTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.checkbox; import java.util.Collection; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/checkbox/CheckboxTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/checkbox/CheckboxTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/checkbox/CheckboxTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/checkbox/CheckboxTesterTest.java index c08bb91f1..a29015aac 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/checkbox/CheckboxTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/checkbox/CheckboxTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.checkbox; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/checkbox/CheckboxView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/checkbox/CheckboxView.java similarity index 98% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/checkbox/CheckboxView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/checkbox/CheckboxView.java index 49dca77f9..446acecc0 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/checkbox/CheckboxView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/checkbox/CheckboxView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,11 +7,9 @@ * * For the full License, see . */ - package com.vaadin.flow.component.checkbox; import java.util.LinkedHashMap; -import java.util.List; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/combobox/ComboBoxTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/combobox/ComboBoxTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/combobox/ComboBoxTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/combobox/ComboBoxTesterTest.java index d8882a4af..4c40fb44b 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/combobox/ComboBoxTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/combobox/ComboBoxTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/combobox/ComboBoxView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/combobox/ComboBoxView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/combobox/ComboBoxView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/combobox/ComboBoxView.java index 65d33f907..de76ac4d8 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/combobox/ComboBoxView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/combobox/ComboBoxView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogTesterTest.java index 0b34b417f..4731ffa09 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogView.java index a7eb24f2d..4e305ec82 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/confirmdialog/ConfirmDialogView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuTesterTest.java index 7658b6591..8a6f4c081 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.contextmenu; import java.util.List; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuView.java index fe2df5971..5acfc5b6f 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/contextmenu/ContextMenuView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.contextmenu; import java.util.ArrayList; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/datepicker/DatePickerTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/datepicker/DatePickerTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/datepicker/DatePickerTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/datepicker/DatePickerTesterTest.java index 4b3de0d15..135ae6b3e 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/datepicker/DatePickerTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/datepicker/DatePickerTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/datepicker/DatePickerView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/datepicker/DatePickerView.java similarity index 90% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/datepicker/DatePickerView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/datepicker/DatePickerView.java index f2bdea365..063cfc464 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/datepicker/DatePickerView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/datepicker/DatePickerView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -12,7 +12,6 @@ import com.vaadin.flow.component.Component; import com.vaadin.flow.component.HasComponents; import com.vaadin.flow.component.Tag; -import com.vaadin.flow.component.datetimepicker.DateTimePicker; import com.vaadin.flow.router.Route; @Tag("div") diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerTesterTest.java index 7be4a1fc1..cc8da019e 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerView.java index 1ad9e626a..c21a0483f 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/datetimepicker/DateTimePickerView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/details/DetailsTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/details/DetailsTesterTest.java similarity index 98% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/details/DetailsTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/details/DetailsTesterTest.java index ba83b339b..04ea52a64 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/details/DetailsTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/details/DetailsTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.details; import java.util.ArrayList; @@ -19,7 +18,6 @@ import org.junit.jupiter.api.Test; import com.vaadin.flow.router.RouteConfiguration; -import com.vaadin.testbench.unit.ComponentTester; import com.vaadin.testbench.unit.UIUnitTest; import com.vaadin.testbench.unit.ViewPackages; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/details/DetailsView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/details/DetailsView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/details/DetailsView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/details/DetailsView.java index b6ddcc947..025bc7c54 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/details/DetailsView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/details/DetailsView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.details; import com.vaadin.flow.component.Component; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/dialog/DialogTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/dialog/DialogTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/dialog/DialogTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/dialog/DialogTesterTest.java index bf534c2a5..2e20d2a47 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/dialog/DialogTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/dialog/DialogTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/dialog/DialogView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/dialog/DialogView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/dialog/DialogView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/dialog/DialogView.java index 438d1cc1c..c9d66ff25 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/dialog/DialogView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/dialog/DialogView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/Address.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/Address.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/Address.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/Address.java index ccea00a68..b774ff9d5 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/Address.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/Address.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/BasicGridTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/BasicGridTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/BasicGridTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/BasicGridTesterTest.java index 824bebc8a..fd2acc05d 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/BasicGridTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/BasicGridTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/BasicGridView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/BasicGridView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/BasicGridView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/BasicGridView.java index 63789c644..1015f49e3 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/BasicGridView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/BasicGridView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/BeanGridTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/BeanGridTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/BeanGridTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/BeanGridTesterTest.java index 2d3fd52f9..0607792c6 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/BeanGridTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/BeanGridTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/BeanGridView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/BeanGridView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/BeanGridView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/BeanGridView.java index a87bdaeac..7856b4d3b 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/BeanGridView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/BeanGridView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/CheckBox.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/CheckBox.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/CheckBox.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/CheckBox.java index 9d09b67e3..da4b8b0b1 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/CheckBox.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/CheckBox.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/Country.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/Country.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/Country.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/Country.java index 4f1195604..987b60b82 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/Country.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/Country.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/GetTextCellRendererTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/GetTextCellRendererTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/GetTextCellRendererTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/GetTextCellRendererTest.java index 6ba448f2c..d0b3af017 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/GetTextCellRendererTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/GetTextCellRendererTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.grid; import org.junit.jupiter.api.Assertions; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/GridTesterSortTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/GridTesterSortTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/GridTesterSortTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/GridTesterSortTest.java index fe34ddf72..3c0ebaf9d 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/GridTesterSortTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/GridTesterSortTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.grid; import java.util.ArrayList; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/Person.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/Person.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/Person.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/Person.java index c44596530..5f60cb928 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/Person.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/Person.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/RendererGridView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/RendererGridView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/RendererGridView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/RendererGridView.java index 85d42bcf3..9209755a0 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/RendererGridView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/RendererGridView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.grid; import com.vaadin.flow.component.Component; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/SortGridView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/SortGridView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/SortGridView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/SortGridView.java index 06f438ed0..f53474e34 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/grid/SortGridView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/grid/SortGridView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/html/testbench/AnchorTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/html/testbench/AnchorTesterTest.java similarity index 97% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/html/testbench/AnchorTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/html/testbench/AnchorTesterTest.java index 622ec0a6f..ea73ea2a2 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/html/testbench/AnchorTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/html/testbench/AnchorTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -23,7 +23,7 @@ import com.vaadin.testbench.unit.UIUnitTest; import com.vaadin.testbench.unit.ViewPackages; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertThrows; @ViewPackages class AnchorTesterTest extends UIUnitTest { diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/html/testbench/AnchorView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/html/testbench/AnchorView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/html/testbench/AnchorView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/html/testbench/AnchorView.java index f13654a2c..21da2f4d9 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/html/testbench/AnchorView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/html/testbench/AnchorView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/listbox/ListBoxTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/listbox/ListBoxTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/listbox/ListBoxTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/listbox/ListBoxTesterTest.java index 4099b2760..298e6d3d7 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/listbox/ListBoxTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/listbox/ListBoxTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/listbox/ListBoxView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/listbox/ListBoxView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/listbox/ListBoxView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/listbox/ListBoxView.java index 0f11253c7..6203c84b1 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/listbox/ListBoxView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/listbox/ListBoxView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/listbox/MultiSelectListBoxTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/listbox/MultiSelectListBoxTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/listbox/MultiSelectListBoxTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/listbox/MultiSelectListBoxTesterTest.java index 056368727..61069c395 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/listbox/MultiSelectListBoxTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/listbox/MultiSelectListBoxTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/login/LoginFormTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/login/LoginFormTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/login/LoginFormTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/login/LoginFormTesterTest.java index 338c949bc..c9ddd4abf 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/login/LoginFormTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/login/LoginFormTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/login/LoginFormView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/login/LoginFormView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/login/LoginFormView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/login/LoginFormView.java index af4f413ed..df24476ff 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/login/LoginFormView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/login/LoginFormView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/login/LoginOverlayTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/login/LoginOverlayTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/login/LoginOverlayTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/login/LoginOverlayTesterTest.java index da8c3ec4c..de19ea0c9 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/login/LoginOverlayTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/login/LoginOverlayTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/login/LoginOverlayView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/login/LoginOverlayView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/login/LoginOverlayView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/login/LoginOverlayView.java index cfbdda637..fbabedd59 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/login/LoginOverlayView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/login/LoginOverlayView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/menubar/MenuBarTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/menubar/MenuBarTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/menubar/MenuBarTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/menubar/MenuBarTesterTest.java index 1c0ab3ce8..9059ae7cf 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/menubar/MenuBarTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/menubar/MenuBarTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.menubar; import java.util.List; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/menubar/MenuBarView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/menubar/MenuBarView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/menubar/MenuBarView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/menubar/MenuBarView.java index abf6fed8a..c35feef07 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/menubar/MenuBarView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/menubar/MenuBarView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.menubar; import java.util.ArrayList; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/messages/MessageInputTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/messages/MessageInputTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/messages/MessageInputTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/messages/MessageInputTesterTest.java index 461ca0a76..8246e91d8 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/messages/MessageInputTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/messages/MessageInputTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/messages/MessageListTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/messages/MessageListTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/messages/MessageListTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/messages/MessageListTesterTest.java index bf68e3ced..80692612e 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/messages/MessageListTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/messages/MessageListTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/messages/MessagesView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/messages/MessagesView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/messages/MessagesView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/messages/MessagesView.java index 3c02f37ad..6394a8731 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/messages/MessagesView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/messages/MessagesView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/notification/NotificationTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/notification/NotificationTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/notification/NotificationTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/notification/NotificationTesterTest.java index 99f3aad6c..adeba3c7c 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/notification/NotificationTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/notification/NotificationTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/notification/NotificationView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/notification/NotificationView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/notification/NotificationView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/notification/NotificationView.java index 31e5d00ae..3e6dab0b3 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/notification/NotificationView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/notification/NotificationView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.notification; import com.vaadin.flow.component.Component; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonGroupTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonGroupTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonGroupTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonGroupTesterTest.java index 5806ff80c..60e8154e3 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonGroupTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonGroupTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonTesterTest.java index 1abccd79f..d49f438bc 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.radiobutton; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonView.java index 3354f9c65..e01697dc2 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/radiobutton/RadioButtonView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.radiobutton; import java.util.List; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/select/SelectTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/select/SelectTesterTest.java similarity index 97% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/select/SelectTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/select/SelectTesterTest.java index 96d0691c5..3fec0939b 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/select/SelectTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/select/SelectTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -17,7 +17,7 @@ import com.vaadin.testbench.unit.UIUnitTest; import com.vaadin.testbench.unit.ViewPackages; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertIterableEquals; @ViewPackages class SelectTesterTest extends UIUnitTest { diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/select/SelectView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/select/SelectView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/select/SelectView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/select/SelectView.java index a53009e8c..990347cc4 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/select/SelectView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/select/SelectView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/tabs/TabsTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/tabs/TabsTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/tabs/TabsTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/tabs/TabsTesterTest.java index 6245c2892..c4d48813a 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/tabs/TabsTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/tabs/TabsTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.tabs; import java.util.concurrent.atomic.AtomicReference; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/tabs/TabsView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/tabs/TabsView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/tabs/TabsView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/tabs/TabsView.java index 673f81803..b2e763990 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/tabs/TabsView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/tabs/TabsView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.tabs; import com.vaadin.flow.component.Component; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/NumberFieldTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/NumberFieldTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/NumberFieldTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/NumberFieldTesterTest.java index 0d2168515..a9978c08f 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/NumberFieldTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/NumberFieldTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/NumberFieldView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/NumberFieldView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/NumberFieldView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/NumberFieldView.java index 636330bc2..d2acc0b67 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/NumberFieldView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/NumberFieldView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/TextAreaTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/TextAreaTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/TextAreaTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/TextAreaTesterTest.java index 93165fcc5..6016de510 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/TextAreaTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/TextAreaTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/TextAreaView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/TextAreaView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/TextAreaView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/TextAreaView.java index 51ec199fb..db68bcc86 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/TextAreaView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/TextAreaView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/TextFieldTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/TextFieldTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/TextFieldTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/TextFieldTesterTest.java index 27a07b067..78d41d03f 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/TextFieldTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/TextFieldTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/TextFieldView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/TextFieldView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/TextFieldView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/TextFieldView.java index db630db1e..1220d1ac5 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/textfield/TextFieldView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/textfield/TextFieldView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/timepicker/TimePickerTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/timepicker/TimePickerTesterTest.java similarity index 96% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/timepicker/TimePickerTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/timepicker/TimePickerTesterTest.java index 249ad4d50..00dca4b65 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/timepicker/TimePickerTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/timepicker/TimePickerTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -22,7 +22,7 @@ import com.vaadin.testbench.unit.UIUnitTest; import com.vaadin.testbench.unit.ViewPackages; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertThrows; @ViewPackages class TimePickerWrapTest extends UIUnitTest { diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/timepicker/TimePickerView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/timepicker/TimePickerView.java similarity index 90% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/timepicker/TimePickerView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/timepicker/TimePickerView.java index d941d3b58..d2cc77e19 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/timepicker/TimePickerView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/timepicker/TimePickerView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -12,7 +12,6 @@ import com.vaadin.flow.component.Component; import com.vaadin.flow.component.HasComponents; import com.vaadin.flow.component.Tag; -import com.vaadin.flow.component.datetimepicker.DateTimePicker; import com.vaadin.flow.router.Route; @Tag("div") diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/upload/UploadTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/upload/UploadTesterTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/upload/UploadTesterTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/upload/UploadTesterTest.java index a8aaceb73..f5c6a73f8 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/upload/UploadTesterTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/upload/UploadTesterTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.upload; import java.io.File; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/upload/UploadView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/upload/UploadView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/upload/UploadView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/upload/UploadView.java index 29ef6294a..746d91ef8 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/flow/component/upload/UploadView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/flow/component/upload/UploadView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.flow.component.upload; import com.vaadin.flow.component.Component; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/ComponentQueryTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/ComponentQueryTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/ComponentQueryTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/ComponentQueryTest.java index 09d99169f..13b19c302 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/ComponentQueryTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/ComponentQueryTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/ComponentTesterTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/ComponentTesterTest.java new file mode 100644 index 000000000..a69c34c9a --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/ComponentTesterTest.java @@ -0,0 +1,241 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.vaadin.testbench.unit; + +import java.util.List; +import java.util.Optional; + +import com.example.base.WelcomeView; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import com.vaadin.flow.component.Component; +import com.vaadin.flow.component.HasComponents; +import com.vaadin.flow.component.HasElement; +import com.vaadin.flow.component.HasText; +import com.vaadin.flow.component.Tag; + +@ViewPackages(packages = "com.example") +public class ComponentTesterTest extends UIUnitTest { + + private WelcomeView home; + + @BeforeEach + public void initHome() { + home = getHome(); + } + + @Test + public void canGetWrapperForView_viewIsUsable() { + final ComponentTester home_ = test(home); + Assertions.assertTrue(home_.isUsable(), + "Home should be visible and interactable"); + } + + @Test + public void componentIsDisabled_isUsableReturnsFalse() { + home.getElement().setEnabled(false); + + final ComponentTester home_ = test(home); + Assertions.assertFalse(home_.isUsable(), + "Home should be visible but not interactable"); + } + + @Test + public void componentIsHidden_isUsableReturnsFalse() { + home.setVisible(false); + + final ComponentTester home_ = test(home); + Assertions.assertFalse(home_.isUsable(), + "Home should not be interactable when component is not visible"); + } + + @Test + public void componentModality_componentIsUsableReturnsCorrectly() { + final ComponentTester home_ = test(home); + + final Span span = new Span(); + home.add(span); + final ComponentTester span_ = test(span); + + Assertions.assertTrue(span_.isUsable(), + "Span should be attached to the ui"); + + span_.setModal(true); + + Assertions.assertTrue(span_.isUsable(), + "Span should interactable when it is modal"); + Assertions.assertFalse(home_.isUsable(), + "Home should not be interactable when Span is modal"); + + span_.setModal(false); + + Assertions.assertTrue(home_.isUsable(), + "Home should be interactable when Span is not modal"); + } + + @Test + public void componentModality_modalityDropsOnComponentRemoval() { + final ComponentTester home_ = test(home); + + final Span span = new Span(); + home.add(span); + final ComponentTester span_ = test(span); + + Assertions.assertTrue(span_.isUsable(), + "Span should be attached to the ui"); + + span_.setModal(true); + + Assertions.assertTrue(span_.isUsable(), + "Span should be interactable when it is modal"); + Assertions.assertFalse(home_.isUsable(), + "Home should not be interactable when Span is modal"); + + home.remove(span); + + Assertions.assertTrue(home_.isUsable(), + "Home should be interactable when Span is removed"); + } + + @Test + public void parentNotVisible_childIsNotInteractable() { + final Span span = new Span(); + home.add(span); + final ComponentTester span_ = test(span); + + Assertions.assertTrue(span_.isUsable(), + "Span should be attached to the ui"); + + home.setVisible(false); + + Assertions.assertFalse(span_.isUsable(), + "Span should not be interactable when parent is hidden"); + } + + @Test + public void nonAttachedComponent_isNotInteractable() { + Span span = new Span(); + + ComponentTester span_ = test(span); + + Assertions.assertFalse(span_.isUsable(), + "Span is not attached so it is not usable."); + } + + @Test + void findByQuery_matchingComponent_getsComponent() { + Span one = new Span("One"); + Span two = new Span("Two"); + Div container = new Div(new Div(new Div(one)), new Div(two), new Div()); + + ComponentTester
wrapper_ = test(container); + + Optional result = wrapper_.findByQuery(Span.class, + query -> query.withText("One")); + Assertions.assertTrue(result.isPresent()); + Assertions.assertSame(one, result.get()); + + result = wrapper_.findByQuery(Span.class, + query -> query.withText("Two")); + Assertions.assertTrue(result.isPresent()); + Assertions.assertSame(two, result.get()); + } + + @Test + void findByQuery_notMatchingComponent_empty() { + Span one = new Span("One"); + Span two = new Span("Two"); + Div container = new Div(new Div(new Div(one)), new Div(two), new Div()); + + ComponentTester
wrapper_ = test(container); + + Optional result = wrapper_.findByQuery(Span.class, + query -> query.withText("Three")); + Assertions.assertTrue(result.isEmpty()); + } + + @Test + void findByQuery_multipleMatchingComponents_throws() { + Span one = new Span("Span One"); + Span two = new Span("Span Two"); + Div container = new Div(new Div(new Div(one)), new Div(two), new Div()); + + ComponentTester
wrapper_ = test(container); + + Assertions.assertThrows(IllegalArgumentException.class, + () -> wrapper_.findByQuery(Span.class, + query -> query.withTextContaining("Span"))); + } + + @Test + void findAllByQuery_matchingComponent_getsComponents() { + Span one = new Span("Span One"); + Span two = new Span("Span Two"); + Span three = new Span("Span Two bis"); + Div container = new Div(new Div(new Div(one)), new Div(two), + new Div(three)); + + ComponentTester
wrapper_ = test(container); + + List result = wrapper_.findAllByQuery(Span.class, + query -> query.withTextContaining("One")); + Assertions.assertIterableEquals(List.of(one), result); + + result = wrapper_.findAllByQuery(Span.class, + query -> query.withTextContaining("Two")); + Assertions.assertIterableEquals(List.of(two, three), result); + + result = wrapper_.findAllByQuery(Span.class, + query -> query.withTextContaining("Span")); + Assertions.assertIterableEquals(List.of(one, two, three), result); + } + + @Test + void findAllByQuery_notMatchingComponent_empty() { + Span one = new Span("Span One"); + Span two = new Span("Span Two"); + Span three = new Span("Span Two bis"); + Div container = new Div(new Div(new Div(one)), new Div(two), + new Div(three)); + + ComponentTester
wrapper_ = test(container); + + List result = wrapper_.findAllByQuery(Span.class, + query -> query.withTextContaining("Three")); + Assertions.assertTrue(result.isEmpty()); + } + + private WelcomeView getHome() { + final HasElement view = getCurrentView(); + Assertions.assertTrue(view instanceof WelcomeView, + "Home should be navigated to by default"); + return (WelcomeView) view; + } + + @Tag("span") + public static class Span extends Component implements HasText { + public Span() { + } + + public Span(String text) { + setText(text); + } + } + + @Tag("div") + public static class Div extends Component implements HasComponents { + public Div(Component... components) { + add(components); + } + } + +} diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/ElementConditionsTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/ElementConditionsTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/ElementConditionsTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/ElementConditionsTest.java index 76acd1639..ff2f158d8 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/ElementConditionsTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/ElementConditionsTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.testbench.unit; import org.junit.jupiter.api.Assertions; @@ -18,7 +17,6 @@ import com.vaadin.flow.component.HasText; import com.vaadin.flow.component.Html; import com.vaadin.flow.component.HtmlComponent; -import com.vaadin.flow.component.HtmlContainer; import com.vaadin.flow.component.Tag; import com.vaadin.flow.dom.Element; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/NonGenericTestTester.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/NonGenericTestTester.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/NonGenericTestTester.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/NonGenericTestTester.java index 247c3ce8e..5e8bfcadd 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/NonGenericTestTester.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/NonGenericTestTester.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/SecurityTestConfig.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/SecurityTestConfig.java new file mode 100644 index 000000000..ba40e8414 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/SecurityTestConfig.java @@ -0,0 +1,68 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.vaadin.testbench.unit; + +import java.util.List; +import java.util.UUID; + +import com.testapp.security.LoginView; +import com.testapp.security.ProtectedView; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; + +import com.vaadin.flow.router.RouteConfiguration; +import com.vaadin.flow.server.VaadinServiceInitListener; +import com.vaadin.flow.server.auth.ViewAccessChecker; + +// Empty configuration class used only to be able to bootstrap spring +// ApplicationContext +@Configuration +class SecurityTestConfig { + + // Registers test views and view access checker for testing purpose + @Bean + VaadinServiceInitListener setupViewSecurityScenario() { + return event -> { + RouteConfiguration routeConfiguration = RouteConfiguration + .forApplicationScope(); + routeConfiguration.setAnnotatedRoute(LoginView.class); + routeConfiguration.setAnnotatedRoute(ProtectedView.class); + event.getSource().addUIInitListener(uiEvent -> { + ViewAccessChecker viewAccessChecker = new ViewAccessChecker(); + viewAccessChecker.setLoginView(LoginView.class); + uiEvent.getUI().addBeforeEnterListener(viewAccessChecker); + }); + }; + } + + @Bean + UserDetailsService mockUserDetailsService() { + + return new UserDetailsService() { + @Override + public UserDetails loadUserByUsername(String username) + throws UsernameNotFoundException { + if ("user".equals(username)) { + return new User(username, UUID.randomUUID().toString(), + List.of(new SimpleGrantedAuthority( + "ROLE_SUPERUSER"), + new SimpleGrantedAuthority("ROLE_DEV"))); + } + throw new UsernameNotFoundException( + "User " + username + " not exists"); + } + }; + } +} diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/SpringUIUnitBaseClassTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/SpringUIUnitBaseClassTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/SpringUIUnitBaseClassTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/SpringUIUnitBaseClassTest.java index 9fbe66b4b..af497923e 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/SpringUIUnitBaseClassTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/SpringUIUnitBaseClassTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.testbench.unit; import org.junit.jupiter.api.Assertions; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/SpringUnitSecurityTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/SpringUnitSecurityTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/SpringUnitSecurityTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/SpringUnitSecurityTest.java index d5ddc95ed..7370c92c0 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/SpringUnitSecurityTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/SpringUnitSecurityTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.testbench.unit; import java.security.Principal; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/TestComponent.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TestComponent.java similarity index 98% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/TestComponent.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TestComponent.java index 0233707d6..b145d0883 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/TestComponent.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TestComponent.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/TestComponentForConcreteTester.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TestComponentForConcreteTester.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/TestComponentForConcreteTester.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TestComponentForConcreteTester.java index 6454922e3..f0c2833ca 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/TestComponentForConcreteTester.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TestComponentForConcreteTester.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TestCustomInstantiatorFactory.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TestCustomInstantiatorFactory.java new file mode 100644 index 000000000..5924a1e7c --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TestCustomInstantiatorFactory.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.vaadin.testbench.unit; + +import com.vaadin.flow.di.DefaultInstantiator; +import com.vaadin.flow.di.Instantiator; +import com.vaadin.flow.di.InstantiatorFactory; +import com.vaadin.flow.server.VaadinService; + +/** + * A custom {@link InstantiatorFactory} to test + * {@link com.vaadin.flow.di.Lookup} initialization. + */ +public class TestCustomInstantiatorFactory implements InstantiatorFactory { + + @Override + public Instantiator createInstantitor(VaadinService vaadinService) { + return new DefaultInstantiator(vaadinService); + } +} diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/TestTester.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TestTester.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/TestTester.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TestTester.java index fe74928fb..db60767a7 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/TestTester.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TestTester.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/TesterResolutionTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TesterResolutionTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/TesterResolutionTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TesterResolutionTest.java index 6487bd591..568a65953 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/TesterResolutionTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/TesterResolutionTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/UIUnitBaseClassTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/UIUnitBaseClassTest.java similarity index 70% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/UIUnitBaseClassTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/UIUnitBaseClassTest.java index 0fa9610d8..a4b0a216b 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/UIUnitBaseClassTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/UIUnitBaseClassTest.java @@ -10,21 +10,17 @@ package com.vaadin.testbench.unit; import java.util.HashSet; -import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import com.example.SingleParam; import com.example.TemplatedParam; -import com.example.base.ParametrizedView; import com.example.base.WelcomeView; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.function.Executable; import com.vaadin.flow.component.Component; -import com.vaadin.flow.component.Key; import com.vaadin.flow.component.UI; import com.vaadin.flow.di.InstantiatorFactory; import com.vaadin.flow.di.Lookup; @@ -106,48 +102,48 @@ void customService_availableInLookup() { } } - @Nested - class WrongBaseClassTest extends UIUnit4Test { - - @Test - void navigate_fails() { - assertExecutionFails(() -> navigate(WelcomeView.class)); - assertExecutionFails(() -> navigate("welcome", WelcomeView.class)); - assertExecutionFails(() -> navigate(ParametrizedView.class, 12)); - assertExecutionFails( - () -> navigate(ParametrizedView.class, Map.of())); - } - - @Test - void getCurrentView_fails() { - assertExecutionFails(this::getCurrentView); - } - - @Test - void fireShortcut_fails() { - assertExecutionFails(() -> fireShortcut(Key.ENTER)); - } - - @Test - void wrap_fails() { - assertExecutionFails(() -> test(new ComponentTesterTest.Span())); - assertExecutionFails(() -> test(ComponentTester.class, - new ComponentTesterTest.Span())); - } - - @Test - void query_fails() { - assertExecutionFails(() -> $(Component.class)); - assertExecutionFails( - () -> $(Component.class, new ComponentTesterTest.Span())); - assertExecutionFails(() -> $view(Component.class)); - } - - private void assertExecutionFails(Executable executable) { - UIUnitTestSetupException exception = Assertions - .assertThrows(UIUnitTestSetupException.class, executable); - Assertions.assertTrue(exception.getMessage().contains("JUnit 4")); - } - } + // @Nested + // class WrongBaseClassTest extends UIUnit4Test { + // + // @Test + // void navigate_fails() { + // assertExecutionFails(() -> navigate(WelcomeView.class)); + // assertExecutionFails(() -> navigate("welcome", WelcomeView.class)); + // assertExecutionFails(() -> navigate(ParametrizedView.class, 12)); + // assertExecutionFails( + // () -> navigate(ParametrizedView.class, Map.of())); + // } + // + // @Test + // void getCurrentView_fails() { + // assertExecutionFails(this::getCurrentView); + // } + // + // @Test + // void fireShortcut_fails() { + // assertExecutionFails(() -> fireShortcut(Key.ENTER)); + // } + // + // @Test + // void wrap_fails() { + // assertExecutionFails(() -> test(new ComponentTesterTest.Span())); + // assertExecutionFails(() -> test(ComponentTester.class, + // new ComponentTesterTest.Span())); + // } + // + // @Test + // void query_fails() { + // assertExecutionFails(() -> $(Component.class)); + // assertExecutionFails( + // () -> $(Component.class, new ComponentTesterTest.Span())); + // assertExecutionFails(() -> $view(Component.class)); + // } + // + // private void assertExecutionFails(Executable executable) { + // UIUnitTestSetupException exception = Assertions + // .assertThrows(UIUnitTestSetupException.class, executable); + // Assertions.assertTrue(exception.getMessage().contains("JUnit 4")); + // } + // } } diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/UIUnitNavigationTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/UIUnitNavigationTest.java similarity index 92% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/UIUnitNavigationTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/UIUnitNavigationTest.java index d6e723806..8ac96a015 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/UIUnitNavigationTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/UIUnitNavigationTest.java @@ -1,3 +1,12 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ package com.vaadin.testbench.unit; import java.util.Collections; @@ -9,7 +18,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import com.vaadin.flow.router.NotFoundException; import com.vaadin.testbench.unit.internal.MockRouteNotFoundError; @ViewPackages(packages = "com.example") diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/UIUnitShortcutTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/UIUnitShortcutTest.java similarity index 98% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/UIUnitShortcutTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/UIUnitShortcutTest.java index dd14806ae..341713430 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/UIUnitShortcutTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/UIUnitShortcutTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.testbench.unit; import java.util.concurrent.atomic.AtomicInteger; @@ -15,7 +14,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.api.extension.Extensions; import com.vaadin.flow.component.ClickNotifier; import com.vaadin.flow.component.Component; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/DiscoverRoutesInAnnotatedClassPackageTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/DiscoverRoutesInAnnotatedClassPackageTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/DiscoverRoutesInAnnotatedClassPackageTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/DiscoverRoutesInAnnotatedClassPackageTest.java index e7a67f56e..13b46b53a 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/DiscoverRoutesInAnnotatedClassPackageTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/DiscoverRoutesInAnnotatedClassPackageTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.testbench.unit.viewscan.byannotatedclass; import java.util.Set; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/ViewPackagesTestView.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/ViewPackagesTestView.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/ViewPackagesTestView.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/ViewPackagesTestView.java index 479977632..58413b0ac 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/ViewPackagesTestView.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/byannotatedclass/ViewPackagesTestView.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.testbench.unit.viewscan.byannotatedclass; import com.vaadin.flow.component.Component; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/byclasses/DiscoverRoutesInPackageByClassTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/byclasses/DiscoverRoutesInPackageByClassTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/byclasses/DiscoverRoutesInPackageByClassTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/byclasses/DiscoverRoutesInPackageByClassTest.java index 55fe92dfc..05ff0cbf8 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/byclasses/DiscoverRoutesInPackageByClassTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/byclasses/DiscoverRoutesInPackageByClassTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.testbench.unit.viewscan.byclasses; import java.util.Set; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagename/DiscoverRoutesInPackageByNameTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagename/DiscoverRoutesInPackageByNameTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagename/DiscoverRoutesInPackageByNameTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagename/DiscoverRoutesInPackageByNameTest.java index 6a5d71c1d..8f37cb023 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagename/DiscoverRoutesInPackageByNameTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagename/DiscoverRoutesInPackageByNameTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.testbench.unit.viewscan.bypackagename; import java.util.Set; diff --git a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagenameandclass/DiscoverRoutesInPackageByClassAndNameTest.java b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagenameandclass/DiscoverRoutesInPackageByClassAndNameTest.java similarity index 99% rename from vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagenameandclass/DiscoverRoutesInPackageByClassAndNameTest.java rename to vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagenameandclass/DiscoverRoutesInPackageByClassAndNameTest.java index faad8f3d5..cd8d1666c 100644 --- a/vaadin-testbench-unit/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagenameandclass/DiscoverRoutesInPackageByClassAndNameTest.java +++ b/vaadin-testbench-unit-junit5/src/test/java/com/vaadin/testbench/unit/viewscan/bypackagenameandclass/DiscoverRoutesInPackageByClassAndNameTest.java @@ -1,4 +1,4 @@ -/* +/** * Copyright (C) 2022 Vaadin Ltd * * This program is available under Commercial Vaadin Developer License @@ -7,7 +7,6 @@ * * For the full License, see . */ - package com.vaadin.testbench.unit.viewscan.bypackagenameandclass; import java.util.Set; diff --git a/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/TestInitListener.kt b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/TestInitListener.kt new file mode 100644 index 000000000..b87490542 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/TestInitListener.kt @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.vaadin.testbench.unit + +import com.vaadin.flow.server.ServiceInitEvent +import com.vaadin.flow.server.VaadinServiceInitListener + +/** + * This class is picked up automatically by Vaadin (since it's registered via META-INF/services). We then test elsewhere + * that MockVaadin-mocked env indeed picked up this init listener and executed it. + */ +class TestInitListener : VaadinServiceInitListener { + override fun serviceInit(event: ServiceInitEvent) { + serviceInitCalled = true + event.source.addUIInitListener { e -> + uiInitCalled = true + e.ui.addBeforeEnterListener { uiBeforeEnterCalled = true } + } + } + + companion object { + var serviceInitCalled: Boolean = false + var uiInitCalled = false + var uiBeforeEnterCalled = false + fun clearInitFlags() { + serviceInitCalled = false + uiInitCalled = false + uiBeforeEnterCalled = false + } + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/TestUtils.kt b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/TestUtils.kt new file mode 100644 index 000000000..6e93ead42 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/TestUtils.kt @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.vaadin.testbench.unit + +import com.vaadin.testbench.unit.internal.allViews +import kotlin.test.expect + +/** + * Expects that [actual] list of objects matches [expected] list of objects. Fails otherwise. + */ +fun expectList(vararg expected: T, actual: ()->List) { + expect(expected.toList(), actual) +} + +object TestRoutes { + val views = allViews; +} diff --git a/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/AllTests.kt b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/AllTests.kt new file mode 100644 index 000000000..a22dcbe9a --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/AllTests.kt @@ -0,0 +1,74 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.vaadin.testbench.unit.internal + +import com.github.mvysny.dynatest.DynaTest +import java.net.URL +import java.util.* +import kotlin.test.expect + +class AllTests : DynaTest({ + + beforeEach { + // make sure that Validator produces messages in English + Locale.setDefault(Locale.ENGLISH) + } + + test("flow-build-info.json doesn't exist") { + val res: URL? = Thread.currentThread().contextClassLoader.getResource("META-INF/VAADIN/config/flow-build-info.json") + expect(null, "flow-build-info.json exists on the classpath!") { res } + } + + group("Depth First Tree Iterator") { + depthFirstTreeIteratorTests() + } + + group("basic utils") { + basicUtilsTestbatch() + } + + group("Element Utils") { + elementUtilsTests() + } + + group("Component Utils") { + componentUtilsTests() + } + + group("routes test") { + routesTestBatch() + } + + group("mock vaadin") { + mockVaadinTest() + } + + group("pretty print tree") { + prettyPrintTreeTest() + } + + group("locator") { + group("with lifecycle hook testing") { + locatorTest() + } + group("no lifecycle hook testing") { + locatorTest2() + } + } + + group("search spec") { + searchSpecTest() + } + group("shortcuts") { + shortcutsTestBatch() + } + + +}) diff --git a/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/AsyncTest.kt b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/AsyncTest.kt new file mode 100644 index 000000000..3101f3ea5 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/AsyncTest.kt @@ -0,0 +1,152 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.vaadin.testbench.unit.internal + +import com.github.mvysny.dynatest.DynaNodeGroup +import com.github.mvysny.dynatest.expectThrows +import com.vaadin.flow.component.UI +import com.vaadin.flow.server.* +import java.util.concurrent.ExecutionException +import java.util.concurrent.ExecutorService +import java.util.concurrent.Executors +import java.util.concurrent.TimeUnit +import kotlin.test.expect +import kotlin.test.fail + +internal fun DynaNodeGroup.asyncTestbatch() { + group("from UI thread") { + test("calling access() won't throw exception but the block won't be called immediately") { + var checkAccess = true + UI.getCurrent().access { if (checkAccess) fail("Shouldn't be called now") } + checkAccess = false + } + + test("calling accessSynchronously() calls the block immediately because the tests hold UI lock") { + var called = false + UI.getCurrent().accessSynchronously { called = true } + expect(true) { called } + } + + /* TODO: uncomment after importing Locator APIs + test("_get() processes access()") { + var called = false + UI.getCurrent().access { called = true } + expect(false) { called } + _get() + expect(true) { called } + } + */ + + test("clientRoundtrip() processes all access() calls") { + var calledCount = 0 + UI.getCurrent().access(object : Command { + override fun execute() { + if (calledCount < 4) { + calledCount++ + UI.getCurrent().access(this) + } + } + }) + expect(0) { calledCount } + MockVaadin.clientRoundtrip() + expect(4) { calledCount } + } + + test("clientRoundtrip() propagates failures") { + UI.getCurrent().access { throw RuntimeException("simulated") } + expectThrows(ExecutionException::class, "simulated") { + MockVaadin.clientRoundtrip() + } + } + + test("access() has properly mocked instances") { + UI.getCurrent().access { + expect(true) { VaadinSession.getCurrent() != null } + expect(true) { VaadinService.getCurrent() != null } + expect(true) { VaadinRequest.getCurrent() != null } + expect(true) { UI.getCurrent() != null } + expect(true) { VaadinResponse.getCurrent() != null } + } + MockVaadin.clientRoundtrip() + } + + // https://github.com/mvysny/karibu-testing/issues/80 + test("push() does nothing but can be called") { + UI.getCurrent().push() + UI.getCurrent().access { + UI.getCurrent().push() + } + MockVaadin.clientRoundtrip() + UI.getCurrent().accessSynchronously { + UI.getCurrent().push() + } + } + } + group("from bg thread") { + lateinit var executor: ExecutorService + beforeEach { executor = Executors.newCachedThreadPool() } + afterEach { + executor.shutdown() + executor.awaitTermination(4, TimeUnit.SECONDS) + } + fun asyncAwait(block: (UI) -> Unit) { + val ui = UI.getCurrent() + executor.submit { block(ui) } .get() + } + + test("calling access() won't throw exception but the block won't be called immediately because the tests hold UI lock") { + asyncAwait { ui -> + var checkAccess = true + ui.access { if (checkAccess) fail("Shouldn't be called now") } + checkAccess = false + } + } + + test("clientRoundtrip() processes all access() calls") { + var calledCount = 0 + asyncAwait { ui -> + ui.access(object : Command { + override fun execute() { + if (calledCount < 4) { + calledCount++ + UI.getCurrent().access(this) + } + } + }) + } + expect(0) { calledCount } + MockVaadin.clientRoundtrip() + expect(4) { calledCount } + } + + test("access() has properly mocked instances") { + asyncAwait { ui -> + ui.access { + expect(true) { VaadinSession.getCurrent() != null } + expect(true) { VaadinService.getCurrent() != null } + expect(true) { VaadinRequest.getCurrent() != null } + expect(true) { UI.getCurrent() != null } + expect(true) { VaadinResponse.getCurrent() != null } + } + } + MockVaadin.clientRoundtrip() + } + + // https://github.com/mvysny/karibu-testing/issues/80 + test("push() does nothing but can be called") { + asyncAwait { ui -> + ui.access { + UI.getCurrent().push() + } + } + MockVaadin.clientRoundtrip() + } + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/AttachedTextField.kt b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/AttachedTextField.kt new file mode 100644 index 000000000..c6cc2c6c8 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/AttachedTextField.kt @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ + +package com.vaadin.testbench.unit.internal + +import com.vaadin.flow.component.textfield.TextField + +/** + * TextField for testing which returns that it is attached. + */ +class AttachedTextField : TextField() { + override fun isAttached(): Boolean { + return true + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/BasicUtilsTest.kt b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/BasicUtilsTest.kt new file mode 100644 index 000000000..499de8ee4 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/BasicUtilsTest.kt @@ -0,0 +1,117 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.vaadin.testbench.unit.internal + +import com.github.mvysny.dynatest.DynaNodeGroup +import com.github.mvysny.dynatest.DynaTestDsl +import com.github.mvysny.dynatest.expectThrows +import com.github.mvysny.karibudsl.v10.textField +import com.vaadin.flow.component.ClickEvent +import com.vaadin.flow.component.html.Div +import com.vaadin.flow.component.orderedlayout.VerticalLayout +import com.vaadin.flow.component.textfield.TextField +import com.vaadin.flow.dom.DomEvent +import elemental.json.Json +import kotlin.test.expect + +@DynaTestDsl +internal fun DynaNodeGroup.basicUtilsTestbatch() { + + group("checkEditableByUser") { + test("disabled textfield fails") { + expectThrows(java.lang.IllegalStateException::class, "The AttachedTextField[DISABLED, value=''] is not enabled") { + AttachedTextField().apply { isEnabled = false }.checkEditableByUser() + } + } + test("invisible textfield fails") { + expectThrows( + java.lang.IllegalStateException::class, + "The AttachedTextField[INVIS, value=''] is not effectively visible" + ) { + AttachedTextField().apply { isVisible = false }.checkEditableByUser() + } + } + test("non attached textfield fails") { + expectThrows( + java.lang.IllegalStateException::class, + "The TextField[value=''] is not attached" + ) { + TextField().checkEditableByUser() + } + } + test("textfield in invisible layout fails") { + expectThrows(java.lang.IllegalStateException::class, "The TextField[value=''] is not effectively visible") { + VerticalLayout().apply { + isVisible = false + textField().also { it.checkEditableByUser() } + } + } + } + test("textfield succeeds") { + AttachedTextField().checkEditableByUser() + } + } + + group("expectNotEditableByUser") { + test("disabled textfield fails") { + AttachedTextField().apply { isEnabled = false }.expectNotEditableByUser() + } + test("invisible textfield fails") { + AttachedTextField().apply { isVisible = false }.expectNotEditableByUser() + } + test("textfield in invisible layout fails") { + VerticalLayout().apply { + isVisible = false + textField().also { it.expectNotEditableByUser() } + } + } + test("textfield succeeds") { + expectThrows(AssertionError::class, "The AttachedTextField[value=''] is editable") { + AttachedTextField().expectNotEditableByUser() + } + } + } + + group("fireDomEvent()") { + test("smoke") { + Div()._fireDomEvent("click") + } + test("listeners are called") { + val div = Div() + lateinit var event: DomEvent + div.element.addEventListener("click") { e -> event = e } + div._fireDomEvent("click") + expect("click") { event.type } + } + test("higher-level listeners are called") { + val div = Div() + lateinit var event: ClickEvent
+ div.addClickListener { e -> event = e } + div._fireDomEvent("click", Json.createObject().apply { put("event.screenX", 20.0) }) + expect(20) { event.screenX } + } + } + + test("_focus") { + val f = AttachedTextField() + var called = false + f.addFocusListener { called = true } + f._focus() + expect(true) { called } + } + + test("_blur") { + val f = AttachedTextField() + var called = false + f.addBlurListener { called = true } + f._blur() + expect(true) { called } + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/ComponentUtilsTest.kt b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/ComponentUtilsTest.kt new file mode 100644 index 000000000..dd3505f24 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/ComponentUtilsTest.kt @@ -0,0 +1,275 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.vaadin.testbench.unit.internal + +import com.github.mvysny.dynatest.DynaNodeGroup +import com.github.mvysny.dynatest.expectThrows +import com.vaadin.flow.component.Component +import com.vaadin.flow.component.Text +import com.vaadin.flow.component.UI +import com.vaadin.flow.component.button.Button +import com.vaadin.flow.component.checkbox.Checkbox +import com.vaadin.flow.component.formlayout.FormLayout +import com.vaadin.flow.component.html.Div +import com.vaadin.flow.component.html.Label +import com.vaadin.flow.component.html.Span +import com.vaadin.flow.component.orderedlayout.FlexLayout +import com.vaadin.flow.component.orderedlayout.HorizontalLayout +import com.vaadin.flow.component.textfield.TextArea +import com.vaadin.flow.component.textfield.TextField +import kotlin.test.expect + +fun DynaNodeGroup.componentUtilsTests() { + beforeEach { MockVaadin.setup() } + afterEach { MockVaadin.tearDown() } + + group("removeFromParent()") { + test("component with no parent") { + val t = Text("foo") + t.removeFromParent() + expect(null) { t.parent.orElse(null) } + } + test("nested component") { + val fl = FlexLayout().apply { add(Label("foo")) } + val label = fl.getComponentAt(0) + expect(fl) { label.parent.get() } + label.removeFromParent() + expect(null) { label.parent.orElse(null) } + expect(0) { fl.componentCount } + } + test("reattach") { + val fl = FlexLayout().apply { add(Label("foo")) } + val label = fl.getComponentAt(0) + label.removeFromParent() + fl.add(label) + expect(fl) { label.parent.orElse(null) } + expect(1) { fl.componentCount } + } + } + + test("serverClick()") { + val b = Button() + var clicked = 0 + b.addClickListener { clicked++ } + b.serverClick() + expect(1) { clicked } + } + + test("tooltip") { + val b = Button() + expect(null) { b.tooltip.text } + b.setTooltipText("") + expect("") { b.tooltip.text } // https://youtrack.jetbrains.com/issue/KT-32501 + b.setTooltipText("foo") + expect("foo") { b.tooltip.text } // https://youtrack.jetbrains.com/issue/KT-32501 + b.setTooltipText(null) + expect(null) { b.tooltip.text } + } + + test("addContextMenuListener smoke") { + Button().addContextMenuListener({}) + } + + group("findAncestor") { + test("null on no parent") { + expect(null) { Button().findAncestor { false } } + } + test("null on no acceptance") { + val button = Button() + UI.getCurrent().add(button) + expect(null) { button.findAncestor { false } } + } + test("finds UI") { + val button = Button() + UI.getCurrent().add(button) + expect(UI.getCurrent()) { button.findAncestor { it is UI } } + } + test("doesn't find self") { + val button = Button() + UI.getCurrent().add(button) + expect(UI.getCurrent()) { button.findAncestor { true } } + } + } + + group("findAncestorOrSelf") { + test("null on no parent") { + expect(null) { Button().findAncestorOrSelf { false } } + } + test("null on no acceptance") { + val button = Button() + UI.getCurrent().add(button) + expect(null) { button.findAncestorOrSelf { false } } + } + test("finds self") { + val button = Button() + UI.getCurrent().add(button) + expect(button) { button.findAncestorOrSelf { true } } + } + } + + test("isNestedIn") { + expect(false) { Button().isNestedIn(UI.getCurrent()) } + val button = Button() + UI.getCurrent().add(button) + expect(true) { button.isNestedIn(UI.getCurrent()) } + } + + test("isAttached") { + expect(true) { UI.getCurrent().isAttached() } + expect(false) { Button("foo").isAttached() } + expect(true) { + val button = Button() + UI.getCurrent().add(button) + button.isAttached() + } + UI.getCurrent().close() + expect(true) { UI.getCurrent().isAttached() } + } + + test("insertBefore") { + val l = HorizontalLayout() + val first = Span("first") + l.addComponentAsFirst(first) + val second = Span("second") + l.insertBefore(second, first) + expect("second, first") { l.children.toList().map { it._text } .joinToString() } + l.insertBefore(Span("third"), first) + expect("second, third, first") { l.children.toList().map { it._text } .joinToString() } + } + + test("hasChildren") { + val l = HorizontalLayout() + expect(false) { l.hasChildren } + l.addComponentAsFirst(Span("first")) + expect(true) { l.hasChildren } + l.removeAll() + expect(false) { l.hasChildren } + } + + /* + test("isNotEmpty") { + val l = HorizontalLayout() + expect(false) { l.isNotEmpty } + l.addComponentAsFirst(Span("first")) + expect(true) { l.isNotEmpty } + l.removeAll() + expect(false) { l.isNotEmpty } + } + + test("isEmpty") { + val l = HorizontalLayout() + expect(true) { l.isEmpty } + l.addComponentAsFirst(Span("first")) + expect(false) { l.isEmpty } + l.removeAll() + expect(true) { l.isEmpty } + } + */ + + group("classnames2") { + test("addClassNames2") { + val div = Div().apply { addClassNames2("foo bar baz") } + expect(true) { + div.classNames.containsAll(listOf("foo", "bar", "baz")) + } + } + test("addClassNames2(vararg)") { + val div = Div().apply { addClassNames2("foo bar baz", " one two") } + expect(true) { + div.classNames.containsAll(listOf("foo", "bar", "baz", "one", "two")) + } + } + test("setClassNames2") { + val div = Div().apply { addClassNames2("foo bar baz", " one two") } + div.setClassNames2(" three four ") + expect(true) { + div.classNames.containsAll(listOf("three", "four")) + } + } + test("setClassNames2(vararg)") { + val div = Div().apply { addClassNames2("foo bar baz", " one two") } + div.setClassNames2(" three ", "four ") + expect(true) { + div.classNames.containsAll(listOf("three", "four")) + } + } + test("removeClassNames2") { + val div = Div().apply { addClassNames2("foo bar baz", " one two") } + div.removeClassNames2(" bar baz ") + expect(true) { + div.classNames.containsAll(listOf("foo", "one", "two")) + } + } + test("removeClassNames2(vararg)") { + val div = Div().apply { addClassNames2("foo bar baz", " one two") } + div.removeClassNames2(" bar ", "baz ") + expect(true) { + div.classNames.containsAll(listOf("foo", "one", "two")) + } + } + } + + test("placeholder") { + var c: Component = TextField().apply { placeholder = "foo" } + expect("foo") { c.placeholder } + c.placeholder = "" + expect("") { c.placeholder } + c = TextArea().apply { placeholder = "foo" } + expect("foo") { c.placeholder } + c.placeholder = "" + expect("") { c.placeholder } + c = Button() // doesn't support placeholder + expect(null) { c.placeholder } + expectThrows(IllegalStateException::class, "Button doesn't support setting placeholder") { + c.placeholder = "foo" + } + } + + group("label") { + test("TextField") { + val c: Component = TextField() + expect("") { c.label } + c.label = "foo" + expect("foo") { c.label } + c.label = "" + expect("") { c.label } + } + test("Checkbox") { + val c: Component = Checkbox() + expect("") { c.label } + c.label = "foo" + expect("foo") { c.label } + c.label = "" + expect("") { c.label } + } + } + + test("caption") { + var c: Component = Button("foo") + expect("foo") { c.caption } + c.caption = "" + expect("") { c.caption } + c = Checkbox().apply { caption = "foo" } + expect("foo") { c.caption } + c.caption = "" + expect("") { c.caption } + expect("") { FormLayout.FormItem().label } + val fl = FormLayout() + c = fl.addFormItem(Button(), "foo") + expect("foo") { c.caption } + } + + test("Button.caption") { + val c = Button("foo") + expect("foo") { c.caption } + c.caption = "" + expect("") { c.caption } + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/DepthFirstTreeIteratorTest.kt b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/DepthFirstTreeIteratorTest.kt new file mode 100644 index 000000000..8210b291f --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/DepthFirstTreeIteratorTest.kt @@ -0,0 +1,41 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.vaadin.testbench.unit.internal + +import com.github.mvysny.dynatest.DynaNodeGroup +import com.github.mvysny.dynatest.expectList +import com.vaadin.flow.component.Component +import com.vaadin.flow.component.button.Button +import com.vaadin.flow.component.html.Label +import com.vaadin.flow.component.orderedlayout.HorizontalLayout +import com.vaadin.flow.component.orderedlayout.VerticalLayout +import kotlin.test.expect + +fun DynaNodeGroup.depthFirstTreeIteratorTests() { + test("DepthFirstTreeIterator") { + val i = DepthFirstTreeIterator("0") { if (it.length > 2) listOf() else listOf("${it}0", "${it}1", "${it}2")} + expectList("0", "00", "000", "001", "002", "01", "010", "011", "012", "02", "020", "021", "022") { i.asSequence().toList() } + } + + test("walk") { + val expected = mutableListOf() + val root = VerticalLayout().apply { + expected.add(this) + add(Button("Foo").apply { expected.add(this) }) + add(HorizontalLayout().apply { + expected.add(this) + add(Label().apply { expected.add(this) }) + }) + add(VerticalLayout().apply { expected.add(this) }) + } + expect(expected) { root.walk().toList() } + expect(root) { root.walk().toList()[0] } + } +} diff --git a/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/ElementUtilsTest.kt b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/ElementUtilsTest.kt new file mode 100644 index 000000000..168cab6ea --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/ElementUtilsTest.kt @@ -0,0 +1,111 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.vaadin.testbench.unit.internal + +import com.github.mvysny.dynatest.DynaNodeGroup +import com.vaadin.flow.component.Text +import com.vaadin.flow.component.UI +import com.vaadin.flow.component.button.Button +import com.vaadin.flow.component.html.Div +import com.vaadin.flow.component.html.Paragraph +import com.vaadin.flow.component.html.Span +import com.vaadin.flow.component.textfield.TextField +import com.vaadin.flow.dom.DomEvent +import com.vaadin.flow.dom.Element +import com.vaadin.testbench.unit.expectList +import elemental.json.Json +import kotlin.test.expect + +fun DynaNodeGroup.elementUtilsTests() { + beforeEach { MockVaadin.setup() } + afterEach { MockVaadin.tearDown() } + + test("setOrRemoveAttribute") { + val t = Div().element + expect(null) { t.getAttribute("foo") } + t.setOrRemoveAttribute("foo", "bar") + expect("bar") { t.getAttribute("foo") } + t.setOrRemoveAttribute("foo", null) + expect(null) { t.getAttribute("foo") } + } + + group("toggle class name") { + test("add") { + val t = Div() + t.classNames.toggle("test") + expect(setOf("test")) { t.classNames } + } + test("remove") { + val t = Div() + t.classNames.add("test") + t.classNames.toggle("test") + expect(setOf()) { t.classNames } + } + } + + test("insertBefore") { + val l = Div().element + val first: Element = Span("first").element + l.appendChild(first) + val second: Element = Span("second").element + l.insertBefore(second, first) + expect("second, first") { l.children.toList().joinToString { it.text } } + l.insertBefore(Span("third").element, first) + expect("second, third, first") { l.children.toList().joinToString { it.text } } + } + + test("textRecursively2") { + expect("foo") { Span("foo").element.textRecursively2 } + expect("foobarbaz") { + val div = Div() + div.add(Span("foo"), Text("bar"), Paragraph("baz")) + div.element.textRecursively2 + } + expect("foo") { Element("div").apply { setProperty("innerHTML", "foo") }.textRecursively2 } + } + + group("getVirtualChildren()") { + test("initially empty") { + expectList() { Div().element.getVirtualChildren() } + expectList() { Span().element.getVirtualChildren() } + expectList() { + val b = Button() + UI.getCurrent().add(b) + b.element.getVirtualChildren() + } + } + test("add virtual child") { + val span = Span().element + val parent = Div() + parent.element.appendVirtualChild(span) + expectList(span) { parent.element.getVirtualChildren() } + } + } + + test("getChildrenInSlot") { + expectList() { TextField().element.getChildrenInSlot("prefix") } + val div = Div() + expectList(div.element) { TextField().apply { prefixComponent = div } .element.getChildrenInSlot("prefix") } + } + + test("clearSlot") { + val tf = TextField() + tf.prefixComponent = Div() + tf.element.clearSlot("prefix") + expectList() { tf.element.getChildrenInSlot("prefix") } + expect(null) { tf.prefixComponent } + } + + test("fireDomEvent() smoke") { + val element = Div().element + element._fireDomEvent(DomEvent(element, "click", Json.createObject())) + } + +} diff --git a/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/LocatorTest.kt b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/LocatorTest.kt new file mode 100644 index 000000000..834618ef7 --- /dev/null +++ b/vaadin-testbench-unit-junit5/src/test/kotlin/com/vaadin/testbench/unit/internal/LocatorTest.kt @@ -0,0 +1,413 @@ +/** + * Copyright (C) 2022 Vaadin Ltd + * + * This program is available under Commercial Vaadin Developer License + * 4.0 (CVDLv4). + * + * + * For the full License, see . + */ +package com.vaadin.testbench.unit.internal + +import com.github.mvysny.dynatest.DynaNodeGroup +import com.github.mvysny.dynatest.DynaTestDsl +import com.github.mvysny.dynatest.expectThrows +import com.github.mvysny.karibudsl.v10.button +import com.github.mvysny.karibudsl.v10.text +import com.github.mvysny.karibudsl.v10.textField +import com.github.mvysny.karibudsl.v10.verticalLayout +import com.vaadin.flow.component.Text +import com.vaadin.flow.component.UI +import com.vaadin.flow.component.button.Button +import com.vaadin.flow.component.combobox.ComboBox +import com.vaadin.flow.component.dialog.Dialog +import com.vaadin.flow.component.html.Label +import com.vaadin.flow.component.orderedlayout.VerticalLayout +import com.vaadin.flow.component.textfield.PasswordField +import com.vaadin.flow.component.textfield.TextField +import com.vaadin.testbench.unit.expectList +import java.util.function.Predicate +import kotlin.streams.asSequence +import kotlin.test.expect + +@DynaTestDsl +internal fun DynaNodeGroup.locatorTest2() { + beforeEach { MockVaadin.setup() } + afterEach { MockVaadin.tearDown() } + + test("_expectNoDialogs()") { + _expectNoDialogs() // should succeed on no dialogs + val dlg = Dialog() + dlg.open() + expectThrows(AssertionError::class, + """Too many visible Dialogs (1) in MockedUI[] matching Dialog and count=0..0: [Dialog[opened='true']]. Component tree: +└── MockedUI[] + └── Dialog[opened='true'] +""") { + _expectNoDialogs() + } + dlg.close() + _expectNoDialogs() + } + + group("InternalServerError handling") { + test("component lookup fails on navigation error") { + // Vaadin shows InternalServerError when an exception occurs during the navigation phase. + // the _expect*() functions should detect this and fail fast. + currentUI.addBeforeEnterListener { event -> event.rerouteToError(RuntimeException("Simulated"), "Simulated") } + UI.getCurrent().navigate("") + expectThrows("An internal server error occurred; please check log for the actual stack-trace. Error text: There was an exception while trying to navigate to") { + _expectOne() + } + } + group("_expectInternalServerError") { + test("fails on no error") { + expectThrows( + """Expected an internal server error but none happened. Component tree: +└── MockedUI[]""" + ) { _expectInternalServerError() } + } + test("succeeds on error") { + currentUI.addBeforeEnterListener { event -> event.rerouteToError(RuntimeException("Simulated"), "Simulated") } + UI.getCurrent().navigate("") + _expectInternalServerError() + } + test("matches error message correctly") { + currentUI.addBeforeEnterListener { event -> event.rerouteToError(RuntimeException("Simulated"), "Simulated") } + UI.getCurrent().navigate("") + _expectInternalServerError("Simulated") + } + } + } +} + +@DynaTestDsl +internal fun DynaNodeGroup.locatorTest() { + + beforeEach { MockVaadin.setup() } + beforeEach { testingLifecycleHook = MyLifecycleHook() } + afterEach { testingLifecycleHook = TestingLifecycleHook.default } + afterEach { MockVaadin.tearDown() } + + group("_get") { + test("fails when no component match") { + expectThrows(AssertionError::class) { + Button()._get(TextField::class.java) + } + expectAfterLookupCalled() + } + + test("fail when multiple component match") { + expectThrows(AssertionError::class) { + UI.getCurrent().verticalLayout { + verticalLayout { } + }._get(VerticalLayout::class.java) + } + expectAfterLookupCalled() + } + + test("ReturnsSelf") { + val button = Button() + expect(button) { button._get(Button::class.java) } + expectAfterLookupCalled() + } + + test("ReturnsNested") { + val button = Button() + expect(button) { VerticalLayout(button)._get(Button::class.java) } + expectAfterLookupCalled() + } + + test("fails on invisible") { + val button = Button().apply { isVisible = false } + expectThrows(java.lang.AssertionError::class) { button._get(Button::class.java) } + expectAfterLookupCalled() + } + } + + group("_find") { + test("findMatchingId") { + val button = Button().apply { id_ = "foo" } + expectList(button) { VerticalLayout(button, Button())._find