# MetadataTestHelper

Added in 1.0.0-alpha04

*** ** * ** ***


```
public final class MetadataTestHelper
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` | `https://developer.android.com/reference/androidx/health/connect/client/testing/MetadataTestHelper#(androidx.health.connect.client.records.metadata.Metadata).populatedWithTestValues(kotlin.String,androidx.health.connect.client.records.metadata.DataOrigin,java.time.Instant)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/DataOrigin dataOrigin, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html lastModifiedTime )` Creates a new `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` object by copying existing fields and overriding specified properties for testing. |

## Public methods

### populatedWithTestValues

Artifact: [androidx.health.connect:connect-testing](https://developer.android.com/jetpack/androidx/releases/health-connect) [View Source](https://cs.android.com/search?q=file:androidx/health/connect/client/testing/MetadataTestHelper.kt+function:populatedWithTestValues) Added in [1.0.0-alpha04](https://developer.android.com/jetpack/androidx/releases/health-connect#1.0.0-alpha04)

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

Creates a new `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` object by copying existing fields and overriding specified properties for testing.

This method facilitates the creation of `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` instances with controlled values, particularly useful for unit testing scenarios where specific metadata properties need to be set. It constructs a new `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` object based on the current instance, allowing the modification of the `id`, `dataOrigin`, and `lastModifiedTime` fields.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id` | The ID to assign to the new `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata`. If not provided, the ID from the current `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` instance will be used. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/metadata/DataOrigin dataOrigin` | The `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/DataOrigin` to assign to the new `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata`. If not provided, the data origin from the current `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` instance will be used. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/time/Instant.html lastModifiedTime` | The `https://developer.android.com/reference/java/time/Instant.html` representing the last modified time. If not provided, the last modified time from the current `https://developer.android.com/reference/androidx/health/connect/client/records/metadata/Metadata` instance will be used. |