Record Class AxonTestFixture.Customization
- Record Components:
integrationEnabled- toggle describing whether this fixture should integrate with infrastructure (e.g. Axon Server). Defaults tofalsefieldFilters- collections ofFieldFiltersused to adjust the matchers for commands, events, and result messages
- Enclosing class:
AxonTestFixture
enabling it as an integration test or by
including fieldFilters().
When the integrationEnabled() is set to false (the default), certain
ConfigurationEnhancers will be
disabled. An example of
this is the AxonServerConfigurationEnhancer.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance ofCustomization.Customization(boolean integrationEnabled, List<FieldFilter> fieldFilters) Creates an instance of aCustomizationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionConfigures the fixture to run as an integration test.final booleanIndicates whether some other object is "equal to" this one.Configured field filters.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theintegrationEnabledrecord component.registerFieldFilter(FieldFilter fieldFilter) Registers the givenfieldFilter, which is used to define whichFieldsare used when comparing objects.registerIgnoredField(Class<?> declaringClass, String fieldName) Indicates that a field with givenfieldName, which is declared in givendeclaringClassis ignored when performing deep equality checks.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Customization
public Customization()Creates a new instance ofCustomization. -
Customization
Creates an instance of aCustomizationrecord class.- Parameters:
integrationEnabled- the value for theintegrationEnabledrecord componentfieldFilters- the value for thefieldFiltersrecord component
-
-
Method Details
-
registerFieldFilter
Registers the givenfieldFilter, which is used to define whichFieldsare used when comparing objects.This filter is used by the following methods:
AxonTestPhase.Then.MessageAssertions.events(java.lang.Object...)AxonTestPhase.Then.MessageAssertions.commands(java.lang.Object...)AxonTestPhase.Then.Command.resultMessagePayload(java.lang.Object)
If you use custom assertions with methods like
When multiple filters are registered, aAxonTestPhase.Then.MessageAssertions.eventsSatisfy(java.util.function.Consumer<java.util.List<org.axonframework.messaging.eventhandling.EventMessage>>)orAxonTestPhase.Then.MessageAssertions.eventsMatch(java.util.function.Predicate<java.util.List<org.axonframework.messaging.eventhandling.EventMessage>>)this filter is not taken into account.Fieldmust be accepted by all registered filters in order to be accepted. By default, allFieldsare included in the comparison.- Parameters:
fieldFilter- theFieldFilterthat defines which fields to include in the comparison- Returns:
- the current
Customization, for fluent interfacing
-
registerIgnoredField
public AxonTestFixture.Customization registerIgnoredField(Class<?> declaringClass, String fieldName) Indicates that a field with givenfieldName, which is declared in givendeclaringClassis ignored when performing deep equality checks.This filter is used by the following methods:
AxonTestPhase.Then.MessageAssertions.events(java.lang.Object...)AxonTestPhase.Then.MessageAssertions.commands(java.lang.Object...)AxonTestPhase.Then.Command.resultMessagePayload(java.lang.Object)
If you use custom assertions with methods like
AxonTestPhase.Then.MessageAssertions.eventsSatisfy(java.util.function.Consumer<java.util.List<org.axonframework.messaging.eventhandling.EventMessage>>)orAxonTestPhase.Then.MessageAssertions.eventsMatch(java.util.function.Predicate<java.util.List<org.axonframework.messaging.eventhandling.EventMessage>>)this filter is not taken into account.- Parameters:
declaringClass- the class declaring the fieldfieldName- the name of the field- Returns:
- the current
Customization, for fluent interfacing - Throws:
FixtureExecutionException- when no such field is declared
-
fieldFilters
Configured field filters.- Returns:
- the list of field filters
-
asIntegrationTest
Configures the fixture to run as an integration test.This ensures certain
ConfigurationEnhancersthat introduce "heavy" infrastructure components (like theAxonServerConfigurationEnhancer) are kept in the givenApplicationConfigurer.- Returns:
- the current
Customization, for fluent interfacing
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
integrationEnabled
public boolean integrationEnabled()Returns the value of theintegrationEnabledrecord component.- Returns:
- the value of the
integrationEnabledrecord component
-