diff options
author | ByteHamster <info@bytehamster.com> | 2020-07-03 18:16:59 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2020-07-03 18:16:59 +0200 |
commit | fb992ce6d1c4d6a2915043b9f97ff9b4307c058e (patch) | |
tree | 2c57de6b7632931f918586288515e894e9c5dd3c /app/src/androidTest/java | |
parent | 0e05a8af7b349d552fa70cd2f6da6dc3567c41ac (diff) | |
download | AntennaPod-fb992ce6d1c4d6a2915043b9f97ff9b4307c058e.zip |
Stripping accents before generating file name
Diffstat (limited to 'app/src/androidTest/java')
-rw-r--r-- | app/src/androidTest/java/de/test/antennapod/util/FilenameGeneratorTest.java | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/util/FilenameGeneratorTest.java b/app/src/androidTest/java/de/test/antennapod/util/FilenameGeneratorTest.java index 6f8042d61..93e5bcb74 100644 --- a/app/src/androidTest/java/de/test/antennapod/util/FilenameGeneratorTest.java +++ b/app/src/androidTest/java/de/test/antennapod/util/FilenameGeneratorTest.java @@ -21,32 +21,28 @@ import static org.junit.Assert.assertTrue; @SmallTest public class FilenameGeneratorTest { - private static final String VALID1 = "abc abc"; - private static final String INVALID1 = "ab/c: <abc"; - private static final String INVALID2 = "abc abc "; - public FilenameGeneratorTest() { super(); } @Test public void testGenerateFileName() throws IOException { - String result = FileNameGenerator.generateFileName(VALID1); - assertEquals(result, VALID1); + String result = FileNameGenerator.generateFileName("abc abc"); + assertEquals(result, "abc abc"); createFiles(result); } @Test public void testGenerateFileName1() throws IOException { - String result = FileNameGenerator.generateFileName(INVALID1); - assertEquals(result, VALID1); + String result = FileNameGenerator.generateFileName("ab/c: <abc"); + assertEquals(result, "abc abc"); createFiles(result); } @Test public void testGenerateFileName2() throws IOException { - String result = FileNameGenerator.generateFileName(INVALID2); - assertEquals(result, VALID1); + String result = FileNameGenerator.generateFileName("abc abc "); + assertEquals(result, "abc abc"); createFiles(result); } @@ -63,6 +59,12 @@ public class FilenameGeneratorTest { } @Test + public void testFeedTitleContainsAccents() { + String result = FileNameGenerator.generateFileName("Äàáâãå"); + assertEquals("Aaaaaa", result); + } + + @Test public void testInvalidInput() { String result = FileNameGenerator.generateFileName("???"); assertFalse(TextUtils.isEmpty(result)); @@ -97,14 +99,6 @@ public class FilenameGeneratorTest { assertTrue(testFile.exists()); testFile.delete(); assertTrue(testFile.createNewFile()); - - } - - @After - public void tearDown() { - Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); - File f = new File(context.getExternalCacheDir(), VALID1); - f.delete(); } } |