diff --git a/flow-test-generic/src/main/java/com/vaadin/flow/testutil/ClassesSerializableTest.java b/flow-test-generic/src/main/java/com/vaadin/flow/testutil/ClassesSerializableTest.java index 7122c10b554..f45cbde857f 100644 --- a/flow-test-generic/src/main/java/com/vaadin/flow/testutil/ClassesSerializableTest.java +++ b/flow-test-generic/src/main/java/com/vaadin/flow/testutil/ClassesSerializableTest.java @@ -146,6 +146,11 @@ protected Stream getExcludedPatterns() { "com\\.vaadin\\.flow\\.templatemodel\\.BeanContainingBeans(\\$.*)?"); } + protected boolean isTestClassPath(String classPath) { + File file = new File(classPath); + return "test-classes".equals(file.getName()); + } + /** * Performs actual serialization/deserialization * @@ -287,7 +292,9 @@ public void classesSerializable() throws Throwable { List classes = new ArrayList<>(); List excludes = getExcludedPatterns().map(Pattern::compile).collect(Collectors.toList()); for (String location : rawClasspathEntries) { - classes.addAll(findServerClasses(location, excludes)); + if (!isTestClassPath(location)) { + classes.addAll(findServerClasses(location, excludes)); + } } ArrayList nonSerializableFunctionFields = new ArrayList<>();