From a2a5e2f4663c816661c48af9aa5518fc47551102 Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Thu, 3 Oct 2024 15:05:09 +0200 Subject: [PATCH] Add missing PostifxedFileName tests --- .../swisstransfer/PostifxedFileNameUnitTest.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/test/java/com/infomaniak/swisstransfer/PostifxedFileNameUnitTest.kt b/app/src/test/java/com/infomaniak/swisstransfer/PostifxedFileNameUnitTest.kt index 2f024595a..43bba2161 100644 --- a/app/src/test/java/com/infomaniak/swisstransfer/PostifxedFileNameUnitTest.kt +++ b/app/src/test/java/com/infomaniak/swisstransfer/PostifxedFileNameUnitTest.kt @@ -72,6 +72,16 @@ class PostifxedFileNameUnitTest { assertAlreadyExistingFileName(inputFileName = "file.abc.def.ghi", expectedFileName = "file.abc.def(1).ghi") } + @Test + fun unusedDotEndingFileName_isUnchanged() { + assertNewFileNameIsUnchanged(inputFileName = "file.") + } + + @Test + fun usedDotEndingFileName_isPostfixed() { + assertAlreadyExistingFileName(inputFileName = "file.", expectedFileName = "file(1).") + } + private fun assertAlreadyExistingFileName(inputFileName: String, expectedFileName: String) { val newName = postfixExistingFileNames(inputFileName, setOf(inputFileName)) assertEquals(newName, expectedFileName)