FileProvider extends SavingStreamProvider { @Override protected InputStream stream() throws IOException { File f = new File(request.uri().getPath()); InputStream in = new FileInputStream(f); return in; } FileProvider(MirageRequest request);   }
@Test public void testLoads() throws IOException { MirageRequest request = mock(MirageRequest.class); UrlFactory factory = mock(UrlFactory.class); InputStream inputStream = mock(InputStream.class); when(factory.getStream(any(Uri.class))).thenReturn(inputStream); when(request.urlFactory()).thenReturn(factory); FileProvider provider = new FileProvider(request); when(request.provider()).thenReturn(provider); File file = File.createTempFile("prefix", "suffix"); when(request.uri()).thenReturn(Uri.fromFile(file)); InputStream stream = provider.stream(); Assert.assertNotNull(stream); verify(request, times(1)).uri(); }