package com.app;

import cn.hutool.core.util.IdUtil;
import com.app.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;

import java.text.NumberFormat;
import java.util.Date;
import java.util.Locale;

/**
 * 功能描述：
 *
 * @Auther: 梁展鹏
 * @Date: 2018/7/19 16:22
 */
@Slf4j
public class SimpleTestMethod {

    @Test
    public void testSetEncodePassword() {
        String password = "leban123";
        String encodePasswd = new BCryptPasswordEncoder().encode(password);
        log.info("encodePasswd --> {}", encodePasswd);

        encodePasswd = PasswordEncoderFactories.createDelegatingPasswordEncoder().encode(password);
        log.info("encodePasswd --> {}", encodePasswd);

        log.info(IdUtil.simpleUUID());

        Date date = DateUtil.format("20141030133525", DateUtil.yyyyMMddHHmmss);
        log.info("[{}]", date);
    }

    @Test
    public void testFormat() {
        Double price = 123123123123.0001D;
        NumberFormat curFormat = NumberFormat.getCurrencyInstance(Locale.CHINA);
        log.info(String.format("%s元", curFormat.format(price)));
    }

}
