### Question:
LoaderManager { @MainThread @NonNull public abstract <D> Loader<D> initLoader(int id, @Nullable Bundle args, @NonNull LoaderManager.LoaderCallbacks<D> callback);  @NonNull static LoaderManager getInstance(
            @NonNull T owner); @MainThread @NonNull abstract Loader<D> initLoader(int id, @Nullable Bundle args,
            @NonNull LoaderManager.LoaderCallbacks<D> callback); @MainThread @NonNull abstract Loader<D> restartLoader(int id, @Nullable Bundle args,
            @NonNull LoaderManager.LoaderCallbacks<D> callback); @MainThread abstract void destroyLoader(int id); @Nullable abstract Loader<D> getLoader(int id); abstract void markForRedelivery(); @Deprecated abstract void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args); static void enableDebugLogging(boolean enabled); boolean hasRunningLoaders();  }### Answer:
@UiThreadTest @Test(expected = IllegalArgumentException.class) public void enforceNonNullLoader() { mLoaderManager.initLoader(-1, null, new LoaderManager.LoaderCallbacks<Object>() { @Override public Loader<Object> onCreateLoader(int id, Bundle args) { return null; } @Override public void onLoadFinished(Loader<Object> loader, Object data) { } @Override public void onLoaderReset(Loader<Object> loader) { } }); }
@Test(expected = IllegalStateException.class) public void enforceOnMainThread_initLoader() { mLoaderManager.initLoader(-1, null, new DummyLoaderCallbacks(mock(Context.class))); }