mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-11-04 17:23:12 +00:00
Revert all commits related to ContentSettingsFragment
Revert "Annotate methode parameters as NonNull" This reverts commit004907d306. Revert "Commit path immediately when import backup" This reverts commit05eb0d0fbe. Revert "Set ImportExportDataPath only on successful import" This reverts commitf13a1b04e6. Revert "Set ImportExportDataPath only on successful export" This reverts commitfd4408e572. Revert "Invert if condition in ContentSettingsFragment.setImportExportDataPath for better readability" This reverts commit92ab9cae27. Revert "Move ContentSettingsFragment.isValidPath to helpers and add unit test for it." This reverts commitfa2b11b768. Revert "Save backup import/export location for feature import/exports" This reverts commit82f43ac6a6. Remove FilePathHelperTest file
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
package org.schabi.newpipe.util;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class FilePathHelperTest {
|
||||
|
||||
private Path dir;
|
||||
|
||||
@Before
|
||||
public void setUp() throws IOException {
|
||||
dir = Files.createTempDirectory("dir1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsValidDirectoryPathWithEmptyString() {
|
||||
assertFalse(FilePathUtils.isValidDirectoryPath(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsValidDirectoryPathWithNullString() {
|
||||
assertFalse(FilePathUtils.isValidDirectoryPath(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsValidDirectoryPathWithValidPath() {
|
||||
assertTrue(FilePathUtils.isValidDirectoryPath(dir.toAbsolutePath().toString()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsValidDirectoryPathWithDeepValidDirectory() throws IOException {
|
||||
final File subDir = Files.createDirectory(dir.resolve("subdir")).toFile();
|
||||
assertTrue(FilePathUtils.isValidDirectoryPath(subDir.getAbsolutePath()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsValidDirectoryPathWithNotExistDirectory() {
|
||||
assertFalse(FilePathUtils.isValidDirectoryPath(dir.resolve("not-exists-subdir").
|
||||
toFile().getAbsolutePath()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsValidDirectoryPathWithFile() throws IOException {
|
||||
final File tempFile = Files.createFile(dir.resolve("simple_file")).toFile();
|
||||
assertFalse(FilePathUtils.isValidDirectoryPath(tempFile.getAbsolutePath()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user