summaryrefslogtreecommitdiff
path: root/src/test/java/com/keuin/kbackupfabric/backup/name
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-01-25 03:12:16 +0800
committerkeuin <[email protected]>2021-01-25 03:12:16 +0800
commita817715ad4f625e355b285d67ee323e8b2006ae4 (patch)
tree5f9ffa5b18152b7efc056e5b01f9126505b69179 /src/test/java/com/keuin/kbackupfabric/backup/name
parent93494e7e04e05beb4f07cfabdd14c674b97a12e5 (diff)
Code refactor
Diffstat (limited to 'src/test/java/com/keuin/kbackupfabric/backup/name')
-rw-r--r--src/test/java/com/keuin/kbackupfabric/backup/name/PrimitiveBackupFileNameEncoderTest.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/java/com/keuin/kbackupfabric/backup/name/PrimitiveBackupFileNameEncoderTest.java b/src/test/java/com/keuin/kbackupfabric/backup/name/PrimitiveBackupFileNameEncoderTest.java
index bb5f64b..2eae446 100644
--- a/src/test/java/com/keuin/kbackupfabric/backup/name/PrimitiveBackupFileNameEncoderTest.java
+++ b/src/test/java/com/keuin/kbackupfabric/backup/name/PrimitiveBackupFileNameEncoderTest.java
@@ -13,7 +13,7 @@ public class PrimitiveBackupFileNameEncoderTest {
public void testConsistency() {
LocalDateTime time = LocalDateTime.ofEpochSecond(System.currentTimeMillis() / 1000, 0, ZoneOffset.UTC);
String name = "Test Na_me";
- PrimitiveBackupFileNameEncoder encoder = new PrimitiveBackupFileNameEncoder();
+ PrimitiveBackupFileNameEncoder encoder = PrimitiveBackupFileNameEncoder.INSTANCE;
BackupFileNameEncoder.BackupBasicInformation information = encoder.decode(encoder.encode(name, time));
assertEquals(time, information.time);
assertEquals(name, information.customName);
@@ -23,7 +23,7 @@ public class PrimitiveBackupFileNameEncoderTest {
public void testEncode() {
LocalDateTime time = LocalDateTime.of(1, 1, 1, 1, 1, 1);
String customName = "name";
- PrimitiveBackupFileNameEncoder encoder = new PrimitiveBackupFileNameEncoder();
+ PrimitiveBackupFileNameEncoder encoder = PrimitiveBackupFileNameEncoder.INSTANCE;
assertEquals("kbackup-0001-01-01_01-01-01_name.zip", encoder.encode(customName, time));
}
@@ -31,7 +31,7 @@ public class PrimitiveBackupFileNameEncoderTest {
public void testDecode() {
LocalDateTime time = LocalDateTime.of(1, 1, 1, 1, 1, 1);
String customName = "name";
- PrimitiveBackupFileNameEncoder encoder = new PrimitiveBackupFileNameEncoder();
+ PrimitiveBackupFileNameEncoder encoder = PrimitiveBackupFileNameEncoder.INSTANCE;
BackupFileNameEncoder.BackupBasicInformation information = encoder.decode("kbackup-0001-01-01_01-01-01_name.zip");
assertEquals(time, information.time);
assertEquals(customName, information.customName);
@@ -39,7 +39,7 @@ public class PrimitiveBackupFileNameEncoderTest {
@Test
public void isValid() {
- PrimitiveBackupFileNameEncoder encoder = new PrimitiveBackupFileNameEncoder();
+ PrimitiveBackupFileNameEncoder encoder = PrimitiveBackupFileNameEncoder.INSTANCE;
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"));