DataSourceContractTest.TestResource


public final class DataSourceContractTest.TestResource


Information about a resource that can be used to test the DataSource instance.

Summary

Nested types

Builder for TestResource instances.

Public methods

byte[]

Returns the expected contents of this resource.

@Nullable String

Returns a human-readable name for the resource, for use in test failure messages.

Uri

Returns the URI where the resource is served from.

Map<StringList<String>>

Returns the headers associated with this resource that are expected to be present in getResponseHeaders.

Set<String>

Returns the keys that must not be present in getResponseHeaders when reading this resource.

Uri

Returns the URI where the resource should be requested from.

Public fields

expectedBytes

public final byte[] expectedBytes

name

public final @Nullable String name

resolvedUri

public final Uri resolvedUri

responseHeaders

public final Map<StringList<String>> responseHeaders

unexpectedResponseHeaderKeys

public final Set<StringunexpectedResponseHeaderKeys

uri

public final Uri uri

Public methods

getExpectedBytes

public byte[] getExpectedBytes()

Returns the expected contents of this resource.

getName

public @Nullable String getName()

Returns a human-readable name for the resource, for use in test failure messages.

getResolvedUri

public Uri getResolvedUri()

Returns the URI where the resource is served from. This is equal to getUri unless redirection occurred when opening the resource.

getResponseHeaders

public Map<StringList<String>> getResponseHeaders()

Returns the headers associated with this resource that are expected to be present in getResponseHeaders.

This doesn't have to be an exhaustive list, extra headers in getResponseHeaders are ignored.

getUnexpectedResponseHeaderKeys

public Set<StringgetUnexpectedResponseHeaderKeys()

Returns the keys that must not be present in getResponseHeaders when reading this resource.

getUri

public Uri getUri()

Returns the URI where the resource should be requested from.