Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited Fields](https://developer.android.com/reference/android/test/LoaderTestCase#inhfields) \| [Ctors](https://developer.android.com/reference/android/test/LoaderTestCase#pubctors) \| [Methods](https://developer.android.com/reference/android/test/LoaderTestCase#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/test/LoaderTestCase#inhmethods)

# LoaderTestCase

*** ** * ** ***


`
public


class
LoaderTestCase
`


`


`

`

extends https://developer.android.com/reference/android/test/AndroidTestCase


`

`


`

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.test.AndroidTestCase](https://developer.android.com/reference/android/test/AndroidTestCase) ||
|   | ↳ | android.test.LoaderTestCase |

<br />

*** ** * ** ***

A convenience class for testing `https://developer.android.com/reference/android/content/Loader`s. This test case
provides a simple way to synchronously get the result from a Loader making
it easy to assert that the Loader returns the expected result.

## Summary

| ### Inherited fields |
|---|
| From class `https://developer.android.com/reference/android/test/AndroidTestCase` |---|---| | ` protected https://developer.android.com/reference/android/content/Context` | `https://developer.android.com/reference/android/test/AndroidTestCase#mContext` | |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/test/LoaderTestCase#LoaderTestCase()() ` |

| ### Public methods ||
|---|---|
| ` <T> T` | ` https://developer.android.com/reference/android/test/LoaderTestCase#getLoaderResultSynchronously(android.content.Loader<T>)(https://developer.android.com/reference/android/content/Loader<T> loader) ` Runs a Loader synchronously and returns the result of the load. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/android/test/AndroidTestCase ` |---|---| | ` void` | ` https://developer.android.com/reference/android/test/AndroidTestCase#assertActivityRequiresPermission(java.lang.String,%20java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String packageName, https://developer.android.com/reference/java/lang/String className, https://developer.android.com/reference/java/lang/String permission) ` Asserts that launching a given activity is protected by a particular permission by attempting to start the activity and validating that a `https://developer.android.com/reference/java/lang/SecurityException` is thrown that mentions the permission in its error message. | | ` void` | ` https://developer.android.com/reference/android/test/AndroidTestCase#assertReadingContentUriRequiresPermission(android.net.Uri,%20java.lang.String)(https://developer.android.com/reference/android/net/Uri uri, https://developer.android.com/reference/java/lang/String permission) ` Asserts that reading from the content uri requires a particular permission by querying the uri and ensuring a `https://developer.android.com/reference/java/lang/SecurityException` is thrown mentioning the particular permission. | | ` void` | ` https://developer.android.com/reference/android/test/AndroidTestCase#assertWritingContentUriRequiresPermission(android.net.Uri,%20java.lang.String)(https://developer.android.com/reference/android/net/Uri uri, https://developer.android.com/reference/java/lang/String permission) ` Asserts that writing to the content uri requires a particular permission by inserting into the uri and ensuring a `https://developer.android.com/reference/java/lang/SecurityException` is thrown mentioning the particular permission. | | ` https://developer.android.com/reference/android/content/Context` | ` https://developer.android.com/reference/android/test/AndroidTestCase#getContext()() ` | | ` https://developer.android.com/reference/android/content/Context` | ` https://developer.android.com/reference/android/test/AndroidTestCase#getTestContext()() ` Returns the test context that was set via `https://developer.android.com/reference/android/test/AndroidTestCase#setTestContext(android.content.Context)`. | | ` void` | ` https://developer.android.com/reference/android/test/AndroidTestCase#scrubClass(java.lang.Class<?>)(https://developer.android.com/reference/java/lang/Class<?> testCaseClass) ` This function is called by various TestCase implementations, at tearDown() time, in order to scrub out any class variables. | | ` void` | ` https://developer.android.com/reference/android/test/AndroidTestCase#setContext(android.content.Context)(https://developer.android.com/reference/android/content/Context context) ` | | ` void` | ` https://developer.android.com/reference/android/test/AndroidTestCase#setTestContext(android.content.Context)(https://developer.android.com/reference/android/content/Context context) ` Test context can be used to access resources from the test's own package as opposed to the resources from the test target package. | | ` void` | ` https://developer.android.com/reference/android/test/AndroidTestCase#setUp()() ` | | ` void` | ` https://developer.android.com/reference/android/test/AndroidTestCase#tearDown()() ` | | ` void` | ` https://developer.android.com/reference/android/test/AndroidTestCase#testAndroidTestCaseSetupProperly()() ` | ||
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Public constructors

### LoaderTestCase

```
public LoaderTestCase ()
```

<br />

<br />

## Public methods

### getLoaderResultSynchronously

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public T getLoaderResultSynchronously (Loader<T> loader)
```

Runs a Loader synchronously and returns the result of the load. The loader will
be started, stopped, and destroyed by this method so it cannot be reused.

<br />

| Parameters ||
|---|---|
| `loader` | `Loader`: The loader to run synchronously <br /> |

| Returns ||
|---|---|
| `T` | The result from the loader <br /> |