package cn.novalon.manage.sys.dto.response;

import org.junit.jupiter.api.Test;

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

class AuthResponseTest {

    @Test
    void testConstructorWithParameters() {
        AuthResponse response = new AuthResponse("test-token", 1L, "testuser");

        assertEquals("test-token", response.getToken());
        assertEquals(1L, response.getUserId());
        assertEquals("testuser", response.getUsername());
    }

    @Test
    void testDefaultConstructor() {
        AuthResponse response = new AuthResponse();

        assertNull(response.getToken());
        assertNull(response.getUserId());
        assertNull(response.getUsername());
    }

    @Test
    void testGettersAndSetters() {
        AuthResponse response = new AuthResponse();

        response.setToken("new-token");
        response.setUserId(2L);
        response.setUsername("newuser");

        assertEquals("new-token", response.getToken());
        assertEquals(2L, response.getUserId());
        assertEquals("newuser", response.getUsername());
    }

    @Test
    void testSettersWithNullValues() {
        AuthResponse response = new AuthResponse();

        response.setToken(null);
        response.setUserId(null);
        response.setUsername(null);

        assertNull(response.getToken());
        assertNull(response.getUserId());
        assertNull(response.getUsername());
    }

    @Test
    void testSettersWithEmptyStrings() {
        AuthResponse response = new AuthResponse();

        response.setToken("");
        response.setUsername("");

        assertEquals("", response.getToken());
        assertEquals("", response.getUsername());
    }

    @Test
    void testConstructorWithNullValues() {
        AuthResponse response = new AuthResponse(null, null, null);

        assertNull(response.getToken());
        assertNull(response.getUserId());
        assertNull(response.getUsername());
    }

    @Test
    void testConstructorWithEmptyStrings() {
        AuthResponse response = new AuthResponse("", 1L, "");

        assertEquals("", response.getToken());
        assertEquals(1L, response.getUserId());
        assertEquals("", response.getUsername());
    }

    @Test
    void testSettersWithBoundaryValues() {
        AuthResponse response = new AuthResponse();

        response.setUserId(Long.MAX_VALUE);
        response.setUserId(Long.MIN_VALUE);
        response.setUserId(0L);

        assertEquals(0L, response.getUserId());
    }

    @Test
    void testSettersWithNegativeValues() {
        AuthResponse response = new AuthResponse();

        response.setUserId(-1L);

        assertEquals(-1L, response.getUserId());
    }

    @Test
    void testSettersWithSpecialCharacters() {
        AuthResponse response = new AuthResponse();

        String specialToken = "token@#$%^&*()";
        String specialUsername = "user@#$%^&*()";

        response.setToken(specialToken);
        response.setUsername(specialUsername);

        assertEquals(specialToken, response.getToken());
        assertEquals(specialUsername, response.getUsername());
    }

    @Test
    void testSettersWithLongStrings() {
        AuthResponse response = new AuthResponse();

        String longToken = "a".repeat(1000);
        String longUsername = "b".repeat(500);

        response.setToken(longToken);
        response.setUsername(longUsername);

        assertEquals(longToken, response.getToken());
        assertEquals(longUsername, response.getUsername());
    }

    @Test
    void testSettersWithUnicodeCharacters() {
        AuthResponse response = new AuthResponse();

        String unicodeToken = "token_测试_🔑";
        String unicodeUsername = "user_测试_👤";

        response.setToken(unicodeToken);
        response.setUsername(unicodeUsername);

        assertEquals(unicodeToken, response.getToken());
        assertEquals(unicodeUsername, response.getUsername());
    }

    @Test
    void testSettersWithWhitespace() {
        AuthResponse response = new AuthResponse();

        response.setToken("  token  ");
        response.setUsername("  user  ");

        assertEquals("  token  ", response.getToken());
        assertEquals("  user  ", response.getUsername());
    }

    @Test
    void testMultipleSetOperations() {
        AuthResponse response = new AuthResponse();

        response.setToken("token1");
        response.setToken("token2");

        assertEquals("token2", response.getToken());
    }

    @Test
    void testConstructorWithZeroUserId() {
        AuthResponse response = new AuthResponse("token", 0L, "user");

        assertEquals("token", response.getToken());
        assertEquals(0L, response.getUserId());
        assertEquals("user", response.getUsername());
    }

    @Test
    void testSettersWithNumericStrings() {
        AuthResponse response = new AuthResponse();

        response.setToken("12345");
        response.setUsername("67890");

        assertEquals("12345", response.getToken());
        assertEquals("67890", response.getUsername());
    }
}
