@Test public void testDoesNotThrowOnInvalidOrMissingId() { assertThat(loader.buildLoadData(1234, 0, 0, options)).isNull(); verify(uriLoader, never()).buildLoadData(any(Uri.class), anyInt(), anyInt(), any(Options.class)); } }
@Test public void testCanHandleId() { int id = android.R.drawable.star_off; Uri contentUri = Uri.parse("android.resource://android/drawable/star_off"); when(uriLoader.buildLoadData(eq(contentUri), anyInt(), anyInt(), any(Options.class))) .thenReturn(new ModelLoader.LoadData<>(key, fetcher)); assertTrue(loader.handles(id)); assertEquals( fetcher, Preconditions.checkNotNull(loader.buildLoadData(id, 100, 100, new Options())).fetcher); }