content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Mon Mar 18 10:07:46 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.google.common.collect.ImmutableMap;
  import com.puppycrawl.tools.checkstyle.api.FileContents;
  import com.puppycrawl.tools.checkstyle.api.FileText;
  import com.puppycrawl.tools.checkstyle.api.TextBlock;
  import java.util.List;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.junit.runner.RunWith;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class FileContents_ESTest extends FileContents_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLineIsCommentReturningTrue() throws Throwable  {
        // Given a FileContents object with the first line being a comment
        String[] arg1 = new String[6];
        arg1[1] = "//";
        FileContents fileContents = new FileContents("//", arg1);
        
        // When we call the method to check if the first line is a comment
        boolean lineIsComment = fileContents.lineIsComment(1);
        
        // Then the result should be true, since the first line is indeed a comment
        assertTrue(lineIsComment);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLineIsCommentReturningFalse() throws Throwable  {
        // rollbacked to evosuite
        String[] arg1 = new String[3];
        arg1[2] = "_Aku5U)ru;Rzx~rrupackage-info.java";
        FileContents fileContents = new FileContents("_Aku5U)ru;Rzx~rrupackage-info.java", arg1);
        boolean lineIsComment = fileContents.lineIsComment(2);
        assertFalse(lineIsComment);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLineIsBlankReturningTrue() throws Throwable  {
        // Given
        String[] args = new String[8];
        args[5] = "";
        FileContents fileContents = new FileContents("", args);
        
        // When
        boolean isBlank = fileContents.lineIsBlank(5);
        
        // Then
        assertTrue(isBlank);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLineIsBlankReturningFalse() throws Throwable  {
        // rollbacked to evosuite
        String[] arg1 = new String[6];
        arg1[0] = "{";
        FileContents fileContents = new FileContents("{", arg1);
        boolean lineIsBlank = fileContents.lineIsBlank(0);
        assertFalse(lineIsBlank);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testInPackageInfoReturningTrue() throws Throwable  {
        // Given a Java file named "package-info.java" with no command line arguments
        String[] args = new String[0];
        FileContents fileContents = new FileContents("package-info.java", args);
        
        // When the inPackageInfo() method is called on the file contents object
        boolean inPackageInfo = fileContents.inPackageInfo();
        
        // Then the method should return true, indicating that the file is a package info file
        assertTrue(inPackageInfo);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetTextReturningFileTextWhereSizeIsPositive() throws Throwable  {
        // Given: A file named "_Aku5U)ru;Rzx~rrupackage-info.java" with 3 lines of text
        String[] arg1 = new String[3];
        FileContents fileContents = new FileContents("_Aku5U)ru;Rzx~rrupackage-info.java", arg1);
        
        // When: The contents of the file are retrieved using the getText() method
        FileText text = fileContents.getText();
        
        // Then: The size of the text is 3, as expected
        assertEquals(3, text.size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetLines() throws Throwable  {
        // Given: A large file with a large number of lines
        String[] arg1 = new String[5];
        FileContents fileContents = new FileContents("cVllection too large", arg1);
        
        // When: The getLines method is called on the file contents object
        String[] lines = fileContents.getLines();
        
        // Then: The number of lines returned should be equal to the number of lines in the file
        assertEquals(5, lines.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetLineReturningNonEmptyString() throws Throwable  {
        // Arrange
        String[] args = new String[8];
        args[7] = "d[_";
        
        // Act
        FileContents fileContents = new FileContents("4i|8 I|PYi!", args);
        String line = fileContents.getLine(7);
        
        // Assert
        assertEquals("d[_", line);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetLineReturningEmptyString() throws Throwable  {
        // Given a non-empty file with 7 lines, and we want to get the third line
        String[] arg1 = new String[7];
        arg1[3] = "This is the third line";
        FileContents fileContents = new FileContents("", arg1);
        
        // When we call getLine(3)
        String line = fileContents.getLine(3);
        
        // Then we should get the correct line, which is the third line
        assertEquals("This is the third line", line);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetFilenameReturningNonEmptyString() throws Throwable  {
        // Given a FileContents object with a filename and an array of strings
        String[] arg1 = new String[3];
        FileContents fileContents = new FileContents(":", arg1);
        
        // When the getFilename method is called on the FileContents object
        String filename = fileContents.getFilename();
        
        // Then the filename should be returned as a string
        assertEquals(":", filename);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetFileNameReturningEmptyString() throws Throwable  {
        // Set up some sample data for the FileContents object
        String[] arg1 = new String[9];
        FileContents fileContents = new FileContents("", arg1);
        
        // Call the getFileName method and save the result in a variable
        String fileName = fileContents.getFileName();
        
        // Assert that the returned value is equal to an empty string
        assertEquals("", fileName);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testReportCppCommentThrowsArrayIndexOutOfBoundsException() throws Throwable  {
        // Given
        String[] fileContents = new String[3];
        FileContents fc = new FileContents("_Aku5U)ru;Rzx~rrupackage-info.java", fileContents);
        
        // When
        try {
        fc.reportCppComment(7, (-3609));
        fail("Expecting exception: ArrayIndexOutOfBoundsException");
        } catch(ArrayIndexOutOfBoundsException e) {
        // Then
        assertEquals(null, e.getMessage());}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testHasIntersectionWithCommentAndReportSingleLineCommentAndHasIntersectionWithCommentReturningFalse() throws Throwable  {
        // This test checks whether the hasIntersectionWithComment method correctly identifies when two points are not intersecting with a single line comment.
        String[] arg1 = new String[25];
        arg1[1] = "HBlV@B";
        FileContents fileContents = new FileContents("HBlV@B", arg1);
        fileContents.reportSingleLineComment("HBlV@B", 2, 2);
        boolean intersectionWithComment = fileContents.hasIntersectionWithComment(2, 28, 2, 2);
        assertFalse(intersectionWithComment);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testHasIntersectionWithCommentAndReportBlockCommentAndHasIntersectionWithCommentReturningFalse() throws Throwable  {
        // Test that hasIntersectionWithComment returns false when the specified range does not overlap with a block comment.
        String[] arg1 = new String[25];
        arg1[1] = "HBlV@B";
        FileContents fileContents = new FileContents("HBlV@B", arg1);
        fileContents.reportBlockComment("HBlV@B", 2, 2, 2, 2); // Report a block comment starting at line 2, column 2 and ending at line 2, column 2.
        boolean intersectionWithComment = fileContents.hasIntersectionWithComment(2, 28, 2, 2); // Specify a range that does not overlap with the block comment.
        assertFalse(intersectionWithComment);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testHasIntersectionWithCommentAndReportSingleLineCommentAndHasIntersectionWithCommentReturningTrue() throws Throwable  {
        // Given: A FileContents object with a single-line comment starting at character position 1 and ending at character position 25.
        // When: The method hasIntersectionWithComment is called with the following arguments: line number 2, start character position 4, end character position 2, and the file contents.
        // Then: The intersection between the range of characters (line number 2, start character position 4, end character position 2) and the comment should be true.
        
        String[] arg1 = new String[25];
        arg1[1] = "HBlV@B";
        FileContents fileContents = new FileContents("HBlV@B", arg1);
        fileContents.reportSingleLineComment("HBlV@B", 2, 2);
        boolean intersectionWithComment = fileContents.hasIntersectionWithComment(2, 4, 2, 2);
        assertTrue(intersectionWithComment);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testHasIntersectionWithCommentAndReportBlockCommentAndHasIntersectionWithCommentReturningTrue() throws Throwable  {
        // No Comments were added
        String[] arg1 = new String[2];
        arg1[1] = "Z=@B";
        FileContents fileContents = new FileContents("Z=@B", arg1);
        fileContents.reportBlockComment("Z=@B", 2, 2, 2, 2);
        boolean intersectionWithComment = fileContents.hasIntersectionWithComment(2, 2, 2, 2);
        assertTrue(intersectionWithComment);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetJavadocBefore0() throws Throwable  {
        // Setup
        String[] arg1 = new String[8];
        arg1[5] = "d[_";
        FileContents fileContents = new FileContents("d[_", arg1);
        
        // Execute
        TextBlock javadocBefore = fileContents.getJavadocBefore(7);
        
        // Verify
        assertNull(javadocBefore);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetJavadocBeforeThrowsNullPointerException() throws Throwable  {
        // Given: A FileContents object with a null Javadoc
        String[] arg1 = new String[6];
        arg1[5] = "";
        FileContents fileContents = new FileContents("", arg1);
        
        // When: Calling getJavadocBefore(7) on the FileContents object
        try {
        fileContents.getJavadocBefore(7);
        
        // Then: The method should throw a NullPointerException
        fail("Expecting exception: NullPointerException");
        
        } catch (NullPointerException e) {
        // Verify that the expected exception is thrown
        verifyException("com.puppycrawl.tools.checkstyle.api.FileContents", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetJavadocBefore1() throws Throwable  {
        // Given a file with 6 lines of code
        String[] arg1 = new String[6];
        arg1[1] = "//";
        FileContents fileContents = new FileContents("//", arg1);
        
        // When the line number is greater than the number of lines in the file
        int lineNumber = 7;
        
        // Then the getJavadocBefore method returns null
        TextBlock javadocBefore = fileContents.getJavadocBefore(lineNumber);
        assertNull(javadocBefore);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testReportBlockCommentThrowsNullPointerException() throws Throwable  {
        // Given a FileContents object with a valid file path and content
        String[] arg1 = new String[21];
        arg1[1] = "/<";
        FileContents fileContents = new FileContents("/<", arg1);
        
        // When the reportBlockComment method is called with invalid arguments
        try {
        // Then an exception should be thrown
        fileContents.reportBlockComment("/<", 2, 2, 11, 11);
        fail("Expecting exception: NullPointerException");
        
        } catch(NullPointerException e) {
        //
        // no message in exception (getMessage() returned null)
        //
        verifyException("com.puppycrawl.tools.checkstyle.api.FileContents", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testReportCComment0() throws Throwable  {
        // Setup
        String[] args = new String[4];
        args[1] = "/*";
        
        // Execute
        FileContents fileContents = new FileContents("/*", args);
        fileContents.reportCComment(2, 2, 2, 2);
        
        // Verify
        assertEquals("/*", fileContents.getFilename());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testReportBlockCommentAndReportCComment() throws Throwable  {
        // Test that a FileContents object created with a valid file path returns false for inPackageInfo() when it is not in a package-info.java file
        String[] arg1 = new String[17];
        arg1[1] = "H=lV@B";
        FileContents fileContents = new FileContents("H=lV@B", arg1);
        fileContents.reportBlockComment("H=lV@B", 2, 2, 2, 2);
        fileContents.reportCComment(2, 2, 2, 2);
        assertFalse(fileContents.inPackageInfo());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testReportCComment1() throws Throwable  {
        // Given a FileContents object that contains a comment with 2 lines
        String[] arg1 = new String[2];
        arg1[1] = "//";
        FileContents fileContents = new FileContents("//", arg1);
        
        // When we call reportCComment() with the line number and column number of the comment
        fileContents.reportCComment(2, 2, 2, 2);
        
        // Then we expect that inPackageInfo() returns false
        assertFalse(fileContents.inPackageInfo());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetFileNameReturningNonEmptyString() throws Throwable  {
        // Given a file contents object with a filename
        String[] arg1 = new String[7];
        FileContents fileContents = new FileContents("-PWLv7i7;GdU,F(JgX", arg1);
        
        // When the getFileName method is called
        String fileName = fileContents.getFileName();
        
        // Then the correct filename should be returned
        assertEquals("-PWLv7i7;GdU,F(JgX", fileName);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetCppComments() throws Throwable  {
        // Given a FileContents object with an empty file
        String[] arg1 = new String[3];
        FileContents fileContents = new FileContents("tSULHz", arg1);
        
        // When the getCppComments method is called on the FileContents object
        ImmutableMap<Integer, TextBlock> cppComments = fileContents.getCppComments();
        
        // Then an empty map is returned
        assertEquals(0, cppComments.size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testInPackageInfoReturningFalse() throws Throwable  {
        // rollbacked to evosuite
        String[] arg1 = new String[0];
        FileContents fileContents = new FileContents("08-i2<ELto[", arg1);
        boolean inPackageInfo = fileContents.inPackageInfo();
        assertFalse(inPackageInfo);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetLineReturningNull() throws Throwable  {
        // rollbacked to evosuite
        String[] arg1 = new String[7];
        FileContents fileContents = new FileContents("", arg1);
        String line = fileContents.getLine(3);
        assertNull(line);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetFilenameReturningEmptyString() throws Throwable  {
        // Given a FileContents object with an empty string as the file name
        String[] arg1 = new String[3];
        FileContents fileContents = new FileContents("", arg1);
        
        // When we call getFilename() on the FileContents object
        String filename = fileContents.getFilename();
        
        // Then we expect to receive an empty string as the filename
        assertEquals("", filename);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetTextReturningFileTextWhereSizeIsZero() throws Throwable  {
        // Given: A non-empty array of strings
        String[] arg1 = new String[0];
        
        // When: Creating a FileContents object with the array as argument
        FileContents fileContents = new FileContents("/**/", arg1);
        
        // Then: The size of the text should be 0
        assertEquals(0, fileContents.getText().size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetCComments() throws Throwable  {
        // rollbacked to evosuite
        String[] arg1 = new String[7];
        FileContents fileContents = new FileContents("", arg1);
        ImmutableMap<Integer, List<TextBlock>> cComments = fileContents.getCComments();
        assertEquals(0, cComments.size());
    }
  }
  