content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Mon Mar 18 06:12:49 GMT 2024
   */
  
  package com.lts.swing.combobox;
  
  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.lts.swing.combobox.SimpleComboBox;
  import com.lts.swing.combobox.SimpleComboBoxModel;
  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 SimpleComboBox_ESTest extends SimpleComboBox_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetModel() throws Throwable  {
        // Given a SimpleComboBoxModel and a SimpleComboBox instance
        SimpleComboBoxModel model = new SimpleComboBoxModel();
        SimpleComboBox comboBox = new SimpleComboBox(model);
        
        // When we set the model of the combo box to the SimpleComboBoxModel instance
        comboBox.setModel(model);
        
        // Then the combo box should have a size of 0
        assertEquals(0, model.getSize());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSelectedValueReturningNonNull() throws Throwable  {
        SimpleComboBoxModel arg0 = new SimpleComboBoxModel();
        SimpleComboBox simpleComboBox = new SimpleComboBox(arg0);
        Object arg1 = simpleComboBox.getTreeLock();
        arg0.add((Object) null, arg1);
        
        // Verify that the selected value is not null
        Object selectedValue = simpleComboBox.getSelectedValue();
        assertFalse(selectedValue.equals((Object)simpleComboBox));
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSelectedLongReturningPositive() throws Throwable  {
        // Given: A SimpleComboBoxModel and a SimpleComboBox with the model added to it
        SimpleComboBoxModel arg0 = new SimpleComboBoxModel();
        SimpleComboBox simpleComboBox = new SimpleComboBox(arg0);
        
        // When: An element is added to the model with a null value and a Byte value of 1
        arg0.add((Object) null, new Byte((byte)1));
        
        // Then: The selected long should be equal to 1L
        long selectedLong = simpleComboBox.getSelectedLong();
        assertEquals(1L, selectedLong);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSelectedIntReturningPositive() throws Throwable  {
        // Create a new instance of SimpleComboBoxModel
        SimpleComboBoxModel arg0 = new SimpleComboBoxModel();
        
        // Create a new instance of SimpleComboBox with the SimpleComboBoxModel
        SimpleComboBox simpleComboBox = new SimpleComboBox(arg0);
        
        // Add an item to the SimpleComboBoxModel with a null value and a Byte value of 3
        arg0.add((Object) null, new Byte((byte) 3));
        
        // Get the selected Int value from the SimpleComboBox
        int selectedInt = simpleComboBox.getSelectedInt();
        
        // Assert that the selected Int value is equal to 3
        assertEquals(3, selectedInt);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSelectedValueReturningNull() throws Throwable  {
        // Given: A new instance of SimpleComboBoxModel and a SimpleComboBox with an empty model
        SimpleComboBoxModel arg0 = new SimpleComboBoxModel();
        SimpleComboBox simpleComboBox = new SimpleComboBox(arg0);
        
        // When: The getSelectedValue method is called on the combobox
        Object selectedValue = simpleComboBox.getSelectedValue();
        
        // Then: The selected value should be null
        assertNull(selectedValue);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSelectedLongReturningZero() throws Throwable  {
        // Given a SimpleComboBox with a null value
        SimpleComboBoxModel model = new SimpleComboBoxModel();
        Byte nullByte = new Byte((byte) 0);
        SimpleComboBox comboBox = new SimpleComboBox(model);
        
        // When the null value is added to the combo box
        model.add(null, nullByte);
        
        // Then the selected long should be equal to 0L
        long selectedLong = comboBox.getSelectedLong();
        assertEquals(0L, selectedLong);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSelectedLongReturningNegative() throws Throwable  {
        // Given an empty combo box
        SimpleComboBoxModel model = new SimpleComboBoxModel();
        SimpleComboBox comboBox = new SimpleComboBox(model);
        
        // When we call getSelectedLong() on the combo box
        long selectedLong = comboBox.getSelectedLong();
        
        // Then it should return -1L
        assertEquals(-1L, selectedLong);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSelectedLongThrowsIllegalArgumentException() throws Throwable  {
        // No Comments were added
        SimpleComboBoxModel arg0 = new SimpleComboBoxModel();
        SimpleComboBox arg1 = new SimpleComboBox(arg0);
        arg0.add((Object) null, arg1);
        // Undeclared exception!
        try { 
          arg1.getSelectedLong();
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // no message in exception (getMessage() returned null)
           //
           verifyException("com.lts.swing.combobox.SimpleComboBox", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSelectedIntReturningZero() throws Throwable  {
        // Create a new SimpleComboBoxModel and add a null item
        SimpleComboBoxModel model = new SimpleComboBoxModel();
        Byte zeroByte = new Byte((byte) 0);
        model.add(null, zeroByte);
        
        // Create a new SimpleComboBox with the model and select an item
        SimpleComboBox comboBox = new SimpleComboBox(model);
        comboBox.setSelectedItem(zeroByte);
        
        // Get the selected integer value from the combo box
        int selectedInt = comboBox.getSelectedInt();
        
        // Assert that the selected integer is equal to 0
        assertEquals(0, selectedInt);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSelectedIntThrowsIllegalArgumentException() throws Throwable  {
        // No Comments were added
        SimpleComboBoxModel arg0 = new SimpleComboBoxModel();
        SimpleComboBox arg1 = new SimpleComboBox(arg0);
        arg0.add((Object) null, arg1);
        // Undeclared exception!
        try { 
          arg1.getSelectedInt();
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // no message in exception (getMessage() returned null)
           //
           verifyException("com.lts.swing.combobox.SimpleComboBox", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSelectedIntReturningNegative() throws Throwable  {
        // No Comments were added
        SimpleComboBoxModel arg0 = new SimpleComboBoxModel();
        SimpleComboBox simpleComboBox = new SimpleComboBox(arg0);
        int selectedInt = simpleComboBox.getSelectedInt();
        assertEquals((-1), selectedInt);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFailsToCreateSimpleComboBoxThrowsNullPointerException() throws Throwable  {
        // Given: A new instance of SimpleComboBox
        SimpleComboBox simpleComboBox = null;
        
        // When: Trying to create a new instance with a null model
        try {
        simpleComboBox = new SimpleComboBox((SimpleComboBoxModel) null);
        } catch (NullPointerException e) {
        // Then: Expecting a NullPointerException to be thrown
        assertNotNull(e.getMessage());}
    }
  }
  