content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Thu Mar 21 10:04:01 GMT 2024
   */
  
  package de.devcity.parseargs;
  
  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 de.devcity.parseargs.ArgsParser;
  import de.devcity.parseargs.arguments.ParameterArgument;
  import de.devcity.parseargs.arguments.StringArgument;
  import de.devcity.parseargs.arguments.SwitchArgument;
  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 ArgsParser_ESTest extends ArgsParser_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetArgsCountReturningPositive() throws Throwable  {
        // Given: A non-empty array of strings is passed to the constructor of ArgsParser
        String[] arg0 = new String[5];
        ArgsParser argsParser = new ArgsParser(arg0);
        
        // When: The getArgsCount method is called on the ArgsParser object
        int argsCount = argsParser.getArgsCount();
        
        // Then: The returned value should be equal to the length of the original array
        assertEquals(5, argsCount);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetArgsReturningNull() throws Throwable  {
        // Given: A new instance of ArgsParser and a string array called args
        ArgsParser argsParser = new ArgsParser();
        String[] args = null;
        
        // When: The getArgs method is called on the ArgsParser object with no arguments
        args = argsParser.getArgs();
        
        // Then: The result should be null
        assertNull(args);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetArgsReturningEmptyArray() throws Throwable  {
        // Given a set of command line arguments
        String[] input = new String[0];
        
        // When we create an ArgsParser instance using these arguments
        ArgsParser argsParser = new ArgsParser(input);
        
        // Then the created instance should have its own copy of the arguments
        String[] args = argsParser.getArgs();
        assertNotSame(input, args);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseStringArgumentReturningListWhereIsEmptyIsFalse() throws Throwable  {
        // rollbacked to evosuite
        ArgsParser argsParser = new ArgsParser();
        String[] arg0 = new String[8];
        arg0[1] = "--help";
        argsParser.setArgs(arg0);
        List<StringArgument> parseStringArgument = argsParser.parseStringArgument();
        assertEquals(0, argsParser.getArgsLeftCount());
        assertFalse(parseStringArgument.isEmpty());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseStringArgumentReturningListWhereIsEmptyIsTrue() throws Throwable  {
        // Arrange
        ArgsParser argsParser = new ArgsParser();
        String[] arg0 = new String[8];
        argsParser.setArgs(arg0);
        
        // Act
        List<StringArgument> parseStringArgument = argsParser.parseStringArgument();
        
        // Assert
        assertTrue(parseStringArgument.isEmpty());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesArgsParserTakingStringArrayAndParseParameterArgumentAndParseParameterArgumentReturningParameterArgumentWhereGetPositionIsPositive0() throws Throwable  {
        // rollbacked to evosuite
        String[] arg0 = new String[6];
        arg0[1] = "-l2Fz%'XI`VK\"Qr{ u";
        ArgsParser argsParser = new ArgsParser(arg0);
        ParameterArgument parseParameterArgument = argsParser.parseParameterArgument("l");
        assertEquals(0, argsParser.getArgsLeftCount());
        assertNotNull(parseParameterArgument);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseParameterArgumentReturningParameterArgumentWhereGetPositionIsZero() throws Throwable  {
        // rollbacked to evosuite
        ArgsParser argsParser = new ArgsParser();
        String[] arg0 = new String[8];
        arg0[0] = "-{-6<";
        arg0[1] = "--";
        argsParser.setArgs(arg0);
        ParameterArgument parseParameterArgument = argsParser.parseParameterArgument("<");
        assertEquals(1, argsParser.getArgsLeftCount());
        assertNotNull(parseParameterArgument);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesArgsParserTakingStringArrayAndParseParameterArgumentAndParseParameterArgumentReturningParameterArgumentWhereGetPositionIsPositive1() throws Throwable  {
        // Given: We have a String array of 25 elements, where the seventh and eighth elements are "-<".
        String[] arg0 = new String[25];
        arg0[6] = "-<";
        arg0[7] = "-<";
        
        // When: We create an instance of ArgsParser with the array as input.
        ArgsParser argsParser = new ArgsParser(arg0);
        
        // Then: The method parseParameterArgument("<") should return a non-null value, and the args parser should have 0 remaining arguments.
        ParameterArgument parseParameterArgument = argsParser.parseParameterArgument("<");
        assertEquals(0, argsParser.getArgsLeftCount());
        assertNotNull(parseParameterArgument);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesArgsParserTakingStringArrayAndParseParameterArgumentAndParseParameterArgumentReturningNull0() throws Throwable  {
        // Given a string array with invalid input
        String[] arg0 = new String[7];
        arg0[6] = "-,-<";
        
        // When the ArgsParser is created and the parseParameterArgument method is called
        ArgsParser argsParser = new ArgsParser(arg0);
        argsParser.parseParameterArgument("<");
        
        // Then the getArgsLeftCount method should return 1
        assertEquals(1, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesArgsParserTakingStringArrayAndParseParameterArgumentAndParseParameterArgumentReturningParameterArgumentWhereGetPositionIsPositive2() throws Throwable  {
        // rollbacked to evosuite
        String[] arg0 = new String[6];
        arg0[1] = "-l2Fz%'XI`VK\"Qr{ u";
        ArgsParser argsParser = new ArgsParser(arg0);
        ParameterArgument parseParameterArgument = argsParser.parseParameterArgument(" ");
        assertNotNull(parseParameterArgument);
        assertEquals(1, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseParameterArgumentAndParseParameterArgumentWithNonEmptyString0() throws Throwable  {
        // Create a new instance of ArgsParser and set some invalid arguments.
        ArgsParser argsParser = new ArgsParser();
        String[] arg0 = new String[8];
        arg0[6] = "-{-6<";
        argsParser.setArgs(arg0);
        
        // Call the parseParameterArgument method with an invalid argument and assert that it throws an exception.
        try {
        argsParser.parseParameterArgument("<");
        fail("Expected IllegalArgumentException to be thrown.");
        } catch (IllegalArgumentException e) {
        assertEquals(1, argsParser.getArgsLeftCount());}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseParameterArgumentAndParseParameterArgumentWithNonEmptyString1() throws Throwable  {
        // Create an ArgsParser object with a set of arguments
        ArgsParser argsParser = new ArgsParser();
        String[] arg0 = new String[8];
        arg0[1] = "--";
        argsParser.setArgs(arg0);
        
        // Parse the parameter argument
        argsParser.parseParameterArgument(">");
        
        // Check that one argument is left
        assertEquals(1, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseParameterArgumentAndParseParameterArgumentWithEmptyString0() throws Throwable  {
        // Given a ArgsParser object with arguments set
        ArgsParser argsParser = new ArgsParser();
        String[] arg0 = new String[6];
        arg0[3] = "de.devcity.parseargs.arguments.KeyArgument";
        argsParser.setArgs(arg0);
        
        // When the parseParameterArgument method is called with an empty string
        argsParser.parseParameterArgument("");
        
        // Then the number of arguments left should be 1
        assertEquals(1, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseParameterArgumentAndParseParameterArgumentWithEmptyString1() throws Throwable  {
        // Given an ArgsParser instance with 6 arguments and one empty string
        ArgsParser argsParser = new ArgsParser();
        String[] arg0 = new String[6];
        arg0[5] = "";
        argsParser.setArgs(arg0);
        
        // When we call parseParameterArgument() with an empty string as the argument
        argsParser.parseParameterArgument("");
        
        // Then the method should return a non-negative value, indicating that there are still arguments left to be parsed
        assertEquals(1, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseParameterArgumentAndParseParameterArgumentWithNonEmptyString2() throws Throwable  {
        // Given a string of arguments containing an unknown parameter character
        String[] arg0 = new String[8];
        arg0[0] = "-{6}";
        ArgsParser argsParser = new ArgsParser();
        argsParser.setArgs(arg0);
        
        // When we parse the unknown parameter character
        argsParser.parseParameterArgument(">");
        
        // Then we expect the correct number of arguments to be left over
        assertEquals(1, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseParameterArgumentReturningParameterArgumentWhereIsLongKeyIsTrue() throws Throwable  {
        // Given: An array of arguments and a string representing a parameter argument
        String[] arg0 = new String[5];
        arg0[0] = "---,-<";
        arg0[1] = "---,-<";
        
        // When: The ArgsParser class is instantiated with the array of arguments and the string representing a parameter argument
        ArgsParser argsParser = new ArgsParser(arg0);
        ParameterArgument parseParameterArgument = argsParser.parseParameterArgument("-,-<");
        
        // Then: The ArgsParser class should return a non-null value for the parameter argument and reduce the number of arguments left to parse
        assertNotNull(parseParameterArgument);
        assertEquals(0, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesArgsParserTakingStringArrayAndParseParameterArgumentAndParseParameterArgumentReturningNull1() throws Throwable  {
        // Given
        String[] args = new String[5];
        args[1] = "---,-<";
        ArgsParser parser = new ArgsParser(args);
        
        // When
        parser.parseParameterArgument("-,-<");
        
        // Then
        assertEquals(1, parser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesArgsParserTakingStringArrayAndParseParameterArgumentAndParseParameterArgumentReturningNull2() throws Throwable  {
        // Given
        String[] args = new String[4];
        args[3] = "---,-<";
        ArgsParser parser = new ArgsParser(args);
        
        // When
        parser.parseParameterArgument("-,-<");
        
        // Then
        assertEquals(1, parser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseParameterArgumentAndParseParameterArgumentWithNonEmptyString3() throws Throwable  {
        // Given: an instance of ArgsParser with a parameter argument "-k"
        ArgsParser argsParser = new ArgsParser();
        String[] arg0 = new String[6];
        arg0[3] = "de.devcity.parseargs.arguments.KeyArgument";
        argsParser.setArgs(arg0);
        
        // When: calling the parseParameterArgument method with the argument "-k"
        argsParser.parseParameterArgument("-k");
        
        // Then: the argsLeftCount should be 1
        assertEquals(1, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseSwitchArgumentReturningSwitchArgumentWhereGetPositionIsZero() throws Throwable  {
        // Given: A string array containing a switch argument "-<"
        String[] arg0 = new String[20];
        arg0[0] = "-<";
        
        // When: The ArgsParser is initialized with the string array and the switch argument is parsed
        ArgsParser argsParser = new ArgsParser(arg0);
        SwitchArgument parseSwitchArgument = argsParser.parseSwitchArgument("<");
        
        // Then: The position of the switch argument should be 0, and there should be no more arguments left to parse
        assertEquals(0, parseSwitchArgument.getPosition());
        assertEquals(0, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesArgsParserTakingStringArrayAndCallsParseSwitchArgument0() throws Throwable  {
        // Given: an array of command-line arguments containing a valid switch argument
        String[] arg0 = new String[4];
        arg0[2] = "-,-<";
        
        // When: the parseSwitchArgument method is called with this array of arguments
        ArgsParser argsParser = new ArgsParser(arg0);
        argsParser.parseSwitchArgument(" ");
        
        // Then: the argsLeftCount should be 1, indicating that there is one argument left to be processed
        assertEquals(1, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseSwitchArgumentAndParseSwitchArgumentReturningSwitchArgumentWhereGetPositionIsPositive() throws Throwable  {
        String[] args = new String[8];
        args[6] = "-{-6<";
        
        // When: The ArgsParser is initialized and the "parseSwitchArgument" method is called with the argument "-"
        ArgsParser argsParser = new ArgsParser();
        argsParser.setArgs(args);
        SwitchArgument parseSwitchArgument = argsParser.parseSwitchArgument("-");
        
        // Then: The "isSet" method of the returned SwitchArgument object should return true, indicating that the argument was found and is set to true
        assertTrue(parseSwitchArgument.isSet());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseSwitchArgument0() throws Throwable  {
        // Arrange
        String[] arg0 = new String[6];
        arg0[3] = "de.devcity.parseargs.arguments.KeyArgument";
        ArgsParser argsParser = new ArgsParser();
        argsParser.setArgs(arg0);
        
        // Act
        argsParser.parseSwitchArgument("-");
        
        // Assert
        assertEquals(1, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseSwitchArgument1() throws Throwable  {
        // No Comments were added
        ArgsParser argsParser = new ArgsParser();
        String[] arg0 = new String[6];
        arg0[5] = "";
        argsParser.setArgs(arg0);
        argsParser.parseSwitchArgument("-");
        assertEquals(1, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseSwitchArgument2() throws Throwable  {
        // Given a string array with 8 elements
        String[] arg0 = new String[8];
        
        // When the method parseSwitchArgument is called with argument "-"
        ArgsParser argsParser = new ArgsParser();
        argsParser.setArgs(arg0);
        argsParser.parseSwitchArgument("-");
        
        // Then the number of arguments left should be 1
        assertEquals(1, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesArgsParserTakingStringArrayAndCallsParseSwitchArgument1() throws Throwable  {
        // Create an array of arguments with a switch argument
        String[] arg0 = new String[6];
        arg0[2] = "---,-<";
        
        // Instantiate an instance of ArgsParser with the argument array
        ArgsParser argsParser = new ArgsParser(arg0);
        
        // Parse the switch argument using the parseSwitchArgument method
        SwitchArgument parseSwitchArgument = argsParser.parseSwitchArgument("-,-<");
        
        // Verify that the switch argument was parsed correctly
        assertTrue(parseSwitchArgument.isSet());
        
        // Verify that there are no arguments left to be parsed
        assertEquals(0, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testParseSwitchArgumentAndParseSwitchArgumentReturningSwitchArgumentWhereIsLongKeyIsTrue() throws Throwable  {
        // Given: a set of arguments that include the "--verbose" option
        String[] arg0 = new String[8];
        arg0[6] = "-{-6<";
        ArgsParser argsParser = new ArgsParser();
        argsParser.setArgs(arg0);
        
        // When: the parseSwitchArgument() method is called with the "--verbose" option
        argsParser.parseSwitchArgument("--verbose");
        
        // Then: the number of arguments left to be parsed should be 1
        assertEquals(1, argsParser.getArgsLeftCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetArgsLeftCountReturningPositive() throws Throwable  {
        // Arrange
        String[] args = new String[7];
        args[0] = "";
        
        // Act
        ArgsParser argsParser = new ArgsParser(args);
        int argsLeftCount = argsParser.getArgsLeftCount();
        
        // Assert
        assertEquals(1, argsLeftCount);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetArgsLeftCountReturningZero() throws Throwable  {
        // Arrange
        String[] arg0 = new String[7];
        ArgsParser argsParser = new ArgsParser(arg0);
        
        // Act
        int argsLeftCount = argsParser.getArgsLeftCount();
        
        // Assert
        assertEquals(0, argsLeftCount);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetArgsCountReturningZero() throws Throwable  {
        // Given: No arguments are passed to the ArgsParser constructor
        String[] arg0 = new String[0];
        
        // When: The ArgsParser is created with an empty argument array
        ArgsParser argsParser = new ArgsParser(arg0);
        
        // Then: The getArgsCount method should return 0
        assertEquals(0, argsParser.getArgsCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetArgsThrowsNullPointerException() throws Throwable  {
        // Given: an instance of ArgsParser
        ArgsParser argsParser = new ArgsParser();
        
        // When: calling setArgs with null args
        try {
        argsParser.setArgs((String[]) null);
        
        // Then: expect a NullPointerException to be thrown
        fail("Expecting exception: NullPointerException");
        } catch(NullPointerException e) {
        // Verify that the expected exception is thrown
        verifyException("de.devcity.parseargs.ArgsParser", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetArgsReturningNonEmptyArray() throws Throwable  {
        // Given: a string array with three elements
        String[] arg0 = new String[]{"-a", "-b", "-c"};
        
        // When: constructing an instance of ArgsParser and calling the getArgs method
        ArgsParser argsParser = new ArgsParser(arg0);
        String[] args = argsParser.getArgs();
        
        // Then: the returned array should be different from the input string array
        assertNotSame(args, arg0);
    }
  }
  