Package com.vaadin.browserless
Class BrowserlessConfiguration
java.lang.Object
com.vaadin.browserless.BrowserlessConfiguration
- All Implemented Interfaces:
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
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder forBrowserlessConfigurationinstances. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a new builder for a custom Vaadin configuration.static BrowserlessConfigurationempty()Gets a configuration that does not customize the Vaadin environment.booleanstatic BrowserlessConfigurationfrom(BrowserlessTestConfig annotation) Creates a configuration from the givenBrowserlessTestConfigannotation.static BrowserlessConfigurationfrom(AnnotatedElement element) Creates a configuration from theBrowserlessTestConfigannotation potentially present on the given element.Gets the Vaadin application properties (init parameters) to apply to the mock Vaadin environment.Gets the feature flag overrides to apply to the mock Vaadin environment, as a map of feature identifiers to their enablement state.Gets the service implementation classes to be used to initialize the VaadinLookup.inthashCode()booleanisEmpty()Checks if this configuration does not customize the Vaadin environment at all.merge(BrowserlessConfiguration overrides) Creates a new configuration by merging the given configuration into this one.toString()
-
Method Details
-
empty
Gets a configuration that does not customize the Vaadin environment.- Returns:
- an empty configuration, never null
-
builder
Creates a new builder for a custom Vaadin configuration.- Returns:
- a new builder, never null
-
from
Creates a configuration from theBrowserlessTestConfigannotation potentially present on the given element.Meta annotations are not taken into account; use
from(BrowserlessTestConfig)with an annotation resolved by other means, such as JUnitAnnotationSupport, 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
Creates a configuration from the givenBrowserlessTestConfigannotation.- 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
- Throws:
IllegalArgumentException- if an annotation entry is not well formed
-
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
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
Gets the service implementation classes to be used to initialize the VaadinLookup.- Returns:
- an unmodifiable set of service implementation classes, never null
-
isEmpty
public 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
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
-
equals
-
hashCode
public int hashCode() -
toString
-