Java 类org.robolectric.shadows.ShadowMimeTypeMap 实例源码

项目:GitHub    文件:MediaUtilsTest.java   
@Test
public void testExtractMimeNativelySupportedFileExtension() {
  ShadowMimeTypeMap mimeTypeMap = Shadows.shadowOf(MimeTypeMap.getSingleton());
  mimeTypeMap.addExtensionMimeTypMapping("jpg", "image/jpg");

  String path = "file/with/natively/supported/extension.jpg";
  assertThat(MediaUtils.extractMime(path)).isEqualTo("image/jpg");
}
项目:twitter-kit-android    文件:FileUtilsTest.java   
@Before
public void setUp() {
    final ShadowMimeTypeMap mimeTypeMap = (ShadowMimeTypeMap) ShadowExtractor
            .extract(MimeTypeMap.getSingleton());
    mimeTypeMap.addExtensionMimeTypMapping("jpg", "image/jpeg");
    mimeTypeMap.addExtensionMimeTypMapping("jpeg", "image/jpeg");
    mimeTypeMap.addExtensionMimeTypMapping("png", "image/png");
    this.mimeTypeMap = mimeTypeMap;
}
项目:fresco    文件:MediaUtilsTest.java   
@Test
public void testExtractMimeNativelySupportedFileExtension() {
  ShadowMimeTypeMap mimeTypeMap = Shadows.shadowOf(MimeTypeMap.getSingleton());
  mimeTypeMap.addExtensionMimeTypMapping("jpg", "image/jpg");

  String path = "file/with/natively/supported/extension.jpg";
  assertThat(MediaUtils.extractMime(path)).isEqualTo("image/jpg");
}
项目:Onosendai    文件:CachedImageFileProviderTest.java   
@Test
public void itAddsExtension () throws Exception {
    final ShadowMimeTypeMap shadowMimeTypeMap = Robolectric.shadowOf(MimeTypeMap.getSingleton());
    shadowMimeTypeMap.addExtensionMimeTypMapping("png", "image/png");

    final File picFile = this.tmp.newFile();
    IoHelper.copy(new File("./res/drawable-hdpi/ic_hosaka_meji.png"), picFile); // Just something to test with.
    final List<File> actual = CachedImageFileProvider.addFileExtensions(Collections.singletonList(picFile));
    assertThat(actual, hasItem(new File(picFile.getAbsolutePath() + ".png")));
}
项目:FullRobolectricTestSample    文件:Robolectric.java   
public static ShadowMimeTypeMap shadowOf(MimeTypeMap instance) {
  return (ShadowMimeTypeMap) shadowOf_(instance);
}