diff options
author | Keuin <[email protected]> | 2021-01-20 19:50:42 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2021-01-20 19:50:42 +0800 |
commit | ac7e70883c18602e7fd4b525b9e6fb9ea9620a6b (patch) | |
tree | 63b2d65d2fe489ef0cc1fe6e9a87b65c0b69de84 /src/test/java/com/keuin/kbackupfabric/util/backup/name | |
parent | 7a5297de3467b1069fdf5e4a1b2aaf510ca35663 (diff) |
refactor
Diffstat (limited to 'src/test/java/com/keuin/kbackupfabric/util/backup/name')
2 files changed, 0 insertions, 88 deletions
diff --git a/src/test/java/com/keuin/kbackupfabric/util/backup/name/IncrementalBackupFileNameEncoderTest.java b/src/test/java/com/keuin/kbackupfabric/util/backup/name/IncrementalBackupFileNameEncoderTest.java deleted file mode 100644 index e5fedd7..0000000 --- a/src/test/java/com/keuin/kbackupfabric/util/backup/name/IncrementalBackupFileNameEncoderTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.keuin.kbackupfabric.util.backup.name; - -import org.junit.Test; - -import java.time.LocalDateTime; - -import static org.junit.Assert.*; - -public class IncrementalBackupFileNameEncoderTest { - @Test - public void testEncode() { - LocalDateTime time = LocalDateTime.of(1, 1, 1, 1, 1, 1); - String customName = "name"; - IncrementalBackupFileNameEncoder encoder = new IncrementalBackupFileNameEncoder(); - assertEquals("incremental-0001-01-01_01-01-01_name.kbi", encoder.encode(customName, time)); - } - - @Test - public void testDecode() { - LocalDateTime time = LocalDateTime.of(1, 1, 1, 1, 1, 1); - String customName = "name"; - IncrementalBackupFileNameEncoder encoder = new IncrementalBackupFileNameEncoder(); - BackupFileNameEncoder.BackupBasicInformation information = encoder.decode("incremental-0001-01-01_01-01-01_name.kbi"); - assertEquals(time, information.time); - assertEquals(customName, information.customName); - } - - @Test - public void isValid() { - IncrementalBackupFileNameEncoder encoder = new IncrementalBackupFileNameEncoder(); - assertTrue(encoder.isValidFileName("incremental-0001-01-01_01-01-01_name.kbi")); - assertTrue(encoder.isValidFileName("incremental-0001-01-01_01-01-01_0001-01-01_01-01-01_name.kbi")); - assertFalse(encoder.isValidFileName("incremental-0001-01-01_01-01-01incremental-0001-01-01_01-01-01_name.kbi")); - assertFalse(encoder.isValidFileName("incremental-0001-01-01_01-01-01_name")); - assertFalse(encoder.isValidFileName("incremental-0001-01-01_01-01-01_name.zip")); - assertFalse(encoder.isValidFileName("somefile")); - } -}
\ No newline at end of file diff --git a/src/test/java/com/keuin/kbackupfabric/util/backup/name/PrimitiveBackupFileNameEncoderTest.java b/src/test/java/com/keuin/kbackupfabric/util/backup/name/PrimitiveBackupFileNameEncoderTest.java deleted file mode 100644 index abc19d5..0000000 --- a/src/test/java/com/keuin/kbackupfabric/util/backup/name/PrimitiveBackupFileNameEncoderTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.keuin.kbackupfabric.util.backup.name; - -import org.junit.Test; - -import java.time.LocalDateTime; -import java.time.ZoneOffset; - -import static org.junit.Assert.*; - -public class PrimitiveBackupFileNameEncoderTest { - - @Test - public void testConsistency() { - LocalDateTime time = LocalDateTime.ofEpochSecond(System.currentTimeMillis() / 1000, 0, ZoneOffset.UTC); - String name = "Test Na_me"; - PrimitiveBackupFileNameEncoder encoder = new PrimitiveBackupFileNameEncoder(); - BackupFileNameEncoder.BackupBasicInformation information = encoder.decode(encoder.encode(name, time)); - assertEquals(time, information.time); - assertEquals(name, information.customName); - } - - @Test - public void testEncode() { - LocalDateTime time = LocalDateTime.of(1, 1, 1, 1, 1, 1); - String customName = "name"; - PrimitiveBackupFileNameEncoder encoder = new PrimitiveBackupFileNameEncoder(); - assertEquals("kbackup-0001-01-01_01-01-01_name.zip", encoder.encode(customName, time)); - } - - @Test - public void testDecode() { - LocalDateTime time = LocalDateTime.of(1, 1, 1, 1, 1, 1); - String customName = "name"; - PrimitiveBackupFileNameEncoder encoder = new PrimitiveBackupFileNameEncoder(); - BackupFileNameEncoder.BackupBasicInformation information = encoder.decode("kbackup-0001-01-01_01-01-01_name.zip"); - assertEquals(time, information.time); - assertEquals(customName, information.customName); - } - - @Test - public void isValid() { - PrimitiveBackupFileNameEncoder encoder = new PrimitiveBackupFileNameEncoder(); - assertTrue(encoder.isValidFileName("kbackup-0001-01-01_01-01-01_name.zip")); - assertTrue(encoder.isValidFileName("kbackup-0001-01-01_01-01-01_0001-01-01_01-01-01_name.zip")); - assertFalse(encoder.isValidFileName("kbackup-0001-01-01_01-01-01kbackup-0001-01-01_01-01-01_name.zip")); - assertFalse(encoder.isValidFileName("kbackup-0001-01-01_01-01-01_name")); - assertFalse(encoder.isValidFileName("kbackup-0001-01-01_01-01-01_name.kbi")); - assertFalse(encoder.isValidFileName("somefile")); - } -}
\ No newline at end of file |