content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Tue Mar 19 17:41:55 GMT 2024
   */
  
  package net.sf.javaml.core;
  
  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 java.util.LinkedHashSet;
  import java.util.Map;
  import java.util.Set;
  import java.util.SortedSet;
  import net.sf.javaml.core.AbstractInstance;
  import net.sf.javaml.core.DenseInstance;
  import net.sf.javaml.core.Instance;
  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 DenseInstance_ESTest extends DenseInstance_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testValueReturningNegative() throws Throwable  {
        // No Comments were added
        double[] arg0 = new double[7];
        arg0[0] = (-1299.39739092553);
        DenseInstance denseInstance = new DenseInstance(arg0);
        double value = denseInstance.value(0);
        assertEquals((-1299.39739092553), value, 0.01);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSizeReturningPositive() throws Throwable  {
        // Given a DenseInstance with 31 elements
        DenseInstance denseInstance = new DenseInstance(31);
        
        // When we call the size method
        int size = denseInstance.size();
        
        // Then the returned value should be 31
        assertEquals(31, size);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testNoAttributesReturningZero() throws Throwable  {
        // No Comments were added
        DenseInstance denseInstance = new DenseInstance(0);
        int noAttributes = denseInstance.noAttributes();
        assertEquals(0, noAttributes);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testNoAttributesReturningPositive() throws Throwable  {
        // Creates a new DenseInstance with 7 attributes
        double[] arg0 = new double[7];
        Integer arg1 = new Integer(0);
        DenseInstance denseInstance = new DenseInstance(arg0, arg1);
        
        // Checks that the number of attributes is equal to 7
        int noAttributes = denseInstance.noAttributes();
        assertEquals(7, noAttributes);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetAndPut() throws Throwable  {
        // Given a DenseInstance with 1780 elements and a Double value of -1.0 for the key 1
        DenseInstance denseInstance = new DenseInstance(1780);
        Integer key = new Integer(1);
        Double value = new Double((-1.0));
        
        // When we put the key-value pair into the DenseInstance
        denseInstance.put(key, value);
        
        // Then the get method should return the same Double value for the given key
        Double actualValue = denseInstance.get(key);
        assertEquals(-1.0, (double)actualValue, 0.01);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCopyReturningInstanceWhereGetIDIsZero() throws Throwable  {
        // Given a DenseInstance with ID 801 and nextID = 0
        DenseInstance denseInstance = new DenseInstance(801);
        AbstractInstance.nextID = 0;
        
        // When we call copy on the instance
        Instance copy = denseInstance.copy();
        
        // Then
        // The returned instance should be equal to the original one (based on their IDs)
        assertTrue(copy.equals((Object)denseInstance));
        // And it should not be the same object as the original instance
        assertNotSame(copy, denseInstance);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCopyReturningInstanceWhereGetIDIsNegative() throws Throwable  {
        // Given a DenseInstance with ID 821 and nextID -4
        DenseInstance denseInstance = new DenseInstance(821);
        AbstractInstance.nextID = (-4);
        
        // When we call copy on the instance
        Instance copy = denseInstance.copy();
        
        // Then the returned instance should be equal to the original instance
        assertTrue(copy.equals((Object)denseInstance));
        
        // And the ID of the returned instance should be -4
        assertEquals(-4, copy.getID());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testKeySet() throws Throwable  {
        // Given a DenseInstance with 57 attributes
        DenseInstance denseInstance = new DenseInstance(57);
        
        // When we call the method removeAttributes with a SortedSet of integers representing the keys to be removed
        SortedSet<Integer> arg0 = denseInstance.keySet();
        denseInstance.removeAttributes(arg0);
        
        // Then the number of attributes should be equal to 0
        assertEquals(0, denseInstance.noAttributes());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testRemoveAttributesWithEmptySet() throws Throwable  {
        // Given: A DenseInstance with 33 attributes and a LinkedHashSet of integers representing the attribute indices to remove
        DenseInstance denseInstance = new DenseInstance(33);
        LinkedHashSet<Integer> arg0 = new LinkedHashSet<Integer>();
        
        // When: The method removeAttributes is called with the argument
        denseInstance.removeAttributes(arg0);
        
        // Then: The instance should not be empty and the removed attribute indices should match the ones passed in as an argument
        assertFalse(denseInstance.isEmpty());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCopy() throws Throwable  {
        // Given a DenseInstance with id 821
        DenseInstance denseInstance = new DenseInstance(821);
        
        // When we copy the instance
        Instance arg0 = denseInstance.copy();
        
        // Then the resulting instance should be equal to the original
        assertTrue(denseInstance.equals(arg0));
        
        // And have the same id as the original
        assertEquals(1, arg0.getID());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEqualsWithNonNull() throws Throwable  {
        // Given a DenseInstance with 31 features and an object that is not a DenseInstance
        DenseInstance denseInstance = new DenseInstance(31);
        Object arg0 = new Object();
        
        // When the equals method is called on the DenseInstance with the object argument
        boolean equals = denseInstance.equals(arg0);
        
        // Then the result should be false, since the object is not a DenseInstance
        assertFalse(equals);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEqualsReturningTrue() throws Throwable  {
        // Given: A DenseInstance object with 31 features
        DenseInstance instance = new DenseInstance(31);
        
        // When: Comparing the same object to itself
        boolean equals = instance.equals(instance);
        
        // Then: The result should be true, as the objects are the same
        assertTrue(equals);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEqualsWithNull() throws Throwable  {
        // Given a DenseInstance with 31 features
        DenseInstance denseInstance = new DenseInstance(31);
        
        // When we call the equals method with null as an argument
        boolean equals = denseInstance.equals((Object) null);
        
        // Then the result should be false
        assertFalse(equals);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testValues() throws Throwable  {
        // Given a DenseInstance with 31 features
        DenseInstance denseInstance = new DenseInstance(31);
        
        // When the values of the DenseInstance are retrieved
        Collection<Double> values = denseInstance.values();
        
        // Then the returned collection should not be null
        assertNotNull(values);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEntrySet() throws Throwable  {
        // No Comments were added
        DenseInstance denseInstance = new DenseInstance(31);
        Set<Map.Entry<Integer, Double>> entrySet = (Set<Map.Entry<Integer, Double>>)denseInstance.entrySet();
        assertEquals(31, entrySet.size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testContainsValue() throws Throwable  {
        // rollbacked to evosuite
        DenseInstance denseInstance = new DenseInstance(2109);
        Object arg0 = new Object();
        boolean containsValue = denseInstance.containsValue(arg0);
        assertFalse(containsValue);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testContainsKeyReturningTrue() throws Throwable  {
        // Given a DenseInstance with 4089 elements and a key value of 956
        DenseInstance denseInstance = new DenseInstance(4089);
        Integer arg0 = new Integer(956);
        
        // When the containsKey method is called with the key value of 956
        boolean containsKey = denseInstance.containsKey(arg0);
        
        // Then the method should return true, indicating that the key is present in the DenseInstance
        assertTrue(containsKey);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testContainsKey() throws Throwable  {
        // Given a DenseInstance with a capacity of 4089 and an Integer key of 4089
        DenseInstance denseInstance = new DenseInstance(4089);
        Integer arg0 = new Integer(4089);
        
        // When the containsKey method is called with the Integer key
        boolean containsKey = denseInstance.containsKey(arg0);
        
        // Then the method should return false
        assertFalse(containsKey);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testContainsKeyWithNonNull() throws Throwable  {
        // Given a DenseInstance with 31 elements and an object as a key
        DenseInstance denseInstance = new DenseInstance(31);
        Object arg0 = new Object();
        
        // When the containsKey method is called with the given key
        boolean containsKey = denseInstance.containsKey(arg0);
        
        // Then the method should return false, since the object is not present in the DenseInstance
        assertFalse(containsKey);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSizeReturningZero() throws Throwable  {
        // Create a new instance of DenseInstance with no attributes
        DenseInstance denseInstance = new DenseInstance(0);
        
        // Assert that the size of the instance is 0 (i.e., no attributes)
        int size = denseInstance.size();
        assertEquals(0, size);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testRemoveAttribute() throws Throwable  {
        // Given: A DenseInstance with 6 attributes and a value for the attribute at index 1
        double[] arg0 = new double[6];
        Object arg1 = new Object();
        DenseInstance denseInstance = new DenseInstance(arg0, arg1);
        
        // When: The removeAttribute method is called with the index of the attribute to be removed (1)
        denseInstance.removeAttribute(1);
        
        // Then: The size of the DenseInstance should be 5 (one less than the original size due to the removal of the attribute at index 1)
        assertEquals(5, denseInstance.size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testIsEmpty() throws Throwable  {
        // Given: A DenseInstance with 31 features is created
        DenseInstance denseInstance = new DenseInstance(31);
        
        // When: The isEmpty() method is called on the instance
        boolean empty = denseInstance.isEmpty();
        
        // Then: The result should be false, indicating that the instance is not empty
        assertFalse(empty);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToString() throws Throwable  {
        // No Comments were added
        DenseInstance denseInstance = new DenseInstance(111);
        String string = denseInstance.toString();
        assertEquals("{[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0];null}", string);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testHashCode() throws Throwable  {
        // Given a DenseInstance with an ID of 821
        DenseInstance denseInstance = new DenseInstance(821);
        
        // When the hashCode method is called on the DenseInstance
        int hashCode = denseInstance.hashCode();
        
        // Then the hash code should be a unique identifier for the DenseInstance
        assertEquals(821, hashCode);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCopyReturningInstanceWhereSizeIsZero() throws Throwable  {
        // Given a DenseInstance with an ID of 0
        DenseInstance denseInstance = new DenseInstance(0);
        
        // When the instance is copied
        Instance copy = denseInstance.copy();
        
        // Then the copy has an ID of 1
        assertEquals(1, copy.getID());
        
        // And the copy is equal to the original instance
        assertTrue(copy.equals((Object)denseInstance));
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testValueReturningZero() throws Throwable  {
        // Given a dense instance with values [7]
        double[] arg0 = new double[7];
        DenseInstance denseInstance = new DenseInstance(arg0);
        
        // When getting the value of the first element
        double value = denseInstance.value(0);
        
        // Then the value should be zero
        assertEquals(0.0, value, 0.01);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testClear() throws Throwable  {
        // Given a DenseInstance with 821 attributes
        DenseInstance denseInstance = new DenseInstance(821);
        
        // When the clear method is called on the instance
        denseInstance.clear();
        
        // Then the instance should be empty
        assertTrue(denseInstance.isEmpty());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testRemoveThrowsUnsupportedOperationException() throws Throwable  {
        // Given
        DenseInstance denseInstance = new DenseInstance(821);
        
        // When
        Double arg0 = new Double(821);
        try {
        denseInstance.remove((Object) arg0);
        } catch (UnsupportedOperationException e) {
        // Then
        assertTrue(e instanceof UnsupportedOperationException);
        verifyException("net.sf.javaml.core.DenseInstance", e);}
    }
  }
  