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

import org.junit.jupiter.api.Test;

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

class SysUserQueryTest {

    @Test
    void testGettersAndSetters() {
        SysUserQuery query = new SysUserQuery();
        
        query.setUsername("testuser");
        query.setEmail("test@example.com");
        query.setRoleId(1L);
        query.setStatus(1);
        query.setKeyword("test");
        
        assertEquals("testuser", query.getUsername());
        assertEquals("test@example.com", query.getEmail());
        assertEquals(1L, query.getRoleId());
        assertEquals(1, query.getStatus());
        assertEquals("test", query.getKeyword());
    }

    @Test
    void testSetNullValues() {
        SysUserQuery query = new SysUserQuery();
        
        query.setUsername(null);
        query.setEmail(null);
        query.setRoleId(null);
        query.setStatus(null);
        query.setKeyword(null);
        
        assertNull(query.getUsername());
        assertNull(query.getEmail());
        assertNull(query.getRoleId());
        assertNull(query.getStatus());
        assertNull(query.getKeyword());
    }

    @Test
    void testSetEmptyStringValues() {
        SysUserQuery query = new SysUserQuery();
        
        query.setUsername("");
        query.setEmail("");
        query.setKeyword("");
        
        assertEquals("", query.getUsername());
        assertEquals("", query.getEmail());
        assertEquals("", query.getKeyword());
    }

    @Test
    void testSetMultipleValues() {
        SysUserQuery query = new SysUserQuery();
        
        query.setUsername("user1");
        query.setEmail("user1@example.com");
        query.setRoleId(2L);
        query.setStatus(0);
        query.setKeyword("user1");
        
        assertEquals("user1", query.getUsername());
        assertEquals("user1@example.com", query.getEmail());
        assertEquals(2L, query.getRoleId());
        assertEquals(0, query.getStatus());
        assertEquals("user1", query.getKeyword());
    }

    @Test
    void testSetLongUsername() {
        SysUserQuery query = new SysUserQuery();
        String longUsername = "a".repeat(100);
        query.setUsername(longUsername);
        assertEquals(longUsername, query.getUsername());
    }

    @Test
    void testSetLongEmail() {
        SysUserQuery query = new SysUserQuery();
        String longEmail = "a".repeat(100) + "@example.com";
        query.setEmail(longEmail);
        assertEquals(longEmail, query.getEmail());
    }

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

    @Test
    void testSetNegativeRoleId() {
        SysUserQuery query = new SysUserQuery();
        query.setRoleId(-1L);
        assertEquals(-1L, query.getRoleId());
    }

    @Test
    void testSetZeroRoleId() {
        SysUserQuery query = new SysUserQuery();
        query.setRoleId(0L);
        assertEquals(0L, query.getRoleId());
    }

    @Test
    void testSetPositiveRoleId() {
        SysUserQuery query = new SysUserQuery();
        query.setRoleId(999L);
        assertEquals(999L, query.getRoleId());
    }

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

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

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

    @Test
    void testSetSpecialCharactersInUsername() {
        SysUserQuery query = new SysUserQuery();
        query.setUsername("user@#$%");
        assertEquals("user@#$%", query.getUsername());
    }

    @Test
    void testSetSpecialCharactersInEmail() {
        SysUserQuery query = new SysUserQuery();
        query.setEmail("user+test@example.com");
        assertEquals("user+test@example.com", query.getEmail());
    }

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

    @Test
    void testSetWhitespaceInValues() {
        SysUserQuery query = new SysUserQuery();
        
        query.setUsername("  test user  ");
        query.setEmail("  test@example.com  ");
        query.setKeyword("  test keyword  ");
        
        assertEquals("  test user  ", query.getUsername());
        assertEquals("  test@example.com  ", query.getEmail());
        assertEquals("  test keyword  ", query.getKeyword());
    }

    @Test
    void testSetUnicodeCharacters() {
        SysUserQuery query = new SysUserQuery();
        
        query.setUsername("用户名");
        query.setEmail("用户@example.com");
        query.setKeyword("关键词");
        
        assertEquals("用户名", query.getUsername());
        assertEquals("用户@example.com", query.getEmail());
        assertEquals("关键词", query.getKeyword());
    }
}
