toReadOnlyStateAggregate

Converts any object to a ReadOnlyStateAggregate for testing purposes.

If the object is already a ReadOnlyStateAggregate, it is returned as-is. Otherwise, it creates a new GivenReadOnlyStateAggregate with the object as state and metadata derived from the domain event.

Return

A ReadOnlyStateAggregate representation of this object.

Parameters

domainEvent

The domain event that provides context for the aggregate.