summaryrefslogtreecommitdiff
path: root/src/test/java/com/keuin/kbackupfabric/backup/name
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-01-24 20:01:17 +0800
committerkeuin <[email protected]>2021-01-24 20:01:17 +0800
commit5063ab12c48a6612d903c44c943230b6c323f602 (patch)
tree38ad6cf5f48377142a1d2fabfb1122eb9a681421 /src/test/java/com/keuin/kbackupfabric/backup/name
parentdfd27f1a01a612c39bc17cac9793c80cc9b72e6b (diff)
Code refactor: eliminate unnecessary instance creation of IncrementalBackupFileNameEncoder
Diffstat (limited to 'src/test/java/com/keuin/kbackupfabric/backup/name')
-rw-r--r--src/test/java/com/keuin/kbackupfabric/backup/name/IncrementalBackupFileNameEncoderTest.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/java/com/keuin/kbackupfabric/backup/name/IncrementalBackupFileNameEncoderTest.java b/src/test/java/com/keuin/kbackupfabric/backup/name/IncrementalBackupFileNameEncoderTest.java
index f9695d5..0576c3e 100644
--- a/src/test/java/com/keuin/kbackupfabric/backup/name/IncrementalBackupFileNameEncoderTest.java
+++ b/src/test/java/com/keuin/kbackupfabric/backup/name/IncrementalBackupFileNameEncoderTest.java
@@ -11,7 +11,7 @@ public class IncrementalBackupFileNameEncoderTest {
public void testEncode() {
LocalDateTime time = LocalDateTime.of(1, 1, 1, 1, 1, 1);
String customName = "name";
- IncrementalBackupFileNameEncoder encoder = new IncrementalBackupFileNameEncoder();
+ IncrementalBackupFileNameEncoder encoder = IncrementalBackupFileNameEncoder.INSTANCE;
assertEquals("incremental-0001-01-01_01-01-01_name.kbi", encoder.encode(customName, time));
}
@@ -19,7 +19,7 @@ public class IncrementalBackupFileNameEncoderTest {
public void testDecode() {
LocalDateTime time = LocalDateTime.of(1, 1, 1, 1, 1, 1);
String customName = "name";
- IncrementalBackupFileNameEncoder encoder = new IncrementalBackupFileNameEncoder();
+ IncrementalBackupFileNameEncoder encoder = IncrementalBackupFileNameEncoder.INSTANCE;
BackupFileNameEncoder.BackupBasicInformation information = encoder.decode("incremental-0001-01-01_01-01-01_name.kbi");
assertEquals(time, information.time);
assertEquals(customName, information.customName);
@@ -27,7 +27,7 @@ public class IncrementalBackupFileNameEncoderTest {
@Test
public void isValid() {
- IncrementalBackupFileNameEncoder encoder = new IncrementalBackupFileNameEncoder();
+ IncrementalBackupFileNameEncoder encoder = IncrementalBackupFileNameEncoder.INSTANCE;
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"));