use of com.bumptech.glide.load.model.MultiModelLoaderFactory in project glide by bumptech.
the class MockModelLoader method mock.
@SuppressWarnings("unchecked")
public static <ModelT, DataT> void mock(final ModelT model, final DataT data) {
Context context = InstrumentationRegistry.getTargetContext();
Glide.get(context).getRegistry().replace((Class<ModelT>) model.getClass(), (Class<DataT>) data.getClass(), new ModelLoaderFactory<ModelT, DataT>() {
@NonNull
@Override
public ModelLoader<ModelT, DataT> build(@NonNull MultiModelLoaderFactory multiFactory) {
return new MockModelLoader<>(model, data);
}
@Override
public void teardown() {
// Do nothing.
}
});
}
Aggregations