MetadataTestHelper

Added in 1.0.0-alpha03

public final class MetadataTestHelper


Summary

Public methods

static final @NonNull Metadata
populatedWithTestValues(
    @NonNull Metadata receiver,
    @NonNull String id,
    @NonNull DataOrigin dataOrigin,
    @NonNull Instant lastModifiedTime
)

Creates a new Metadata object by copying existing fields and overriding specified properties for testing.

Public methods

populatedWithTestValues

public static final @NonNull Metadata populatedWithTestValues(
    @NonNull Metadata receiver,
    @NonNull String id,
    @NonNull DataOrigin dataOrigin,
    @NonNull Instant lastModifiedTime
)

Creates a new Metadata object by copying existing fields and overriding specified properties for testing.

This method facilitates the creation of Metadata instances with controlled values, particularly useful for unit testing scenarios where specific metadata properties need to be set. It constructs a new Metadata object based on the current instance, allowing the modification of the id, dataOrigin, and lastModifiedTime fields.

Parameters
@NonNull String id

The ID to assign to the new Metadata. If not provided, the ID from the current Metadata instance will be used.

@NonNull DataOrigin dataOrigin

The DataOrigin to assign to the new Metadata. If not provided, the data origin from the current Metadata instance will be used.

@NonNull Instant lastModifiedTime

The Instant representing the last modified time. If not provided, the last modified time from the current Metadata instance will be used.