package edu.whut.smilepicturebackend;

import edu.whut.smilepicturebackend.exception.BusinessException;
import edu.whut.smilepicturebackend.exception.ErrorCode;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import javax.annotation.Resource;

@SpringBootTest
public class PasswordEncoderTest {
    @Resource
    private BCryptPasswordEncoder passwordEncoder;
    @Test
    public void testEncodeAndMatch() {
        String db_password="$2a$12$UkjfiognXnI0Kv5t3oUNaunVVbsEakMXyzeXjeMO84B/PzuurnsD6";
        String password="12345678";
        // 原始明文
        if (!passwordEncoder.matches(password, db_password)) {
            System.out.println("no");
        }
        System.out.println("yes");
    }

}
