Class BrowserlessConfiguration
-
- All Implemented Interfaces:
-
java.io.Serializable
public final class BrowserlessConfiguration implements Serializable
Custom Vaadin configuration to apply to a mock Vaadin environment.
Holds Vaadin application properties (also known as init parameters) and feature flag overrides. Both are scoped to the environment they are applied to, so a configuration used by a test neither affects other tests nor requires any clean up.
Instances are immutable and can be created with a builder or derived from a BrowserlessTestConfig annotation.
BrowserlessConfiguration configuration = BrowserlessConfiguration.builder() .withApplicationProperty( InitParameters.APPLICATION_PARAMETER_DEVMODE_ENABLE_SERIALIZE_SESSION, "true") .withFeatureFlags("myExperimentalFeature") // .build();- Since:
25.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classBrowserlessConfiguration.BuilderBuilder for BrowserlessConfiguration instances.
-
Field Summary
Fields Modifier and Type Field Description public final Map<String, String>applicationPropertiespublic final Map<String, Boolean>featureFlagspublic final Set<Class<out Object>>lookupServices
-
Method Summary
Modifier and Type Method Description Map<String, String>getApplicationProperties()Gets the Vaadin application properties (init parameters) to apply to the mock Vaadin environment. Map<String, Boolean>getFeatureFlags()Gets the feature flag overrides to apply to the mock Vaadin environment, as a map of feature identifiers to their enablement state. Set<Class<out Object>>getLookupServices()Gets the service implementation classes to be used to initialize the Vaadin com.vaadin.flow.di.Lookup. static BrowserlessConfigurationempty()Gets a configuration that does not customize the Vaadin environment. static BrowserlessConfiguration.Builderbuilder()Creates a new builder for a custom Vaadin configuration. static BrowserlessConfigurationfrom(AnnotatedElement element)Creates a configuration from the BrowserlessTestConfig annotation potentially present on the given element. static BrowserlessConfigurationfrom(BrowserlessTestConfig annotation)Creates a configuration from the given BrowserlessTestConfig annotation. booleanisEmpty()Checks if this configuration does not customize the Vaadin environment at all. BrowserlessConfigurationmerge(BrowserlessConfiguration overrides)Creates a new configuration by merging the given configuration into this one. booleanequals(Object obj)inthashCode()StringtoString()-
-
Method Detail
-
getApplicationProperties
Map<String, String> getApplicationProperties()
Gets the Vaadin application properties (init parameters) to apply to the mock Vaadin environment.
- Returns:
an unmodifiable map of application properties, never null
-
getFeatureFlags
Map<String, Boolean> getFeatureFlags()
Gets the feature flag overrides to apply to the mock Vaadin environment, as a map of feature identifiers to their enablement state.
- Returns:
an unmodifiable map of feature flag overrides, never null
-
getLookupServices
Set<Class<out Object>> getLookupServices()
Gets the service implementation classes to be used to initialize the Vaadin com.vaadin.flow.di.Lookup.
- Returns:
an unmodifiable set of service implementation classes, never null
-
empty
static BrowserlessConfiguration empty()
Gets a configuration that does not customize the Vaadin environment.
- Returns:
an empty configuration, never null
-
builder
static BrowserlessConfiguration.Builder builder()
Creates a new builder for a custom Vaadin configuration.
- Returns:
a new builder, never null
-
from
static BrowserlessConfiguration from(AnnotatedElement element)
Creates a configuration from the BrowserlessTestConfig annotation potentially present on the given element.
Meta annotations are not taken into account; use from with an annotation resolved by other means, such as JUnit
AnnotationSupport, for a more thorough lookup.- Parameters:
element- the annotated element to inspect, not null- Returns:
the configuration declared by the element, or an empty configuration if the annotation is not present, never null
-
from
static BrowserlessConfiguration from(BrowserlessTestConfig annotation)
Creates a configuration from the given BrowserlessTestConfig annotation.
- Parameters:
annotation- the annotation to convert, may be null- Returns:
the configuration declared by the annotation, or an empty configuration if the annotation is null, never null
-
isEmpty
boolean isEmpty()
Checks if this configuration does not customize the Vaadin environment at all.
- Returns:
true if neither application properties, nor feature flags, nor lookup services are defined, false otherwise
-
merge
BrowserlessConfiguration merge(BrowserlessConfiguration overrides)
Creates a new configuration by merging the given configuration into this one. Application properties and feature flags defined by the given configuration win over the ones defined by this configuration, while lookup services of both configurations are accumulated.
- Parameters:
overrides- the configuration to merge into this one, not null- Returns:
a new merged configuration, never null
-
hashCode
int hashCode()
-
-
-
-