content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Thu Mar 21 07:48:18 GMT 2024
   */
  
  package wheel.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.runtime.EvoAssertions.*;
  import java.util.Collection;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.junit.runner.RunWith;
  import wheel.ErrorPage;
  import wheel.components.Component;
  import wheel.components.ElExpression;
  import wheel.components.StandaloneComponent;
  import wheel.util.DynamicSelectModel;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class DynamicSelectModel_ESTest extends DynamicSelectModel_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetLabel() throws Throwable  {
        // rollbacked to evosuite
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        Object arg0 = new Object();
        dynamicSelectModel.empty(arg0);
        dynamicSelectModel.enumeration("[] from ");
        String label = dynamicSelectModel.getLabel(0);
        assertNotNull(label);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetComponent() throws Throwable  {
        // Given a DynamicSelectModel object and an ErrorPage object
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        ErrorPage arg0 = new ErrorPage();
        
        // When the setComponent method is called with the ErrorPage object as argument
        dynamicSelectModel.setComponent(arg0);
        
        // Then the component of the DynamicSelectModel should be the ErrorPage object
        assertTrue(dynamicSelectModel.getComponent() instanceof ErrorPage);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testValidateThrowsRuntimeException() throws Throwable  {
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        
        // Given: The dynamic select model is created with a null collection attribute
        // When: The validate method is called
        // Then: An exception should be thrown, as the collection attribute is required and cannot be null
        try {
        dynamicSelectModel.validate();
        fail("Expecting exception: RuntimeException");
        } catch(RuntimeException e) {
        // Could not create DynamicSelection model. Collection attribute was null or not an el-expression.
        verifyException("wheel.util.DynamicSelectModel", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEmpty() throws Throwable  {
        // rollbacked to evosuite
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        dynamicSelectModel.collection("[] from ");
        Object arg0 = new Object();
        DynamicSelectModel empty = dynamicSelectModel.empty(arg0);
        Collection objects = empty.getObjects();
        assertNotNull(objects);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEnumeration() throws Throwable  {
        // Given: A DynamicSelectModel instance is created
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        
        // When: The enumeration method is called on the DynamicSelectModel instance with the specified parameter
        dynamicSelectModel.enumeration("wheel.components.Form$Method");
        
        // Then: The getObjects() method of the DynamicSelectModel instance returns a non-null Collection object
        Collection<Object> objects = dynamicSelectModel.getObjects();
        assertNotNull(objects);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetOptionCountReturningZero() throws Throwable  {
        // Given a DynamicSelectModel object with some options
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        
        // When the model is enumerated and the option count is retrieved
        dynamicSelectModel.enumeration("[] from ");
        int optionCount = dynamicSelectModel.getOptionCount();
        
        // Then the returned option count should be greater than 0
        assertTrue(optionCount > 0);
        
        // And the objects collection should not be null
        Collection<?> objects = dynamicSelectModel.getObjects();
        assertNotNull(objects);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testValidate() throws Throwable  {
        // Create a new DynamicSelectModel object and call the enumeration method with the input argument "[] frvom ".
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        DynamicSelectModel enumeration = dynamicSelectModel.enumeration("[] frvom ");
        
        // Validate the returned value from the enumeration method.
        enumeration.validate();
        
        // Assert that the returned value is the same as the input argument to the enumeration method.
        assertSame(enumeration, dynamicSelectModel);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLabel() throws Throwable  {
        // Given a DynamicSelectModel instance with an invalid label
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        dynamicSelectModel.collection("car_collections");
        dynamicSelectModel.label(null);
        
        // When trying to validate the model
        try {
        dynamicSelectModel.validate();
        fail("Expecting exception: RuntimeException");
        } catch (RuntimeException e) {
        // Then an exception is thrown, indicating that the label value was null or not an EL expression
        verifyException("wheel.util.DynamicSelectModel", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCollection() throws Throwable  {
        // rollbacked to evosuite
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        dynamicSelectModel.collection("car_collections");
        // Undeclared exception!
        try { 
          dynamicSelectModel.validate();
          fail("Expecting exception: RuntimeException");
        
        } catch(RuntimeException e) {
           //
           // Could not create DynamicSelection model. Label attribute was null or not an el-expression.
           //
           verifyException("wheel.util.DynamicSelectModel", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetObjectsThrowsRuntimeException() throws Throwable  {
        // Test that the DynamicSelectModel throws an exception when attempting to build a dynamic ISelectModel with an expression that evaluates to an object that is not a Collection or Object[]
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        DynamicSelectModel collection = dynamicSelectModel.collection("wheel.components.Form$Method"); // Get the collection from the DynamicSelectModel using the "wheel.components.Form$Method" expression
        // Try to get the objects from the collection, which should throw an exception since the expression evaluates to an object that is not a Collection or Object[]
        try {
        collection.getObjects();
        fail("Expecting exception: RuntimeException");
        } catch(RuntimeException e) {
        // Verify that the exception is of the expected type and contains the expected message
        verifyException("wheel.util.DynamicSelectModel", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetOptionCountReturningPositive() throws Throwable  {
        // Given a DynamicSelectModel instance with an enumeration of "wheel.components.Form$Method"
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        dynamicSelectModel.enumeration("wheel.components.Form$Method");
        
        // When the option count is retrieved
        int optionCount = dynamicSelectModel.getOptionCount();
        
        // Then the option count should be 2
        assertEquals(2, optionCount);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCollectionWithEmptyString() throws Throwable  {
        // Create a new instance of DynamicSelectModel
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        
        // Attempt to retrieve the collection from the model
        DynamicSelectModel collection = dynamicSelectModel.collection("");
        
        // Verify that attempting to retrieve the collection throws an exception
        try {
        // Get the objects from the collection
        collection.getObjects();
        
        // Fail the test if the above code does not throw an exception
        fail("Expecting exception: RuntimeException");
        } catch(RuntimeException e) {
        // Verify that the expected exception was thrown
        verifyException("wheel.util.DynamicSelectModel", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testTranslateValueAndValue() throws Throwable  {
        // rollbacked to evosuite
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        DynamicSelectModel collection = dynamicSelectModel.collection("[] frvom ");
        Object arg0 = new Object();
        dynamicSelectModel.empty(arg0);
        dynamicSelectModel.enumeration("[] frvom ");
        collection.value("[] frvom ");
        Object translateValue = dynamicSelectModel.translateValue("org.mvel.util.FastList@0000000030");
        assertSame(translateValue, arg0);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testTranslateValueReturningNull() throws Throwable  {
        // rollbacked to evosuite
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        Object arg0 = new Object();
        dynamicSelectModel.empty(arg0);
        dynamicSelectModel.enumeration("[] from ");
        dynamicSelectModel.value("[] from ");
        Object translateValue = dynamicSelectModel.translateValue("org.mvel.util.FastList@0000000030");
        assertNull(translateValue);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetTopLevelComponent() throws Throwable  {
        // rollbacked to evosuite
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        ErrorPage arg0 = new ErrorPage();
        dynamicSelectModel.setTopLevelComponent(arg0);
        StandaloneComponent topLevelComponent = dynamicSelectModel.getTopLevelComponent();
        assertFalse(topLevelComponent._isGeneratedId());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testTranslator() throws Throwable  {
        // Arrange
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        Object arg0 = new Object();
        
        // Act
        dynamicSelectModel.empty(arg0);
        dynamicSelectModel.enumeration("[] frvom ");
        dynamicSelectModel.value("[] frvom ");
        Object translateValue = dynamicSelectModel.translateValue("org.mvel.util.FastList@0000000030");
        
        // Assert
        assertNull(translateValue);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFailsToCreateDynamicSelectModelTaking3ArgumentsThrowsRuntimeException() throws Throwable  {
        // No Comments were added
        DynamicSelectModel dynamicSelectModel = null;
        try {
          dynamicSelectModel = new DynamicSelectModel((ElExpression) null, (ElExpression) null, (ElExpression) null);
          fail("Expecting exception: RuntimeException");
        
        } catch(RuntimeException e) {
           //
           // Could not create DynamicSelection model. Collection attribute was null or not an el-expression.
           //
           verifyException("wheel.util.DynamicSelectModel", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetTopLevelComponentReturningNull() throws Throwable  {
        // Given a DynamicSelectModel with no top-level component
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        
        // When we get the top-level component
        StandaloneComponent topLevelComponent = dynamicSelectModel.getTopLevelComponent();
        
        // Then it should be null
        assertNull(topLevelComponent);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testReset() throws Throwable  {
        // rollbacked to evosuite
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        dynamicSelectModel.reset();
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetComponentReturningNull() throws Throwable  {
        // Given: We have a DynamicSelectModel instance with no data
        DynamicSelectModel dynamicSelectModel = new DynamicSelectModel();
        
        // When: We call getComponent() on the model
        Component component = dynamicSelectModel.getComponent();
        
        // Then: The returned Component object should be null
        assertNull(component);
    }
  }
  