package cn.novalon.gym.manage.sys.core.query;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class SysRoleQueryTest {

    @Test
    void testGettersAndSetters() {
        SysRoleQuery query = new SysRoleQuery();
        
        query.setRoleName("admin");
        query.setRoleKey("admin");
        query.setStatus(1);
        query.setKeyword("admin");
        
        assertEquals("admin", query.getRoleName());
        assertEquals("admin", query.getRoleKey());
        assertEquals(1, query.getStatus());
        assertEquals("admin", query.getKeyword());
    }

    @Test
    void testSetNullValues() {
        SysRoleQuery query = new SysRoleQuery();
        
        query.setRoleName(null);
        query.setRoleKey(null);
        query.setStatus(null);
        query.setKeyword(null);
        
        assertNull(query.getRoleName());
        assertNull(query.getRoleKey());
        assertNull(query.getStatus());
        assertNull(query.getKeyword());
    }

    @Test
    void testSetEmptyStringValues() {
        SysRoleQuery query = new SysRoleQuery();
        
        query.setRoleName("");
        query.setRoleKey("");
        query.setKeyword("");
        
        assertEquals("", query.getRoleName());
        assertEquals("", query.getRoleKey());
        assertEquals("", query.getKeyword());
    }

    @Test
    void testSetMultipleValues() {
        SysRoleQuery query = new SysRoleQuery();
        
        query.setRoleName("user");
        query.setRoleKey("user");
        query.setStatus(0);
        query.setKeyword("user");
        
        assertEquals("user", query.getRoleName());
        assertEquals("user", query.getRoleKey());
        assertEquals(0, query.getStatus());
        assertEquals("user", query.getKeyword());
    }

    @Test
    void testSetLongRoleName() {
        SysRoleQuery query = new SysRoleQuery();
        String longRoleName = "a".repeat(100);
        query.setRoleName(longRoleName);
        assertEquals(longRoleName, query.getRoleName());
    }

    @Test
    void testSetLongRoleKey() {
        SysRoleQuery query = new SysRoleQuery();
        String longRoleKey = "a".repeat(100);
        query.setRoleKey(longRoleKey);
        assertEquals(longRoleKey, query.getRoleKey());
    }

    @Test
    void testSetLongKeyword() {
        SysRoleQuery query = new SysRoleQuery();
        String longKeyword = "a".repeat(100);
        query.setKeyword(longKeyword);
        assertEquals(longKeyword, query.getKeyword());
    }

    @Test
    void testSetNegativeStatus() {
        SysRoleQuery query = new SysRoleQuery();
        query.setStatus(-1);
        assertEquals(-1, query.getStatus());
    }

    @Test
    void testSetZeroStatus() {
        SysRoleQuery query = new SysRoleQuery();
        query.setStatus(0);
        assertEquals(0, query.getStatus());
    }

    @Test
    void testSetPositiveStatus() {
        SysRoleQuery query = new SysRoleQuery();
        query.setStatus(1);
        assertEquals(1, query.getStatus());
    }

    @Test
    void testSetSpecialCharactersInRoleName() {
        SysRoleQuery query = new SysRoleQuery();
        query.setRoleName("role@#$%");
        assertEquals("role@#$%", query.getRoleName());
    }

    @Test
    void testSetSpecialCharactersInRoleKey() {
        SysRoleQuery query = new SysRoleQuery();
        query.setRoleKey("role@#$%");
        assertEquals("role@#$%", query.getRoleKey());
    }

    @Test
    void testSetSpecialCharactersInKeyword() {
        SysRoleQuery query = new SysRoleQuery();
        query.setKeyword("keyword@#$%");
        assertEquals("keyword@#$%", query.getKeyword());
    }

    @Test
    void testSetWhitespaceInValues() {
        SysRoleQuery query = new SysRoleQuery();
        
        query.setRoleName("  test role  ");
        query.setRoleKey("  test key  ");
        query.setKeyword("  test keyword  ");
        
        assertEquals("  test role  ", query.getRoleName());
        assertEquals("  test key  ", query.getRoleKey());
        assertEquals("  test keyword  ", query.getKeyword());
    }

    @Test
    void testSetUnicodeCharacters() {
        SysRoleQuery query = new SysRoleQuery();
        
        query.setRoleName("角色名");
        query.setRoleKey("角色键");
        query.setKeyword("关键词");
        
        assertEquals("角色名", query.getRoleName());
        assertEquals("角色键", query.getRoleKey());
        assertEquals("关键词", query.getKeyword());
    }

    @Test
    void testSetNumbersInRoleName() {
        SysRoleQuery query = new SysRoleQuery();
        query.setRoleName("role123");
        assertEquals("role123", query.getRoleName());
    }

    @Test
    void testSetNumbersInRoleKey() {
        SysRoleQuery query = new SysRoleQuery();
        query.setRoleKey("role123");
        assertEquals("role123", query.getRoleKey());
    }

    @Test
    void testSetUnderscoreInValues() {
        SysRoleQuery query = new SysRoleQuery();
        
        query.setRoleName("test_role");
        query.setRoleKey("test_role");
        query.setKeyword("test_keyword");
        
        assertEquals("test_role", query.getRoleName());
        assertEquals("test_role", query.getRoleKey());
        assertEquals("test_keyword", query.getKeyword());
    }

    @Test
    void testSetHyphenInValues() {
        SysRoleQuery query = new SysRoleQuery();
        
        query.setRoleName("test-role");
        query.setRoleKey("test-role");
        query.setKeyword("test-keyword");
        
        assertEquals("test-role", query.getRoleName());
        assertEquals("test-role", query.getRoleKey());
        assertEquals("test-keyword", query.getKeyword());
    }

    @Test
    void testSetDotInValues() {
        SysRoleQuery query = new SysRoleQuery();
        
        query.setRoleName("test.role");
        query.setRoleKey("test.role");
        query.setKeyword("test.keyword");
        
        assertEquals("test.role", query.getRoleName());
        assertEquals("test.role", query.getRoleKey());
        assertEquals("test.keyword", query.getKeyword());
    }
}
