Skip to content

Implement UriResolver and UriStrategy #76

Description

@MessiasLima

Description

Add UriResolver to generate random android.net.Uri instances and UriStrategy to control URI scheme distribution. Both live in the :android module under dev.appoutlet.some.android.

  • Scope and constraints

    • UriStrategy is a sealed interface extending Strategy with variants: Random (any scheme), Content, File, Url (https only). Default is Random. It lives in dev.appoutlet.some.android.strategy.
    • UriResolver uses Uri.parse(...) with randomized scheme, host, path, and optional query/fragment. It lives in dev.appoutlet.some.android.resolver.
    • The resolver fetches the strategy once in init: strategyProvider.get<UriStrategy>() ?: UriStrategy.default.
    • canResolve() uses exact type matching: type == typeOf<Uri>().
    • resolve() delegates scheme choice to a when on the strategy variant and generates the rest of the URI randomly.
    • Includes JVM unit tests verifying each strategy variant produces correct schemes, canResolve behavior, and general URI shape.
    • Follows the same patterns as StringResolver + StringStrategy from :core.
  • References

Scope

In scope: UriStrategy sealed interface + variants, UriResolver, JVM unit tests.
Out of scope: registering the resolver in AndroidTypeResolverProvider (ticket #14).

Acceptance criteria

  • UriResolver.canResolve(typeOf<Uri>()) returns true
  • UriResolver.canResolve(typeOf<String>()) returns false
  • UriStrategy.Random (default) generates URIs with any scheme from [content, file, https]
  • UriStrategy.Url generates only https://... URIs
  • UriStrategy.Content generates only content://... URIs
  • UriStrategy.File generates only file://... URIs
  • Generated URIs have a non-empty host and path
  • Generated URIs are parseable by Uri.parse() without throwing
  • Tests compile against android.jar and run as plain JVM unit tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions