content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Wed Mar 20 17:51:00 GMT 2024
   */
  
  package org.znerd.xmlenc;
  
  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 org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.junit.runner.RunWith;
  import org.znerd.xmlenc.XMLChecker;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class XMLChecker_ESTest extends XMLChecker_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckSTakingString() throws Throwable  {
        // No Comments were added
        XMLChecker.checkS("");
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckPubidLiteralTaking3ArgumentsThrowsRuntimeExceptionAndCheckPubidLiteralTaking3ArgumentsWithPositive0() throws Throwable  {
        char[] arg0 = new char[25];
        try {
        XMLChecker.checkPubidLiteral(arg0, 3, 3);
        fail("Expecting exception: RuntimeException");
        } catch (RuntimeException e) {
        // First char must either be '\\'' or '\"' instead of 0x0.
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckPubidLiteralTaking3ArgumentsWithNegative() throws Throwable  {
        // Given a character array containing only 5 characters,
        char[] arg0 = new char[5];
        
        // When the 'checkPubidLiteral' method is called with this array and an offset of 3018,
        try {
        XMLChecker.checkPubidLiteral(arg0, 3018, (-310));
        fail("Expecting exception: RuntimeException");
        } catch(RuntimeException e) {
        
        // Then the method should throw a 'RuntimeException' because the minimum length for the 'PubidLiteral' production is 3 characters.
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckSystemLiteralTaking3ArgumentsThrowsRuntimeException0() throws Throwable  {
        // No Comments were added
        char[] arg0 = new char[8];
        arg0[0] = '\"';
        try { 
          XMLChecker.checkSystemLiteral(arg0, 3, 3);
          fail("Expecting exception: RuntimeException");
        
        } catch(RuntimeException e) {
           //
           // First character is '\"', but the last character is 0x0.
           //
           verifyException("org.znerd.xmlenc.XMLChecker", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckSystemLiteralTaking3ArgumentsThrowsRuntimeException1() throws Throwable  {
        // Test that an exception is thrown when the first character of a system literal is not '\\'' or '\"'
        // Given
        char[] arg0 = new char[8];
        arg0[0] = 0x0; // Invalid first character, should be either '\\'' or '\"'
        int arg1 = 3;
        int arg2 = 3;
        
        try {
        // When
        XMLChecker.checkSystemLiteral(arg0, arg1, arg2);
        
        // Then
        fail("Expecting exception: RuntimeException");
        
        } catch(RuntimeException e) {
        // First char must either be '\\'' or '\"' instead of 0x0.
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckNameTaking3ArgumentsThrowsRuntimeException0() throws Throwable  {
        char[] arg0 = new char[10];
        arg0[1] = '\u00E1';
        arg0[2] = '\u00E1';
        try {
        XMLChecker.checkName(arg0, 1, 8016);
        fail("Expecting exception: RuntimeException");
        } catch (RuntimeException e) {
        // The character 0x0 is not valid for the 'Name' production.
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckNameTaking3ArgumentsWithNegative() throws Throwable  {
        // Given: A character array containing a single character
        char[] arg0 = new char[] { 'a' };
        
        // When: The character is checked for validity as an XML name
        try {
        XMLChecker.checkName(arg0, 1, (-3325));
        fail("Expecting exception: RuntimeException");
        } catch(RuntimeException e) {
        //
        // An empty string does not match the 'Name' production.
        //
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckNameTaking3ArgumentsThrowsRuntimeException1() throws Throwable  {
        // Given: We have an array of characters representing a name, and we want to check that it is a valid XML name.
        char[] arg0 = new char[10];
        arg0[3] = '\uFF92';
        try {
        // When: We pass the array of characters to the method 'checkName' with an index and a character.
        XMLChecker.checkName(arg0, 3, (int) '\uFF92');
        // Then: We expect an exception to be thrown because the character is invalid in this context.
        fail("Expecting exception: RuntimeException");
        } catch(RuntimeException e) {
        // The character 0xff92 is invalid as a starting character in the 'Name' production.
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckNameTaking3Arguments0() throws Throwable  {
        // Given: A char array containing a name with an accent
        char[] arg0 = new char[19];
        arg0[1] = '\u00D0';
        
        // When: The method checkName is called on the array
        XMLChecker.checkName(arg0, 1, 1);
        
        // Then: The method should not throw any exceptions and the length of the array should be unchanged
        assertEquals(19, arg0.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testIsName0() throws Throwable  {
        // No Comments were added
        boolean name = XMLChecker.isName("y:.Cb={Mntb<X");
        assertFalse(name);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testIsName1() throws Throwable  {
        // Test to verify that the isName() method returns false when passed a string with invalid characters
        boolean name = XMLChecker.isName("p_m=nco9txqTUc.}");
        assertFalse(name);
        
        // Explanation of the test:
        // The test checks whether the isName() method returns false when passed a string that contains an invalid character (in this case, the equals sign "=").
        // The assertFalse() method is used to verify that the result returned by the isName() method is actually false.
        
        // This test helps to ensure that the isName() method correctly identifies and rejects strings with invalid characters in them.
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testIsNameReturningTrue() throws Throwable  {
        // No Comments were added
        boolean name = XMLChecker.isName("kVtZoX-g");
        assertTrue(name);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testIsName2() throws Throwable  {
        // No Comments were added
        boolean name = XMLChecker.isName("iAL9.$V@");
        assertFalse(name);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckPubidLiteralTaking3Arguments0() throws Throwable  {
        // Given: A char array containing a PubidLiteral
        char[] arg0 = new char[9];
        arg0[0] = '\'';
        arg0[1] = ',';
        arg0[5] = '\'';
        
        // When: The method "checkPubidLiteral" is called with the char array and a starting index of 3
        XMLChecker.checkPubidLiteral(arg0, 3, 3);
        
        // Then: The returned array should be equal to the expected array, which is an empty char array
        assertArrayEquals(new char[] {'\'', ',', '\u0000', '\u0000', '\u0000', '\'', '\u0000', '\u0000', '\u0000'}, arg0);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckPubidLiteralTaking3Arguments1() throws Throwable  {
        // Given a character array representing a pubid literal
        char[] arg0 = new char[7];
        arg0[0] = '\'';
        arg0[1] = 'U';
        arg0[5] = '\'';
        
        // When the method is called with this character array and a start index of 3
        XMLChecker.checkPubidLiteral(arg0, 3, 3);
        
        // Then the resulting character array should have the non-printable characters replaced with question marks
        assertArrayEquals(new char[] {'\'', 'U', '\u0000', '\u0000', '\u0000', '\'', '\u0000'}, arg0);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckPubidLiteralTaking3ArgumentsThrowsRuntimeExceptionAndCheckPubidLiteralTaking3ArgumentsWithZero0() throws Throwable  {
        char[] arg0 = new char[20];
        arg0[0] = '\"';
        arg0[2] = '\"';
        arg0[18] = '\u0000'; // Invalid character
        
        try {
        XMLChecker.checkPubidLiteral(arg0, 0, 3);
        fail("Expecting exception: RuntimeException");
        } catch (RuntimeException e) {
        // The character '\u0000' (0x0) is not valid for the 'PubidLiteral' production.
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckPubidLiteralTaking3ArgumentsThrowsRuntimeExceptionAndCheckPubidLiteralTaking3ArgumentsWithZero1() throws Throwable  {
        // No Comments were added
        char[] arg0 = new char[20];
        arg0[0] = '\"';
        try { 
          XMLChecker.checkPubidLiteral(arg0, 0, 3);
          fail("Expecting exception: RuntimeException");
        
        } catch(RuntimeException e) {
           //
           // First character is '\"', but the last character is 0x0.
           //
           verifyException("org.znerd.xmlenc.XMLChecker", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckPubidLiteralTaking3ArgumentsThrowsRuntimeExceptionAndCheckPubidLiteralTaking3ArgumentsWithPositive1() throws Throwable  {
        // Given: a char array containing a single apostrophe (') character
        char[] arg0 = new char[25];
        arg0[0] = '\'';
        
        // When: the method is called with the char array as input and a starting index of 3, and an ending index of 3
        try {
        XMLChecker.checkPubidLiteral(arg0, 3, 3);
        } catch (RuntimeException e) {
        // Then: an exception is thrown because the last character in the char array is 0x0
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckPubidLiteralTakingStringThrowsRuntimeException() throws Throwable  {
        try {
        XMLChecker.checkPubidLiteral("-//OASIS//DTD XML Schema 200102//EN");
        fail("Expecting exception: RuntimeException");
        } catch (RuntimeException e) {
        // The first char must be either '\\'' or '\"' instead of 0x2d.
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckSystemLiteralTaking3ArgumentsThrowsRuntimeException2() throws Throwable  {
        // Given
        char[] arg0 = new char[9];
        arg0[0] = '\'';
        arg0[1] = '\'';
        arg0[5] = '\'';
        
        try {
        XMLChecker.checkSystemLiteral(arg0, 3, 3);
        fail("Expecting exception: RuntimeException");
        } catch (RuntimeException e) {
        // Found '\\'' at position 1.
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckSystemLiteralTakingStringThrowsRuntimeException() throws Throwable  {
        // No Comments were added
        try { 
          XMLChecker.checkSystemLiteral("\"#Xj`DlNH");
          fail("Expecting exception: RuntimeException");
        
        } catch(RuntimeException e) {
           //
           // First character is '\"', but the last character is 0x48.
           //
           verifyException("org.znerd.xmlenc.XMLChecker", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckSystemLiteralTaking3Arguments() throws Throwable  {
        // Given a system literal with a valid character value
        char[] input = new char[25];
        input[0] = '\'';
        input[5] = '\'';
        
        // When the method checkSystemLiteral is called with the input and a length of 3
        XMLChecker.checkSystemLiteral(input, 3, 3);
        
        // Then the method should return true
        assertEquals(25, input.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckSystemLiteralTaking3ArgumentsThrowsRuntimeException3() throws Throwable  {
        // Arrange
        char[] arg0 = new char[25];
        arg0[0] = '\'';
        
        // Act and Assert
        try {
        XMLChecker.checkSystemLiteral(arg0, 3, 3);
        fail("Expecting exception: RuntimeException");
        } catch (RuntimeException e) {
        // Verify that the expected exception was thrown
        assertTrue(e instanceof RuntimeException);
        
        // Verify that the message of the exception is correct
        String actualMessage = e.getMessage();
        String expectedMessage = "First character is '\\', but the last character is 0x0.";
        assertEquals(expectedMessage, actualMessage);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckSystemLiteralTaking3ArgumentsWithZeroAndZero() throws Throwable  {
        char[] arg0 = new char[4];
        try {
        XMLChecker.checkSystemLiteral(arg0, 0, 0);
        fail("Expecting exception: RuntimeException");
        
        } catch(RuntimeException e) {
        //
        // Minimum length for the 'SystemLiteral' production is 3 characters.
        //
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckNameTaking3ArgumentsWithZero() throws Throwable  {
        // Given: A character array containing an invalid character (0x0)
        char[] xmlName = new char[9];
        xmlName[0] = ':';
        
        // When: Checking the name with the XMLChecker class
        try {
        XMLChecker.checkName(xmlName, 0, 3212);
        fail("Expected exception");
        } catch (RuntimeException e) {
        // Then: The method should throw a RuntimeException
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckNameTaking3Arguments1() throws Throwable  {
        // Given a character array representing an XML name, where the first index is the length of the name.
        char[] arg0 = new char[3];
        arg0[1] = '_';
        
        // When the checkName method is called with the character array and its length as arguments.
        XMLChecker.checkName(arg0, 1, 1);
        
        // Then the method should return a boolean indicating whether the name is valid or not.
        assertEquals(3, arg0.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckNameTakingStringThrowsRuntimeException() throws Throwable  {
        try {
        XMLChecker.checkName(""); // Check if an empty string is a valid name according to the 'Name' production.
        fail("Expecting exception: RuntimeException");
        } catch(RuntimeException e) {
        // An empty string does not match the 'Name' production.
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckSTaking3ArgumentsThrowsRuntimeException0() throws Throwable  {
        // Test that an exception is thrown when an invalid character is passed to the 'S' production (white space).
        char[] arg0 = new char[2];
        arg0[0] = '\n';
        try {
        XMLChecker.checkS(arg0, 0, (int) '\n');
        fail("Expecting exception: RuntimeException");
        } catch(RuntimeException e) {
        // The character 0x0 is not valid for the 'S' production (white space).
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckSTaking3ArgumentsThrowsRuntimeException1() throws Throwable  {
        char[] input = new char[6]; // 6 is the length of the input array
        input[0] = '\t'; // tab character
        try {
        XMLChecker.checkS(input, 0, 32);
        fail("Expecting exception: RuntimeException");
        } catch (RuntimeException e) {
        // This exception is expected because the input contains a non-whitespace character at position 0
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckSTaking3ArgumentsWithPositive() throws Throwable  {
        // Test that a valid character (white space) is allowed in the 'S' production
        char[] arg0 = new char[7];
        arg0[1] = ' ';
        try {
        XMLChecker.checkS(arg0, 1, 3782);
        } catch(RuntimeException e) {
        fail("Expecting no exception");
        }
        
        // Test that an invalid character (null) is not allowed in the 'S' production
        char[] arg1 = new char[7];
        arg1[1] = '\0';
        try {
        XMLChecker.checkS(arg1, 1, 3782);
        fail("Expecting exception: RuntimeException");
        } catch(RuntimeException e) {
        // The character 0x0 is not valid for the 'S' production (null).
        verifyException("org.znerd.xmlenc.XMLChecker", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCheckSTaking3Arguments() throws Throwable  {
        // Given a char array of length 3 containing underscores
        char[] input = new char[3];
        input[0] = '_';
        input[1] = '_';
        input[2] = '_';
        
        // When the checkS method is called with the input
        XMLChecker.checkS(input, (int) '_', (int) '_');
        
        // Then the length of the char array should be 3
        assertEquals(3, input.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testIsSystemLiteral() throws Throwable  {
        // No Comments were added
        boolean systemLiteral = XMLChecker.isSystemLiteral("%l$v'C`(PqB@~)hzY9S");
        assertFalse(systemLiteral);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testIsPubidLiteral() throws Throwable  {
        boolean pubidLiteral = XMLChecker.isPubidLiteral("");
        assertFalse(pubidLiteral);
    }
  }
  