@@ -0,0 +1,2636 @@
+/*%0A * Copyright (c) 2015-present, Facebook, Inc.%0A * All rights reserved.%0A *%0A * This source code is licensed under the BSD-style license found in the%0A * LICENSE file in the root directory of this source tree. An additional grant%0A * of patent rights can be found in the PATENTS file in the same directory.%0A */%0A%0Apackage com.facebook.common.media;%0A%0Aimport android.webkit.MimeTypeMap;%0A%0Aimport com.facebook.testing.robolectric.v2.WithTestDefaultsRunner;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.robolectric.Robolectric;%0Aimport org.robolectric.shadows.ShadowMimeTypeMap;%0A%0Aimport static org.fest.assertions.api.Assertions.assertThat;%0A%0A@RunWith(WithTestDefaultsRunner.class)%0Apublic class MediaUtilsTest %7B%0A%0A  @Test%0A  public void testIsPhotoMimeTypeNull() %7B%0A    assertThat(MediaUtils.isPhoto(null)).isFalse();%0A  %7D%0A%0A  @Test%0A  public void testIsPhotoMimeTypeImage() %7B%0A    assertThat(MediaUtils.isPhoto(%22image/jpg%22)).isTrue();%0A  %7D%0A%0A  @Test%0A  public void testIsPhotoMimeTypeVideo() %7B%0A    assertThat(MediaUtils.isPhoto(%22video/mp4%22)).isFalse();%0A  %7D%0A%0A  @Test%0A  public void testIsVideoMimeTypeNull() %7B%0A    assertThat(MediaUtils.isVideo(null)).isFalse();%0A  %7D%0A%0A  @Test%0A  public void testIsVideoMimeTypeImage() %7B%0A    assertThat(MediaUtils.isVideo(%22image/jpg%22)).isFalse();%0A  %7D%0A%0A  @Test%0A  public void testIsVideoMimeTypeVideo() %7B%0A    assertThat(MediaUtils.isVideo(%22video/mp4%22)).isTrue();%0A  %7D%0A%0A  @Test%0A  public void testExtractMimeNoFileExtension() %7B%0A    String path = %22file/with/no/extension%22;%0A    assertThat(MediaUtils.extractMime(path)).isNull();%0A  %7D%0A%0A  @Test%0A  public void testExtractMimeNativelySupportedFileExtension() %7B%0A    ShadowMimeTypeMap mimeTypeMap = Robolectric.shadowOf(MimeTypeMap.getSingleton());%0A    mimeTypeMap.addExtensionMimeTypMapping(%22jpg%22, %22image/jpg%22);%0A%0A    String path = %22file/with/natively/supported/extension.jpg%22;%0A    assertThat(MediaUtils.extractMime(path)).isEqualTo(%22image/jpg%22);%0A  %7D%0A%0A  @Test%0A  public void testExtractMimeNonNativelySupportedFileExtension() %7B%0A    String path = %22file/with/non/natively/supported/extension.mkv%22;%0A    assertThat(MediaUtils.extractMime(path)).isEqualTo(%22video/x-matroska%22);%0A  %7D%0A%0A  @Test%0A  public void testExtractMimeUnsupportedFileExtension() %7B%0A    String path = %22file/with/unsupported/extension.zip%22;%0A    assertThat(MediaUtils.extractMime(path)).isNull();%0A  %7D%0A%0A  @Test%0A   public void testIsNonNativeSupportedMimeTypeNative() %7B%0A    assertThat(MediaUtils.isNonNativeSupportedMimeType(%22image/jpg%22)).isFalse();%0A  %7D%0A%0A  @Test%0A  public void testIsNonNativeSupportedMimeTypeNonNative() %7B%0A    assertThat(MediaUtils.isNonNativeSupportedMimeType(%22video/x-matroska%22)).isTrue();%0A  %7D%0A%7D%0A

Add unit tests for MediaUtils