content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Mon Mar 18 10:15:25 GMT 2024
   */
  
  package com.puppycrawl.tools.checkstyle.api;
  
  import org.junit.jupiter.api.Test;
  import static org.junit.jupiter.api.Assertions.*;
  import org.junit.jupiter.api.Timeout;
  import java.util.concurrent.TimeUnit;
  import static org.evosuite.runtime.EvoAssertions.*;
  import com.puppycrawl.tools.checkstyle.api.FileText;
  import com.puppycrawl.tools.checkstyle.api.LineColumn;
  import java.io.File;
  import java.nio.charset.Charset;
  import java.util.LinkedList;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.evosuite.runtime.mock.java.io.MockFile;
  import org.junit.runner.RunWith;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class FileText_ESTest extends FileText_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFailsToCreateFileTextTaking2ArgumentsThrowsIllegalStateException() throws Throwable  {
        // Given a file with an invalid character encoding
        MockFile arg0 = new MockFile((String) null, "\"3n |C\" =p5hpWqyV/");
        
        try {
        // When the file is read as text
        FileText fileText = new FileText(arg0, "8");
        
        // Then an exception is thrown indicating that the character encoding is not supported
        fail("Expecting exception: IllegalStateException");
        } catch(IllegalStateException e) {
        // Verify that the expected exception was thrown with the correct message
        verifyException("com.puppycrawl.tools.checkstyle.api.FileText", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLinesArrayReturningNonEmptyArray() throws Throwable  {
        // Create a temporary file with the given name and extension
        File tempFile = MockFile.createTempFile("com.puppycrawl.tools.checkstyle.api.FileText", "com.puppycrawl.tools.checkstyle.api.FileText");
        
        // Create a LinkedList of strings to be used as the file's content
        LinkedList<String> fileContent = new LinkedList<String>();
        fileContent.add("*zY~-Kb}y?9Gn5bb[");
        
        // Use the FileText class to create a file object from the given lines
        FileText file = FileText.fromLines(tempFile, fileContent);
        
        // Convert the file object to an array of strings using the toLinesArray() method
        String[] linesArray = file.toLinesArray();
        
        // Assert that the array has length 1, which means it contains only one line
        assertEquals(1, linesArray.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSizeReturningPositive() throws Throwable  {
        // A test to verify that the FileText class can be constructed with a list of strings
        // Create a temporary file to use for testing
        File arg0 = MockFile.createTempFile("com.puppycrawl.tools.checkstyle.api.FileText", "com.puppycrawl.tools.checkstyle.api.FileText");
        
        // Create a list of strings to be used as input for the test
        LinkedList<String> arg1 = new LinkedList<>();
        arg1.add("*zY~-Kb}y?9Gn5bb[");
        
        // Use the FileText class to construct an instance from the list of strings
        FileText fromLines = FileText.fromLines(arg0, arg1);
        
        // Verify that the size of the constructed file text is 1
        int size = fromLines.size();
        assertEquals(1, size);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetFullTextReturningCharSequenceWhereLengthIsPositive() throws Throwable  {
        // Setup
        LinkedList<String> args = new LinkedList<>();
        args.add("");
        FileText fromLines = FileText.fromLines((File) null, args);
        
        // Exercise
        CharSequence fullText = fromLines.getFullText();
        
        // Verify
        assertEquals("\n", fullText);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetFileReturningFileWhereIsHiddenIsTrue() throws Throwable  {
        // No Comments were added
        LinkedList<String> arg1 = new LinkedList<String>();
        File arg0 = MockFile.createTempFile(".p3='3,NM>0^&", "com.puppycrawl.tools.checkstyle.api.LineColumn");
        FileText fromLines = FileText.fromLines(arg0, arg1);
        File file = fromLines.getFile();
        assertSame(file, arg0);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetFileReturningFileWhereIsFileIsFalse() throws Throwable  {
        // Create a mock file object
        MockFile arg0 = new MockFile("");
        
        // Create a linked list to store the lines of text in the file
        LinkedList<String> arg1 = new LinkedList<>();
        
        // Convert the mock file and linked list into a FileText object
        FileText fromLines = FileText.fromLines(arg0, arg1);
        
        // Get the file object from the FileText object
        File file = fromLines.getFile();
        
        // Assert that the file is not a regular file (i.e., it's a mock file)
        assertFalse(file.isFile());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetFileReturningFileWhereLastModifiedIsZero() throws Throwable  {
        // Set up the mock file object with some dummy data
        MockFile mockFile = new MockFile("4xDo|6{D", "4xDo|6{D");
        
        // Create a LinkedList<String> to hold the file text lines
        LinkedList<String> fileTextLines = new LinkedList<String>();
        
        // Use the FileText.fromLines method to create a FileText object from the mock file and the LinkedList of text lines
        FileText fileText = FileText.fromLines(mockFile, fileTextLines);
        
        // Get the actual file object from the FileText object
        File file = fileText.getFile();
        
        // Assert that the last modified time of the file is 0L (i.e., it has not been modified)
        assertEquals(0L, file.lastModified());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetReturningNonEmptyString() throws Throwable  {
        // Given: We have a FileText object that contains some lines of text
        File arg0 = MockFile.createTempFile("com.puppycrawl.tools.checkstyle.api.FileText", "com.puppycrawl.tools.checkstyle.api.FileText");
        LinkedList<String> arg1 = new LinkedList<String>();
        arg1.add("*zY~-Kb}y?9Gn5bb[");
        FileText fromLines = FileText.fromLines(arg0, arg1);
        
        // When: We call the get() method with an index of 0
        String get = fromLines.get(0);
        
        // Then: The method should return the first line of text in the FileText object
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetReturningEmptyString() throws Throwable  {
        // No Comments were added
        LinkedList<String> arg1 = new LinkedList<String>();
        arg1.add("");
        arg1.add("");
        FileText fromLines = FileText.fromLines((File) null, arg1);
        String get = fromLines.get(1);
        assertEquals("", get);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSizeReturningZero() throws Throwable  {
        // When: We create a FileText object from this file using the given arguments.
        MockFile arg0 = new MockFile("w$}&u?e<ZB_K", "w$}&u?e<ZB_K");
        LinkedList<String> arg1 = new LinkedList<String>();
        FileText fromLines = FileText.fromLines(arg0, arg1);
        
        // Then: We assert that the size of the resulting FileText object is 0.
        int size = fromLines.size();
        assertEquals(0, size);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLineColumn() throws Throwable  {
        // Given: A LinkedList of String objects and a FileText object with the file path set to null
        LinkedList<String> arg1 = new LinkedList<String>();
        FileText fromLines = FileText.fromLines((File) null, arg1);
        
        // When: We call the lineColumn method on the FileText object with an argument of 2
        LineColumn lineColumn = fromLines.lineColumn(2);
        
        // Then: The method should return a LineColumn object with the line number set to 1 and the column number set to 2
        assertEquals(1, lineColumn.getLine());
        assertEquals(2, lineColumn.getColumn());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLineColumnThrowsArrayIndexOutOfBoundsException() throws Throwable  {
        LinkedList<String> arg1 = new LinkedList<>();
        arg1.add("");
        FileText fromLines = FileText.fromLines((File) null, arg1);
        // Given: We have a LinkedList of strings and a file object
        // When: We call the lineColumn method with a negative index
        // Then: An ArrayIndexOutOfBoundsException is thrown
        try {
        fromLines.lineColumn(-1226);
        fail("Expecting exception: ArrayIndexOutOfBoundsException");
        
        } catch(ArrayIndexOutOfBoundsException e) {
        // Verify that the correct exception is thrown
        verifyException("com.puppycrawl.tools.checkstyle.api.FileText", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesFileTextTakingFileText() throws Throwable  {
        // Given: A list of strings and a file text with the same list of strings
        LinkedList<String> arg1 = new LinkedList<>();
        FileText arg0 = FileText.fromLines((File) null, arg1);
        FileText fileText = new FileText(arg0);
        
        // When: Calling the equals method with the same list of strings
        boolean result = fileText.equals((Object) arg0);
        
        // Then: The result should be true
        assertTrue(result);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesFileTextTakingFileTextAndCallsLineColumn() throws Throwable  {
        // Given: A LinkedList of Strings is created and a FileText object is initialized with the LinkedList
        LinkedList<String> arg1 = new LinkedList<String>();
        FileText arg0 = FileText.fromLines((File) null, arg1);
        
        // When: The lineColumn method is called on the FileText object with an argument of 4
        arg0.lineColumn(4);
        
        // Then: The size of the FileText object should be 0
        FileText fileText = new FileText(arg0);
        assertEquals(0, fileText.size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetFullTextReturningCharSequenceWhereLengthIsZero() throws Throwable  {
        LinkedList<String> expectedOutput = new LinkedList<String>();
        FileText fromLines = FileText.fromLines((File) null, expectedOutput);
        CharSequence actualOutput = fromLines.getFullText();
        assertEquals("", actualOutput);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLineColumnReturningLineColumnWhereGetColumnIsZero() throws Throwable  {
        // Given a LinkedList of Strings as input
        LinkedList<String> arg1 = new LinkedList<>();
        
        // When we create a FileText from the LinkedList of Strings
        FileText fromLines = FileText.fromLines((File) null, arg1);
        
        // Then the first line and column should be 1:0
        LineColumn lineColumn = fromLines.lineColumn(0);
        assertEquals(1, lineColumn.getLine());
        assertEquals(0, lineColumn.getColumn());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetCharset() throws Throwable  {
        // Given: A LinkedList of String objects and a FileText instance created with the LinkedList
        LinkedList<String> arg1 = new LinkedList<>();
        FileText fromLines = FileText.fromLines((File) null, arg1);
        
        // When: The getCharset() method is called on the FileText instance
        Charset charset = fromLines.getCharset();
        
        // Then: The returned charset object should be null
        assertNull(charset);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetFileReturningNull() throws Throwable  {
        // Given a LinkedList of strings and a FileText object
        LinkedList<String> lines = new LinkedList<String>();
        FileText fileText = FileText.fromLines((File) null, lines);
        
        // When the getFile method is called on the FileText object
        File file = fileText.getFile();
        
        // Then the file returned should be null
        assertNull(file);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLinesArrayReturningEmptyArray() throws Throwable  {
        LinkedList<String> inputList = new LinkedList<>();
        FileText fromLines = FileText.fromLines((File) null, inputList);
        String[] linesArray = fromLines.toLinesArray();
        assertEquals(0, linesArray.length);
    }
  }
  