# HttpDataSourceTestEnv

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/HttpDataSourceTestEnv.java+class:androidx.media3.test.utils.HttpDataSourceTestEnv)

*** ** * ** ***


```
@UnstableApi
public class HttpDataSourceTestEnv extends ExternalResource
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [org.junit.rules.ExternalResource](https://junit.org/junit4/javadoc/latest/org/junit/rules/ExternalResource.html) ||
|   | ↳ | [androidx.media3.test.utils.HttpDataSourceTestEnv](https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv) |

*** ** * ** ***

A JUnit `https://junit.org/junit4/javadoc/latest/org/junit/Rule.html` that creates test resources for `https://developer.android.com/reference/androidx/media3/datasource/HttpDataSource` contract tests.

## Summary

| ### Constants |
|---|---|
| `static final https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableListMultimap.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#EXTRA_HEADERS()` |
| `static final https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#GZIP_ENABLED()` |
| `static final https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#GZIP_FORCED()` |
| `static final https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#POST_EMPTY_REQUEST_BODY()` |
| `static final https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#POST_WITH_REQUEST_BODY()` |
| `static final https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#RANGE_NOT_SUPPORTED()` |
| `static final https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#RANGE_NOT_SUPPORTED_LENGTH_UNKNOWN()` |
| `static final https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#RANGE_NOT_SUPPORTED_NON_AUTHORITATIVE()` |
| `static final https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#RANGE_SUPPORTED()` |
| `static final https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#RANGE_SUPPORTED_LENGTH_UNKNOWN()` |
| `static final https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#RANGE_SUPPORTED_NO_CONTENT_LENGTH()` |
| `static final https://developer.android.com/reference/androidx/media3/test/utils/WebServerDispatcher.Resource` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#REDIRECTS_TO_RANGE_SUPPORTED()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#HttpDataSourceTestEnv()()` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html` | `[getNonexistentUrl](https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#getNonexistentUrl())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#getNotFoundResources()` instead. <br /> |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/androidx/media3/test/utils/DataSourceContractTest.TestResource>` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#getNotFoundResources()()` |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://developer.android.com/reference/androidx/media3/test/utils/DataSourceContractTest.TestResource>` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#getServedResources()()` |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#after()()` |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#before()()` |

### Inherited methods

From [org.junit.rules.ExternalResource](https://junit.org/junit4/javadoc/latest/org/junit/rules/ExternalResource.html) `https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html` `https://junit.org/junit4/javadoc/latest/org/junit/rules/ExternalResource.html#apply-org.junit.runners.model.Statement-org.junit.runner.Description-(https://junit.org/junit4/javadoc/latest/org/junit/runners/model/Statement.html base, https://junit.org/junit4/javadoc/latest/org/junit/runner/Description.html description)`

## Constants

### EXTRA_HEADERS

```
public static final ImmutableListMultimap<String, String> EXTRA_HEADERS
```

### GZIP_ENABLED

```
public static final WebServerDispatcher.Resource GZIP_ENABLED
```

### GZIP_FORCED

```
public static final WebServerDispatcher.Resource GZIP_FORCED
```

### POST_EMPTY_REQUEST_BODY

```
public static final WebServerDispatcher.Resource POST_EMPTY_REQUEST_BODY
```

### POST_WITH_REQUEST_BODY

```
public static final WebServerDispatcher.Resource POST_WITH_REQUEST_BODY
```

### RANGE_NOT_SUPPORTED

```
public static final WebServerDispatcher.Resource RANGE_NOT_SUPPORTED
```

### RANGE_NOT_SUPPORTED_LENGTH_UNKNOWN

```
public static final WebServerDispatcher.Resource RANGE_NOT_SUPPORTED_LENGTH_UNKNOWN
```

### RANGE_NOT_SUPPORTED_NON_AUTHORITATIVE

```
public static final WebServerDispatcher.Resource RANGE_NOT_SUPPORTED_NON_AUTHORITATIVE
```

### RANGE_SUPPORTED

```
public static final WebServerDispatcher.Resource RANGE_SUPPORTED
```

### RANGE_SUPPORTED_LENGTH_UNKNOWN

```
public static final WebServerDispatcher.Resource RANGE_SUPPORTED_LENGTH_UNKNOWN
```

### RANGE_SUPPORTED_NO_CONTENT_LENGTH

```
public static final WebServerDispatcher.Resource RANGE_SUPPORTED_NO_CONTENT_LENGTH
```

### REDIRECTS_TO_RANGE_SUPPORTED

```
public static final WebServerDispatcher.Resource REDIRECTS_TO_RANGE_SUPPORTED
```

## Public constructors

### HttpDataSourceTestEnv

```
public HttpDataSourceTestEnv()
```

## Public methods

### getNonexistentUrl

```
public String [getNonexistentUrl](https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#getNonexistentUrl())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/media3/test/utils/HttpDataSourceTestEnv#getNotFoundResources()` instead.

### getNotFoundResources

```
public ImmutableList<DataSourceContractTest.TestResource> getNotFoundResources()
```

### getServedResources

```
public ImmutableList<DataSourceContractTest.TestResource> getServedResources()
```

## Protected methods

### after

```
protected void after()
```

### before

```
protected void before()
```

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/Throwable.html` |   |