From b5e564d29a2490fc2b0b292638cffb1c5be9e763 Mon Sep 17 00:00:00 2001 From: Peter Czuczor Date: Wed, 15 Mar 2023 21:15:47 +0100 Subject: [PATCH] Revert GridTester changes, and fix java doc for the newly added getHashableKey() method, fix imports. --- .../flow/component/grid/GridTester.java | 3 ++- .../testbench/unit/internal/Shortcuts.kt | 23 ++++--------------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/vaadin-testbench-unit-shared/src/main/java/com/vaadin/flow/component/grid/GridTester.java b/vaadin-testbench-unit-shared/src/main/java/com/vaadin/flow/component/grid/GridTester.java index 11c484419..72375c46a 100644 --- a/vaadin-testbench-unit-shared/src/main/java/com/vaadin/flow/component/grid/GridTester.java +++ b/vaadin-testbench-unit-shared/src/main/java/com/vaadin/flow/component/grid/GridTester.java @@ -560,7 +560,8 @@ private String getValueProviderString(int row, Grid.Column targetColumn) ColumnPathRenderer renderer = (ColumnPathRenderer) targetColumn .getRenderer(); - Field f = ColumnPathRenderer.class.getDeclaredField("provider"); + Field f = ColumnPathRenderer.class + .getDeclaredField("provider"); f.setAccessible(true); final ValueProvider columnValueProvider = (ValueProvider) f diff --git a/vaadin-testbench-unit-shared/src/main/kotlin/com/vaadin/testbench/unit/internal/Shortcuts.kt b/vaadin-testbench-unit-shared/src/main/kotlin/com/vaadin/testbench/unit/internal/Shortcuts.kt index d36c864ae..fa074fa2a 100644 --- a/vaadin-testbench-unit-shared/src/main/kotlin/com/vaadin/testbench/unit/internal/Shortcuts.kt +++ b/vaadin-testbench-unit-shared/src/main/kotlin/com/vaadin/testbench/unit/internal/Shortcuts.kt @@ -5,7 +5,6 @@ import com.vaadin.flow.component.Key import com.vaadin.flow.component.ShortcutRegistration import elemental.json.impl.JreJsonFactory import elemental.json.impl.JreJsonObject -import java.lang.reflect.InvocationTargetException /** * Take a look at `DomEventListenerWrapper.matchesFilter()` to see why this is necessary. @@ -27,25 +26,11 @@ private class MockFilterJsonObject(val key: Key, val modifiers: Set) : JreJ } /** - * This method is used to get the HashableKey object from the - * ShortcutRegistration class. This is needed because the HashableKey class - * is private, and we need to create an instance of it to test the - * generateEventModifierFilter method. + * Returns a HashableKey instance for the given key modifier. + * @param keyModifier the key modifier + * @return the HashableKey instance * - * @param keyModifier - * @return - * @throws ClassNotFoundException - * @throws InvocationTargetException - * @throws InstantiationException - * @throws IllegalAccessException - */ - @Throws( - ClassNotFoundException::class, - InvocationTargetException::class, - InstantiationException::class, - IllegalAccessException::class - ) - + */ private fun getHashableKey(keyModifier: Key): Any? { return chashableKey.newInstance(keyModifier) }