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

import org.junit.jupiter.api.Test;

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

class FilePreviewResponseTest {

    @Test
    void testGettersAndSetters() {
        FilePreviewResponse response = new FilePreviewResponse();
        
        response.setFileName("test.pdf");
        response.setFileType("application/pdf");
        response.setFileSize(1024L);
        response.setPreviewType("image");
        response.setPreviewData("base64data");

        assertEquals("test.pdf", response.getFileName());
        assertEquals("application/pdf", response.getFileType());
        assertEquals(1024L, response.getFileSize());
        assertEquals("image", response.getPreviewType());
        assertEquals("base64data", response.getPreviewData());
    }

    @Test
    void testSettersWithNullValues() {
        FilePreviewResponse response = new FilePreviewResponse();
        
        response.setFileName(null);
        response.setFileType(null);
        response.setFileSize(null);
        response.setPreviewType(null);
        response.setPreviewData(null);

        assertNull(response.getFileName());
        assertNull(response.getFileType());
        assertNull(response.getFileSize());
        assertNull(response.getPreviewType());
        assertNull(response.getPreviewData());
    }

    @Test
    void testSettersWithEmptyStrings() {
        FilePreviewResponse response = new FilePreviewResponse();
        
        response.setFileName("");
        response.setFileType("");
        response.setPreviewType("");
        response.setPreviewData("");

        assertEquals("", response.getFileName());
        assertEquals("", response.getFileType());
        assertEquals("", response.getPreviewType());
        assertEquals("", response.getPreviewData());
    }

    @Test
    void testSettersWithBoundaryValues() {
        FilePreviewResponse response = new FilePreviewResponse();
        
        response.setFileSize(Long.MAX_VALUE);
        response.setFileSize(Long.MIN_VALUE);
        response.setFileSize(0L);

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

    @Test
    void testSettersWithSpecialCharacters() {
        FilePreviewResponse response = new FilePreviewResponse();
        
        String specialFileName = "文件名@#$%^&*().pdf";
        String specialFileType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
        
        response.setFileName(specialFileName);
        response.setFileType(specialFileType);

        assertEquals(specialFileName, response.getFileName());
        assertEquals(specialFileType, response.getFileType());
    }

    @Test
    void testSettersWithLongStrings() {
        FilePreviewResponse response = new FilePreviewResponse();
        
        String longFileName = "a".repeat(1000) + ".pdf";
        String longPreviewData = "x".repeat(10000);
        
        response.setFileName(longFileName);
        response.setPreviewData(longPreviewData);

        assertEquals(longFileName, response.getFileName());
        assertEquals(longPreviewData, response.getPreviewData());
    }

    @Test
    void testSettersWithUnicodeCharacters() {
        FilePreviewResponse response = new FilePreviewResponse();
        
        String unicodeFileName = "文件名_测试_📄.pdf";
        String unicodePreviewData = "数据_测试_🔍";
        
        response.setFileName(unicodeFileName);
        response.setPreviewData(unicodePreviewData);

        assertEquals(unicodeFileName, response.getFileName());
        assertEquals(unicodePreviewData, response.getPreviewData());
    }

    @Test
    void testSettersWithWhitespace() {
        FilePreviewResponse response = new FilePreviewResponse();
        
        response.setFileName("  test.pdf  ");
        response.setFileType("  application/pdf  ");
        response.setPreviewType("  image  ");

        assertEquals("  test.pdf  ", response.getFileName());
        assertEquals("  application/pdf  ", response.getFileType());
        assertEquals("  image  ", response.getPreviewType());
    }

    @Test
    void testMultipleSetOperations() {
        FilePreviewResponse response = new FilePreviewResponse();
        
        response.setFileName("file1.pdf");
        response.setFileName("file2.pdf");
        
        assertEquals("file2.pdf", response.getFileName());
    }

    @Test
    void testSettersWithNumericStrings() {
        FilePreviewResponse response = new FilePreviewResponse();
        
        response.setFileName("12345.pdf");
        response.setFileType("12345");
        
        assertEquals("12345.pdf", response.getFileName());
        assertEquals("12345", response.getFileType());
    }
}
