content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Thu Mar 21 01:19:59 GMT 2024
   */
  
  package ghm.follow.gui;
  
  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 ghm.follow.config.FollowAppAttributes;
  import ghm.follow.gui.FileFollowingPane;
  import ghm.follow.gui.TabbedPane;
  import java.awt.Component;
  import javax.swing.DefaultListCellRenderer;
  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 TabbedPane_ESTest extends TabbedPane_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetSelectedIndexThrowsIndexOutOfBoundsException() throws Throwable  {
        // Given: a tabbed pane with no tabs
        FollowAppAttributes arg0 = new FollowAppAttributes();
        TabbedPane tabbedPane = new TabbedPane(arg0);
        
        // When: trying to set the selected index to 0 (which is out of range)
        try {
        tabbedPane.setSelectedIndex(0);
        fail("Expecting exception: IndexOutOfBoundsException");
        } catch (IndexOutOfBoundsException e) {
        // Then: an IndexOutOfBoundsException is thrown with a message indicating the index and tab count
        assertEquals("Index: 0, Tab count: 0", e.getMessage());}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetSelectedComponent() throws Throwable  {
        // Create a new FollowAppAttributes instance
        FollowAppAttributes followAppAttributes = new FollowAppAttributes();
        
        // Create a new TabbedPane instance with the specified attributes
        TabbedPane tabbedPane = new TabbedPane(followAppAttributes);
        
        // Add a new component to the tabbed pane
        tabbedPane.add("confirmDelete", (Component) null);
        
        // Set the selected component of the tabbed pane
        tabbedPane.setSelectedComponent((FileFollowingPane) null);
        
        // Assert that the focus traversal policy provider is false
        assertFalse(tabbedPane.isFocusTraversalPolicyProvider());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFindComponentAtReturningComponentWhereGetFocusTraversalKeysEnabledIsTrue() throws Throwable  {
        // Given: The system has a TabbedPane component with ignoreRepaint set to true and bounds set to (7, 0, 5, 7)
        // When: The findComponentAt method is called on the TabbedPane with coordinates (0, 0)
        // Then: The returned component should not be a focus traversal policy provider
        
        FollowAppAttributes arg0 = new FollowAppAttributes();
        TabbedPane tabbedPane = new TabbedPane(arg0);
        tabbedPane.setIgnoreRepaint(true);
        tabbedPane.setBounds(7, 0, 5, 7);
        TabbedPane findComponentAt = (TabbedPane)tabbedPane.findComponentAt(0, 0);
        assertFalse(findComponentAt.isFocusTraversalPolicyProvider());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFindComponentAtReturningComponentWhereGetFocusTraversalKeysEnabledIsFalse() throws Throwable  {
        // rollbacked to evosuite
        FollowAppAttributes arg0 = new FollowAppAttributes();
        TabbedPane tabbedPane = new TabbedPane(arg0);
        tabbedPane.setFocusTraversalKeysEnabled(false);
        tabbedPane.setBounds(7, 0, 5, 7);
        Component findComponentAt = tabbedPane.findComponentAt(0, 0);
        assertFalse(findComponentAt.getFocusTraversalKeysEnabled());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFindComponentAtThrowsIndexOutOfBoundsException() throws Throwable  {
        FollowAppAttributes followAppAttributes = new FollowAppAttributes();
        TabbedPane tabbedPane = new TabbedPane(followAppAttributes);
        DefaultListCellRenderer.UIResource defaultListCellRendererUIResource = new DefaultListCellRenderer.UIResource();
        tabbedPane.add("followedFiles", (Component) defaultListCellRendererUIResource);
        tabbedPane.setBounds(6, 0, 5, 7);
        // Test that findComponentAt throws an IndexOutOfBoundsException when the index is greater than or equal to the size of the list
        try {
        tabbedPane.findComponentAt(1, 0);
        fail("Expecting exception: IndexOutOfBoundsException");
        } catch (IndexOutOfBoundsException e) {
        // Verify that the exception message matches the expected value
        verifyException("java.util.ArrayList", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFindComponentAtReturningNull() throws Throwable  {
        // Given: A tabbed pane with a single component and a specific location on the screen
        FollowAppAttributes arg0 = new FollowAppAttributes();
        TabbedPane tabbedPane = new TabbedPane(arg0);
        Component expectedComponent = tabbedPane.findComponentAt((-839), 2);
        // When: The component at the specified location is retrieved
        Component actualComponent = tabbedPane.findComponentAt((-839), 2);
        // Then: The retrieved component should be null, as there is no component at that location
        assertNull(actualComponent);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testRemoveTabAt() throws Throwable  {
        // Given a TabbedPane with focus traversal keys enabled
        FollowAppAttributes arg0 = new FollowAppAttributes();
        TabbedPane tabbedPane = new TabbedPane(arg0);
        tabbedPane.add("bufferSize", (Component) null);
        
        // When a tab is removed from the TabbedPane
        int tabIndex = 0;
        tabbedPane.removeTabAt(tabIndex);
        
        // Then the focus traversal keys are still enabled for the remaining tabs
        assertTrue(tabbedPane.getFocusTraversalKeysEnabled());
    }
  }
  