content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Thu Mar 21 10:15:22 GMT 2024
   */
  
  package com.jstevh.viewer;
  
  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.jstevh.tools.StringList;
  import com.jstevh.viewer.SAXDirParser;
  import java.io.FileNotFoundException;
  import java.util.HashMap;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.junit.runner.RunWith;
  import org.xml.sax.ext.Attributes2Impl;
  import org.xml.sax.helpers.AttributesImpl;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class SAXDirParser_ESTest extends SAXDirParser_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetWebDataReturningNull() throws Throwable  {
        // Given a SAXDirParser object
        SAXDirParser sAXDirParser = new SAXDirParser();
        
        // When the getWebData method is called
        String webData = sAXDirParser.getWebData();
        
        // Then the returned value should be null
        assertNull(webData);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetWebDataReturningNonEmptyString() throws Throwable  {
        // Given a SAXDirParser instance with some web data
        SAXDirParser saxDirParser = new SAXDirParser();
        saxDirParser.webData = "4Ojh`-^`'lj";
        
        // When the getWebData method is called
        String webData = saxDirParser.getWebData();
        
        // Then the returned web data should match the original web data
        assertEquals("4Ojh`-^`'lj", webData);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetLocalPackages() throws Throwable  {
        // rollbacked to evosuite
        StringList localPackages = SAXDirParser.getLocalPackages();
        assertNull(localPackages);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEndElementWithNonEmptyString() throws Throwable  {
        SAXDirParser saxDirParser = new SAXDirParser();
        saxDirParser.endElement("User", "123456789", "Group");
        // Check if the editor value is empty as expected
        assertEquals("", saxDirParser.getEditor());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEndElementWithEmptyString() throws Throwable  {
        // Arrange
        SAXDirParser sAXDirParser = new SAXDirParser();
        
        // Act
        sAXDirParser.endElement("!", "", "2018-01-01T12:34:56");
        
        // Assert
        assertEquals("", sAXDirParser.getEditor());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCharactersAndStartElementAndStartElementWithNonEmptyString0() throws Throwable  {
        SAXDirParser saxDirParser = new SAXDirParser();
        Attributes2Impl attributes = new Attributes2Impl();
        saxDirParser.startElement("", "acceptsLineNumber", "acceptsLineNumber", attributes);
        
        // Given a SAX parser that accepts line numbers and a set of attributes
        
        char[] input = new char[9];
        input[3] = '.';
        saxDirParser.startElement("acceptsLineNumber", "acceptsLineNumber", "pkg", attributes);
        
        // When the parser starts a new element with the given name and attributes
        
        assertEquals("", saxDirParser.getEditor()); // Then the editor is empty
        assertEquals("", saxDirParser.getLocalBrowser()); // And the local browser is also empty
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCharactersAndStartElementAndStartElementWithNonEmptyString1() throws Throwable  {
        // rollbacked to evosuite
        SAXDirParser sAXDirParser = new SAXDirParser();
        Attributes2Impl arg3 = new Attributes2Impl();
        sAXDirParser.startElement("", "acceptsLineNumber", "acceptsLineNumber", arg3);
        char[] arg0 = new char[9];
        arg0[2] = '=';
        sAXDirParser.startElement("acceptsLineNumber", "acceptsLineNumber", "pkg", arg3);
        sAXDirParser.characters(arg0, 1, 3);
        assertEquals("", sAXDirParser.getLocalBrowser());
        assertEquals("", sAXDirParser.lineNumberParameter());
        assertEquals("", sAXDirParser.getEditor());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCharactersAndStartElementAndStartElementWithNonEmptyString2() throws Throwable  {
        // Test that parsing a SAX event with an "acceptsLineNumber" element sets the local and editor variables correctly
        SAXDirParser sAXDirParser = new SAXDirParser();
        Attributes2Impl arg3 = new Attributes2Impl();
        sAXDirParser.startElement("", "acceptsLineNumber", "acceptsLineNumber", arg3);
        char[] arg0 = new char[9];
        sAXDirParser.startElement("acceptsLineNumber", "acceptsLineNumber", "pkg", arg3);
        sAXDirParser.characters(arg0, 1, 3);
        
        // Check that the local variable is set to the expected value
        assertEquals("localVariable", sAXDirParser.getLocalBrowser());
        
        // Check that the editor variable is set to the expected value
        assertEquals("editorVariable", sAXDirParser.getEditor());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCharacters() throws Throwable  {
        // Given: The SAXDirParser is initialized with a non-empty character array.
        SAXDirParser sAXDirParser = new SAXDirParser();
        char[] arg0 = new char[0];
        
        // When: The characters method is called with the character array and a line number.
        sAXDirParser.characters(arg0, 2160, (-43));
        
        // Then: The acceptsLineNumber method returns false.
        assertFalse(sAXDirParser.acceptsLineNumber());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCharactersWithZeroAndZero() throws Throwable  {
        // Given: A SAXDirParser instance and a set of test data.
        SAXDirParser sAXDirParser = new SAXDirParser();
        Attributes2Impl arg3 = new Attributes2Impl();
        sAXDirParser.startElement("Local", "Local", "Local", arg3);
        
        // When: The startElement method is called with the test data.
        char[] arg0 = new char[18];
        sAXDirParser.characters(arg0, '\u0000', '\u0000');
        
        // Then: The length of the character array should be 18.
        assertEquals(18, arg0.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCharactersAndStartElementAndCharactersWithEmptyArrayAndCharactersWithNegative() throws Throwable  {
        // Given
        SAXDirParser sAXDirParser = new SAXDirParser();
        Attributes2Impl arg3 = new Attributes2Impl();
        
        // When
        sAXDirParser.startElement("A+'9", "Web", "Web", arg3);
        char[] arg0 = new char[0];
        sAXDirParser.characters(arg0, 2160, (-43));
        
        // Then
        assertEquals("", sAXDirParser.getLocalBrowser());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCharactersWithZeroAndPositive() throws Throwable  {
        // Given
        SAXDirParser parser = new SAXDirParser();
        AttributesImpl attributes = new AttributesImpl();
        
        // When
        parser.startElement("M", "Names", "parameter", attributes);
        char[] arg0 = new char[2];
        parser.characters(arg0, 0, 2);
        
        // Then
        assertEquals("\u0000\u0000", parser.lineNumberParameter());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCharactersAndStartElement() throws Throwable  {
        // Given a SAXDirParser instance and some XML attributes
        SAXDirParser sAXDirParser = new SAXDirParser();
        Attributes2Impl arg3 = new Attributes2Impl();
        
        // When the startElement method is called with an element name and attributes
        sAXDirParser.startElement("", "acceptsLineNumber", "acceptsLineNumber", arg3);
        
        // Then the local browser, line number parameter, editor, and accepts line number properties should be empty
        assertEquals("", sAXDirParser.getLocalBrowser());
        assertEquals("", sAXDirParser.lineNumberParameter());
        assertEquals("", sAXDirParser.getEditor());
        assertFalse(sAXDirParser.acceptsLineNumber());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCharactersWithNullAndNegative() throws Throwable  {
        // Given a SAXDirParser instance and an Attributes2Impl object
        SAXDirParser sAXDirParser = new SAXDirParser();
        Attributes2Impl arg3 = new Attributes2Impl();
        
        // When the startElement method is called with "Editor" as the element name
        sAXDirParser.startElement("Editor", "Editor", "Editor", arg3);
        
        // Then the web data should be empty
        assertEquals("", sAXDirParser.getWebData());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetLocalBrowserReturningNonEmptyString() throws Throwable  {
        SAXDirParser sAXDirParser = new SAXDirParser();
        Attributes2Impl arg3 = new Attributes2Impl();
        sAXDirParser.startElement("", "", "BrowserLoc", arg3);
        char[] arg0 = new char[5];
        sAXDirParser.characters(arg0, 1, 1);
        // Asserts that the parser's local browser is null
        assertEquals("\u0000", sAXDirParser.getLocalBrowser());
        
        // Gets the parser's local browser and asserts it is null
        String localBrowser = SAXDirParser.getLocalBrowser();
        assertEquals("\u0000", localBrowser);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testStartElement() throws Throwable  {
        // Given a SAXDirParser instance with a startElement method
        SAXDirParser sAXDirParser = new SAXDirParser();
        
        // When the startElement method is called with valid parameters
        AttributesImpl arg3 = new AttributesImpl();
        sAXDirParser.startElement("!", "John Doe", "Group", arg3);
        
        // Then the acceptsLineNumber method should return false
        assertFalse(sAXDirParser.acceptsLineNumber());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetLocalBrowserReturningEmptyString() throws Throwable  {
        // Test that the getLocalBrowser method returns an empty string if no local browser is set
        String localBrowser = SAXDirParser.getLocalBrowser();
        assertEquals("", localBrowser);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLineNumberParameter() throws Throwable  {
        // No Comments were added
        String lineNumberParameter = SAXDirParser.lineNumberParameter();
        assertEquals("", lineNumberParameter);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetWebDataReturningEmptyString() throws Throwable  {
        SAXDirParser saxDirParser = new SAXDirParser();
        String webData = saxDirParser.getWebData();
        // Verify that the returned data is empty
        assertEquals("", webData);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetDirectory() throws Throwable  {
        // Given a HashMap containing no files, when the directory is parsed using SAXDirParser,
        // then the returned HashMap should be empty.
        HashMap directory = SAXDirParser.getDirectory();
        assertTrue(directory.isEmpty());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetEditor() throws Throwable  {
        // Test that the getEditor method returns an empty string if there are no editors defined in the XML file
        String editor = SAXDirParser.getEditor();
        assertEquals("", editor);
        
        // The expected behavior is that the method should return an empty string if there are no editors defined
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testMainThrowsFileNotFoundException() throws Throwable  {
        // This test case is expected to fail, as the SAXDirParser.main method should throw a FileNotFoundException if the arguments are null
        try {
        SAXDirParser.main((String[]) null);
        fail("Expecting exception: FileNotFoundException");
        } catch (FileNotFoundException e) {
        // Verify that the exception is an instance of java.io.FileInputStream
        verifyException("java.io.FileInputStream", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAcceptsLineNumber() throws Throwable  {
        // Test that the parser does not accept line numbers
        boolean acceptsLineNumber = SAXDirParser.acceptsLineNumber();
        assertFalse(acceptsLineNumber);
    }
  }
  