StoragePathProvider { public String getFormDbPath(String filePath) { return getDbPath(getDirPath(StorageSubdirectory.FORMS), filePath); } StoragePathProvider();  StoragePathProvider(StorageStateProvider storageStateProvider); String[] getOdkDirPaths(); String getScopedStorageRootDirPath(); String getUnscopedStorageRootDirPath(); String getUnscopedStorageDirPath(StorageSubdirectory subdirectory); String getDirPath(StorageSubdirectory subdirectory); String getStorageRootDirPath(); String getTmpFilePath(); String getTmpDrawFilePath(); String getInstanceDbPath(String filePath); String getAbsoluteInstanceFilePath(String filePath); String getFormDbPath(String filePath); String getAbsoluteFormFilePath(String filePath); String getCacheDbPath(String filePath); String getAbsoluteCacheFilePath(String filePath); String getRelativeFilePath(String dirPath, String filePath); @SuppressWarnings("PMD.DoNotHardCodeSDCard") String getRelativeMapLayerPath(String path); String getAbsoluteOfflineMapLayerPath(String path);  }
@Test public void getFormDbPathWithUnscopedStorageTest() { mockUsingUnscopedStorage(); assertThat(storagePathProvider.getFormDbPath("All widgets.xml"), is("/storage/emulated/0/odk/forms/All widgets.xml")); assertThat(storagePathProvider.getFormDbPath("/storage/emulated/0/odk/forms/All widgets.xml"), is("/storage/emulated/0/odk/forms/All widgets.xml")); assertThat(storagePathProvider.getFormDbPath("All widgets-media"), is("/storage/emulated/0/odk/forms/All widgets-media")); assertThat(storagePathProvider.getFormDbPath("/storage/emulated/0/odk/forms/All widgets-media"), is("/storage/emulated/0/odk/forms/All widgets-media")); assertThat(storagePathProvider.getFormDbPath("All widgets-media/itemsets.csv"), is("/storage/emulated/0/odk/forms/All widgets-media/itemsets.csv")); assertThat(storagePathProvider.getFormDbPath("/storage/emulated/0/odk/forms/All widgets-media/itemsets.csv"), is("/storage/emulated/0/odk/forms/All widgets-media/itemsets.csv")); }
@Test public void getFormDbPathWithScopedStorageTest() { mockUsingScopedStorage(); assertThat(storagePathProvider.getFormDbPath("All widgets.xml"), is("All widgets.xml")); assertThat(storagePathProvider.getFormDbPath("/storage/emulated/0/Android/data/org.odk.collect.android/files/forms/All widgets.xml"), is("All widgets.xml")); assertThat(storagePathProvider.getFormDbPath("All widgets-media"), is("All widgets-media")); assertThat(storagePathProvider.getFormDbPath("/storage/emulated/0/Android/data/org.odk.collect.android/files/forms/All widgets-media"), is("All widgets-media")); assertThat(storagePathProvider.getFormDbPath("All widgets-media/itemsets.csv"), is("All widgets-media/itemsets.csv")); assertThat(storagePathProvider.getFormDbPath("/storage/emulated/0/Android/data/org.odk.collect.android/files/forms/All widgets-media/itemsets.csv"), is("All widgets-media/itemsets.csv")); }