Package com.vaadin.flow.testutil
Class ClassesSerializableTest
- java.lang.Object
-
- com.vaadin.flow.testutil.ClassFinder
-
- com.vaadin.flow.testutil.ClassesSerializableTest
-
public abstract class ClassesSerializableTest extends ClassFinder
A superclass for serialization testing. The test scans all the classpath and tries to serialize every single class (except ones from whitelist) in the classpath. Subclasses may adjust the whitelist by overridinggetExcludedPatterns(),ClassFinder.getBasePackages(),ClassFinder.getJarPattern()- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description ClassesSerializableTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclassesSerializable()Tests that all the relevant classes and interfaces underClassFinder.getBasePackages()implement Serializable.protected Stream<String>getExcludedPatterns()protected voidresetThreadLocals()The method is called right after a class instantiation and might be overriden by subclasses to reset thread local values (ex.<T> TserializeAndDeserialize(T instance)Performs actual serialization/deserializationprotected voidsetupThreadLocals()The method is called right a class instantiation and might be overriden by subclasses to install some necessary thread local values (ex.-
Methods inherited from class com.vaadin.flow.testutil.ClassFinder
findServerClasses, getBasePackages, getJarPattern, getRawClasspathEntries, isFunctionalType, isTestClass, isTestClassPath
-
-
-
-
Method Detail
-
serializeAndDeserialize
public <T> T serializeAndDeserialize(T instance) throws ThrowablePerforms actual serialization/deserialization- Type Parameters:
T- the type of the instance- Parameters:
instance- the instance- Returns:
- the copy of the source object
- Throws:
Throwable- if something goes wrong.
-
resetThreadLocals
protected void resetThreadLocals()
The method is called right after a class instantiation and might be overriden by subclasses to reset thread local values (ex. current UI).- See Also:
setupThreadLocals()
-
setupThreadLocals
protected void setupThreadLocals()
The method is called right a class instantiation and might be overriden by subclasses to install some necessary thread local values (ex. current UI).- See Also:
resetThreadLocals()
-
classesSerializable
public void classesSerializable() throws ThrowableTests that all the relevant classes and interfaces underClassFinder.getBasePackages()implement Serializable.- Throws:
Throwable- serialization goes wrong
-
-