package com.ruoyi.web.controller.system;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;
import com.ruoyi.common.utils.PasswordStrengthUtils;

class PasswordStrengthUtilsTest
{
    @Test
    void shouldAcceptStrongPassword()
    {
        assertTrue(PasswordStrengthUtils.isStrongPassword("Abc123@#"));
    }

    @Test
    void shouldRejectPasswordWithoutRequiredCharacterTypes()
    {
        assertFalse(PasswordStrengthUtils.isStrongPassword("abc123@#"));
        assertFalse(PasswordStrengthUtils.isStrongPassword("ABC123@#"));
        assertFalse(PasswordStrengthUtils.isStrongPassword("Abcdef@#"));
        assertFalse(PasswordStrengthUtils.isStrongPassword("Abc12345"));
    }

    @Test
    void shouldRejectPasswordWithInvalidLengthOrIllegalCharacters()
    {
        assertFalse(PasswordStrengthUtils.isStrongPassword(null));
        assertFalse(PasswordStrengthUtils.isStrongPassword("Ab1@"));
        assertFalse(PasswordStrengthUtils.isStrongPassword("Abc1234567890123456@#"));
        assertFalse(PasswordStrengthUtils.isStrongPassword("Abc 123@"));
        assertFalse(PasswordStrengthUtils.isStrongPassword("Abc123<@"));
        assertFalse(PasswordStrengthUtils.isStrongPassword("Abc123\\@"));
        assertFalse(PasswordStrengthUtils.isStrongPassword("Abc123|@"));
    }
}
