mvysny / karibu-testing

Vaadin Server-Side Browserless Containerless Unit Testing
Apache License 2.0
105 stars 14 forks source link

Test on Vaadin 22 #88

Closed mvysny closed 2 years ago

mvysny commented 2 years ago

Running the tests with Vaadin 22.0.0.alpha7 they will fail with the following exception:

AllTests > Router Utils > navigation tests > UI.currentViewLocation FAILED
    java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed data found for annotation element public abstract java.lang.String[] com.vaadin.flow.router.Route.value() (Found data of type class java.lang.String[testing])
        at java.base/sun.reflect.annotation.AnnotationTypeMismatchExceptionProxy.generateException(AnnotationTypeMismatchExceptionProxy.java:57)
        at java.base/sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:86)
        at com.sun.proxy.$Proxy24.value(Unknown Source)
        at com.vaadin.flow.router.internal.RouteUtil.resolve(RouteUtil.java:287)
        at com.vaadin.flow.server.startup.AbstractRouteRegistryInitializer.validateRouteAnnotation(AbstractRouteRegistryInitializer.java:243)
        at com.vaadin.flow.server.startup.AbstractRouteRegistryInitializer.lambda$checkForConflictingAnnotations$1(AbstractRouteRegistryInitializer.java:108)

This is because of a change in Vaadin API, namely the @Route.value type changed from String to String[], introducing a binary incompatibility: https://github.com/vaadin/flow/issues/11915

Related issue: https://github.com/mvysny/karibu-tools/issues/1

mvysny commented 2 years ago

One way would be to extract those routes to a separate module, then have another copy of the same routes in yet another module but compiled with Vaadin 22. Too much hassle though.

A much simpler way is to wait for Vaadin 23 LTS, then drop support for Vaadin 14.