package io.flutter.plugins.pathprovider;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;

import android.os.Environment;
import org.junit.Test;

public class StorageDirectoryMapperTest {

  @org.junit.Test
  public void testAndroidType_null() {
    assertNull(StorageDirectoryMapper.androidType(null));
  }

  @org.junit.Test
  public void testAndroidType_valid() {
    assertEquals(Environment.DIRECTORY_MUSIC, StorageDirectoryMapper.androidType(0));
    assertEquals(Environment.DIRECTORY_PODCASTS, StorageDirectoryMapper.androidType(1));
    assertEquals(Environment.DIRECTORY_MUSIC, StorageDirectoryMapper.androidType(2));
    assertEquals(Environment.DIRECTORY_RINGTONES, StorageDirectoryMapper.androidType(3));
    assertEquals(Environment.DIRECTORY_ALARMS, StorageDirectoryMapper.androidType(4));
    assertEquals(Environment.DIRECTORY_NOTIFICATIONS, StorageDirectoryMapper.androidType(5));
    assertEquals(Environment.DIRECTORY_PICTURES, StorageDirectoryMapper.androidType(6));
    assertEquals(Environment.DIRECTORY_MOVIES, StorageDirectoryMapper.androidType(7));
    assertEquals(Environment.DIRECTORY_DOWNLOADS, StorageDirectoryMapper.androidType(8));
    assertEquals(Environment.DIRECTORY_DCIM, StorageDirectoryMapper.androidType(9));
  }

  @Test
  public void testAndroidType_invalid() {
    try {
      assertEquals(Environment.DIRECTORY_DCIM, StorageDirectoryMapper.androidType(10));
      fail();
    } catch (IllegalArgumentException e) {
      assertEquals("Unknown index: " + 10, e.getMessage());
    }
  }
}

@@ -616,94 +616,8 @@
 ));%0A
-    assertEquals(Environment.DIRECTORY_MUSIC, StorageDirectoryMapper.androidType(2));%0A
     
@@ -701,9 +701,9 @@
 ype(
-3
+2
 ));%0A
@@ -788,9 +788,9 @@
 ype(
-4
+3
 ));%0A
@@ -882,9 +882,9 @@
 ype(
-5
+4
 ));%0A
@@ -971,9 +971,9 @@
 ype(
-6
+5
 ));%0A
@@ -1058,9 +1058,9 @@
 ype(
-7
+6
 ));%0A
@@ -1148,9 +1148,9 @@
 ype(
-8
+7
 ));%0A
@@ -1233,9 +1233,9 @@
 ype(
-9
+8
 ));%0A

Fix misaligned enum values in StorageDirectoryMapperTest (#2628)