Search in sources :

Example 1 with ConnectivityMonitorFactory

use of com.bumptech.glide.manager.ConnectivityMonitorFactory in project glide by bumptech.

the class RequestManagerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    connectivityMonitor = mock(ConnectivityMonitor.class);
    ConnectivityMonitorFactory factory = mock(ConnectivityMonitorFactory.class);
    when(factory.build(isA(Context.class), isA(ConnectivityMonitor.ConnectivityListener.class))).thenAnswer(new Answer<ConnectivityMonitor>() {

        @Override
        public ConnectivityMonitor answer(InvocationOnMock invocation) throws Throwable {
            connectivityListener = (ConnectivityListener) invocation.getArguments()[1];
            return connectivityMonitor;
        }
    });
    requestTracker = mock(RequestTracker.class);
    manager = new RequestManager(Glide.get(RuntimeEnvironment.application), lifecycle, treeNode, requestTracker, factory);
}
Also used : Context(android.content.Context) InvocationOnMock(org.mockito.invocation.InvocationOnMock) ConnectivityListener(com.bumptech.glide.manager.ConnectivityMonitor.ConnectivityListener) ConnectivityMonitor(com.bumptech.glide.manager.ConnectivityMonitor) ConnectivityMonitorFactory(com.bumptech.glide.manager.ConnectivityMonitorFactory) RequestTracker(com.bumptech.glide.manager.RequestTracker) Before(org.junit.Before)

Aggregations

Context (android.content.Context)1 ConnectivityMonitor (com.bumptech.glide.manager.ConnectivityMonitor)1 ConnectivityListener (com.bumptech.glide.manager.ConnectivityMonitor.ConnectivityListener)1 ConnectivityMonitorFactory (com.bumptech.glide.manager.ConnectivityMonitorFactory)1 RequestTracker (com.bumptech.glide.manager.RequestTracker)1 Before (org.junit.Before)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1