summaryrefslogtreecommitdiff
path: root/src/test/java/com/keuin/kbackupfabric/util/backup/name/PrimitiveBackupFileNameEncoderTest.java
blob: 48235754d59ffc8a7da3028bdba684f57dcc6c56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.keuin.kbackupfabric.util.backup.name;

import org.junit.Test;

import java.time.LocalDateTime;
import java.time.ZoneOffset;

import static org.junit.Assert.assertEquals;

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);
    }
}