QueryTestTag

open class QueryTestTag<T>(val tag: String) : TestTag

TestTag implementation for Query operations that provides tag-based identification.

This class is used to identify queries for mocking in test and preview environments, particularly when dealing with auto-generated query IDs that may change during configuration changes or recompositions.

Unlike QueryId which might use auto-generated values that can change across recompositions, QueryTestTag provides a stable identifier that can be consistently referenced in tests and previews.

Usage example:

// Define a test tag
class UserQueryTestTag : QueryTestTag<User>("user-query")

// Use with test client
testClient.on(UserQueryTestTag()) { QueryState.success(mockUser) }

// Apply when getting a query
val query = client.getQuery(queryKey, Marker.testTag(UserQueryTestTag()))

Parameters

T

The type of data that will be returned by the query

tag

A unique string identifier for this test tag

Constructors

Link copied to clipboard
constructor(tag: String)

Properties

Link copied to clipboard
open override val tag: String

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int