content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Tue Mar 19 18:22:12 GMT 2024
   */
  
  package org.jdom2.util;
  
  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.shaded.org.mockito.Mockito.*;
  import static org.evosuite.runtime.EvoAssertions.*;
  import java.util.Iterator;
  import java.util.function.Consumer;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.evosuite.runtime.ViolatedAssumptionAnswer;
  import org.jdom2.Attribute;
  import org.jdom2.Content;
  import org.jdom2.Element;
  import org.jdom2.Namespace;
  import org.jdom2.util.NamespaceStack;
  import org.junit.runner.RunWith;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class NamespaceStack_ESTest extends NamespaceStack_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testIterator() throws Throwable  {
        // rollbacked to evosuite
        NamespaceStack namespaceStack = new NamespaceStack();
        Iterator<Namespace> iterator = namespaceStack.iterator();
        assertNotNull(iterator);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetScopeReturningEmptyArray() throws Throwable  {
        // Given: A NamespaceStack with no namespaces in the stack
        Namespace[] arg0 = new Namespace[0];
        NamespaceStack namespaceStack = new NamespaceStack(arg0);
        
        // When: The scope is requested
        Namespace[] scope = namespaceStack.getScope();
        
        // Then: The length of the scope should be 0, indicating that no namespaces are in the stack
        assertEquals(0, scope.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesNamespaceStackTakingNoArgumentsAndCallsIsInScope0() throws Throwable  {
        // Given a new instance of the NamespaceStack class
        NamespaceStack namespaceStack = new NamespaceStack();
        
        // And a Namespace object representing the XML namespace
        Namespace arg0 = Namespace.XML_NAMESPACE;
        
        // When we call the isInScope method with the XML namespace as an argument
        boolean inScope = namespaceStack.isInScope(arg0);
        
        // Then we expect the result to be true, since the XML namespace is in scope by default
        assertTrue(inScope);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesNamespaceStackTakingNamespaceArrayAndCallsAddedReverse() throws Throwable  {
        // Given: a new NamespaceStack instance with an empty array of namespaces as input
        Namespace[] arg0 = new Namespace[0];
        NamespaceStack namespaceStack = new NamespaceStack(arg0);
        
        // When: the addedReverse method is called on the namespace stack
        Iterable<Namespace> addedReverse = namespaceStack.addedReverse();
        
        // Then: the returned iterable should not be null
        assertNotNull(addedReverse);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesNamespaceStackTakingNoArgumentsAndCallsAddedReverse() throws Throwable  {
        // rollbacked to evosuite
        NamespaceStack namespaceStack = new NamespaceStack();
        Iterable<Namespace> addedReverse = namespaceStack.addedReverse();
        assertNotNull(addedReverse);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesNamespaceStackTakingNamespaceArrayAndCallsAddedForward() throws Throwable  {
        // Given
        Namespace[] inputNamespaces = new Namespace[0];
        NamespaceStack namespaceStack = new NamespaceStack(inputNamespaces);
        
        // When
        Iterable<Namespace> addedForward = namespaceStack.addedForward();
        
        // Then
        assertNotNull(addedForward);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testPopThrowsIllegalStateException() throws Throwable  {
        NamespaceStack namespaceStack = new NamespaceStack();
        // Undeclared exception!
        try {
        namespaceStack.pop();
        fail("Expecting exception: IllegalStateException");
        } catch(IllegalStateException e) {
        // Cannot over-pop the stack.
        verifyException("org.jdom2.util.NamespaceStack", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testPushTakingAttribute() throws Throwable  {
        // rollbacked to evosuite
        NamespaceStack namespaceStack = new NamespaceStack();
        Attribute arg0 = new Attribute("name", "value");
        namespaceStack.push(arg0);
        namespaceStack.pop();
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testPushTakingElementWithElementWhereHasAttributesIsFalse() throws Throwable  {
        // rollbacked to evosuite
        NamespaceStack namespaceStack = new NamespaceStack();
        Element arg0 = new Element("xml");
        namespaceStack.push(arg0);
        namespaceStack.push(arg0);
        namespaceStack.push(arg0);
        namespaceStack.push(arg0);
        namespaceStack.push(arg0);
        namespaceStack.push(arg0);
        namespaceStack.push(arg0);
        namespaceStack.push(arg0);
        namespaceStack.push(arg0);
        namespaceStack.push(arg0);
        assertEquals("xml", arg0.getName());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesNamespaceStackTakingNoArgumentsAndCallsPushTakingElement0() throws Throwable  {
        // rollbacked to evosuite
        NamespaceStack namespaceStack = new NamespaceStack();
        Element arg0 = new Element("xml");
        Namespace arg2 = Namespace.XML_NAMESPACE;
        arg0.setNamespace(arg2);
        arg0.setAttribute("xml", "xml", arg2);
        namespaceStack.push(arg0);
        assertEquals("xml", arg0.getName());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesNamespaceStackTakingNoArgumentsAndCallsPushTakingElement1() throws Throwable  {
        // rollbacked to evosuite
        NamespaceStack namespaceStack = new NamespaceStack();
        Element arg0 = new Element("xml");
        arg0.setAttribute("xml", "xml");
        namespaceStack.push(arg0);
        assertEquals("xml", arg0.getName());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesNamespaceStackTakingNoArgumentsAndCallsPushTakingElement2() throws Throwable  {
        // Given a NamespaceStack and an Element with an attribute "xml"
        NamespaceStack namespaceStack = new NamespaceStack();
        Element element = new Element("root");
        element.setAttribute("xml", "xml", Namespace.XML_NAMESPACE);
        
        // When pushing the element onto the stack twice
        namespaceStack.push(element);
        namespaceStack.push(element);
        
        // Then the element should have a CType of Element
        assertEquals(Content.CType.Element, element.getCType());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesNamespaceStackTakingNoArgumentsAndCallsIsInScope1() throws Throwable  {
        // rollbacked to evosuite
        NamespaceStack namespaceStack = new NamespaceStack();
        Namespace arg0 = Namespace.NO_NAMESPACE;
        boolean inScope = namespaceStack.isInScope(arg0);
        assertTrue(inScope);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetScopeReturningNonEmptyArray() throws Throwable  {
        // Given: A new instance of a NamespaceStack class is created.
        NamespaceStack namespaceStack = new NamespaceStack();
        
        // When: The getScope method is called on the NamespaceStack object.
        Namespace[] scope = namespaceStack.getScope();
        
        // Then: The length of the returned array should be 2.
        assertEquals(2, scope.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesNamespaceStackTakingNoArguments() throws Throwable  {
        // rollbacked to evosuite
        NamespaceStack namespaceStack = new NamespaceStack();
        Consumer<Object> arg0 = (Consumer<Object>) mock(Consumer.class, new ViolatedAssumptionAnswer());
        namespaceStack.forEach(arg0);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesNamespaceStackTakingNoArgumentsAndCallsAddedForward() throws Throwable  {
        // Given a new NamespaceStack instance
        NamespaceStack ns = new NamespaceStack();
        
        // When the addedForward method is called
        Iterable<Namespace> forward = ns.addedForward();
        
        // Then the returned value should not be null
        assertNotNull(forward);
    }
  }
  