package com.qmth.boot.test.tools.codec;

import com.qmth.boot.tools.codec.CodecUtils;
import org.junit.Assert;
import org.junit.Test;

import java.nio.charset.StandardCharsets;

public class CodecTest {

    @Test
    public void test() {
        String content = "123456";
        byte[] value = content.getBytes(StandardCharsets.UTF_8);
        Assert.assertEquals(content,
                new String(CodecUtils.fromBase64(CodecUtils.toBase64(value)), StandardCharsets.UTF_8));
        Assert.assertEquals(content,
                new String(CodecUtils.fromHexString(CodecUtils.toHexString(value)), StandardCharsets.UTF_8));
    }

}
