content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Wed Mar 20 12:22:26 GMT 2024
   */
  
  package gnu.trove.decorator;
  
  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 gnu.trove.decorator.TDoubleShortMapDecorator;
  import gnu.trove.impl.hash.TPrimitiveHash;
  import gnu.trove.map.TDoubleShortMap;
  import gnu.trove.map.hash.TDoubleShortHashMap;
  import java.io.ObjectInput;
  import java.util.Map;
  import java.util.Set;
  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 TDoubleShortMapDecorator_ESTest extends TDoubleShortMapDecorator_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testWrapValueReturningNegative() throws Throwable  {
        // Given a TDoubleShortHashMap object with a negative value of -205
        TDoubleShortHashMap arg0 = new TDoubleShortHashMap((-205));
        
        // When wrapping a short value of -1988 using the TDoubleShortMapDecorator
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator(arg0);
        Short wrapValue = tDoubleShortMapDecorator.wrapValue((short) (-1988));
        
        // Then the wrapped value should be equal to the original short value of -1988
        assertEquals((short) (-1988), (short)wrapValue);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testWrapKeyReturningZero() throws Throwable  {
        // Given a TDoubleShortHashMap with zero entries
        TDoubleShortHashMap arg0 = new TDoubleShortHashMap(0);
        
        // When we create a TDoubleShortMapDecorator and wrap the key (byte) 0
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator(arg0);
        Double wrapKey = tDoubleShortMapDecorator.wrapKey((byte)0);
        
        // Then the wrapped key should be equal to 0.0 with a tolerance of 0.01
        assertEquals(0.0, (double)wrapKey, 0.01);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testUnwrapKeyReturningPositiveAndWrapKeyReturningPositive() throws Throwable  {
        // Test that the wrapKey and unwrapKey methods work as expected
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator();
        Double arg0 = tDoubleShortMapDecorator.wrapKey(3.14);
        double unwrapKey = tDoubleShortMapDecorator.unwrapKey(arg0);
        assertEquals(3.14, unwrapKey, 0.01);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testUnwrapKeyReturningNegativeAndWrapKeyReturningNegative() throws Throwable  {
        // Given a double value -584.1
        Double arg0 = -584.1;
        
        // When we wrap and then unwrap the key using TDoubleShortMapDecorator
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator();
        double unwrapKey = tDoubleShortMapDecorator.unwrapKey(tDoubleShortMapDecorator.wrapKey(arg0));
        
        // Then the result should be equal to the original value, with a tolerance of 0.01
        assertEquals((-584.1), unwrapKey, 0.01);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetMapReturningTDoubleShortMapWhereIsEmptyIsFalse() throws Throwable  {
        // No Comments were added
        TDoubleShortHashMap arg0 = new TDoubleShortHashMap();
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator(arg0);
        tDoubleShortMapDecorator.put((Double) null, (Short) null);
        TDoubleShortMap map = tDoubleShortMapDecorator.getMap();
        assertEquals(0.0, map.getNoEntryKey(), 0.01);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetMap() throws Throwable  {
        // No Comments were added
        TDoubleShortHashMap arg0 = new TDoubleShortHashMap();
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator(arg0);
        TDoubleShortMap map = tDoubleShortMapDecorator.getMap();
        assertEquals((short)0, map.getNoEntryValue());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetMapReturningTDoubleShortMapWhereGetNoEntryKeyIsPositive() throws Throwable  {
        // Given a map of double keys and short values
        TDoubleShortHashMap arg0 = new TDoubleShortHashMap(4275, 0.0F, 4275, (short)57);
        
        // When a decorator is created for the map
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator(arg0);
        
        // Then the decorator should provide access to the underlying map
        TDoubleShortHashMap map = (TDoubleShortHashMap)tDoubleShortMapDecorator.getMap();
        
        assertEquals((byte)2, TPrimitiveHash.REMOVED);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetMapReturningTDoubleShortMapWhereGetNoEntryKeyIsNegative() throws Throwable  {
        // Test that the decorated map is empty when created with a negative size
        TDoubleShortHashMap arg0 = new TDoubleShortHashMap((-1254), (-1254), (-1254), (short) (-694));
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator(arg0);
        TDoubleShortMap map = tDoubleShortMapDecorator.getMap();
        assertTrue(map.isEmpty());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetReturningNegative() throws Throwable  {
        // Arrange
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator();
        double[] arg0 = new double[8];
        arg0[2] = -1.0;
        arg0[3] = -709.06487074;
        arg0[4] = -2156.961444906309;
        arg0[5] = 706.91503636;
        arg0[6] = 2116.183367416589;
        arg0[7] = -3660.71;
        short[] arg1 = new short[8];
        arg1[1] = (short) (-3863);
        TDoubleShortHashMap tDoubleShortHashMap = new TDoubleShortHashMap(arg0, arg1);
        tDoubleShortMapDecorator._map = (TDoubleShortMap) tDoubleShortHashMap;
        
        // Act
        Short get = tDoubleShortMapDecorator.get((Object) null);
        
        // Assert
        assertEquals((short) -3863, (short) get);
        assertNotNull(get);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testContainsKeyReturningTrue() throws Throwable  {
        // rollbacked to evosuite
        TDoubleShortHashMap arg0 = new TDoubleShortHashMap();
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator(arg0);
        Short put = tDoubleShortMapDecorator.put((Double) null, (Short) null);
        assertNull(put);
        
        boolean containsKey = tDoubleShortMapDecorator.containsKey((Object) null);
        assertTrue(containsKey);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSize() throws Throwable  {
        // Given: The "arg0" variable is a TDoubleShortHashMap with a capacity of (-205)
        TDoubleShortHashMap arg0 = new TDoubleShortHashMap((-205));
        
        // When: A TDoubleShortMapDecorator is created from the TDoubleShortHashMap
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator(arg0);
        
        // Then: The size of the TDoubleShortMapDecorator should be 0
        int size = tDoubleShortMapDecorator.size();
        assertEquals(0, size);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testIsEmpty() throws Throwable  {
        // Given a TDoubleShortHashMap instance with a negative initial capacity, load factor and threshold value
        TDoubleShortHashMap arg0 = new TDoubleShortHashMap((-428), (-428), (-428), (short)573);
        
        // When the isEmpty method is called on the TDoubleShortMapDecorator instance with the above argument
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator(arg0);
        boolean empty = tDoubleShortMapDecorator.isEmpty();
        
        // Then the result of isEmpty should be true, as the underlying map is empty
        assertTrue(empty);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesTDoubleShortMapDecoratorTakingTDoubleShortMap() throws Throwable  {
        // Arrange
        TDoubleShortHashMap arg0 = new TDoubleShortHashMap();
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator(arg0);
        
        // Act
        Short orDefault = tDoubleShortMapDecorator.getOrDefault(arg0, (Short) null);
        
        // Assert
        assertNull(orDefault);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testContainsKeyReturningFalse() throws Throwable  {
        // Given: A TDoubleShortHashMap instance, with null as its key
        TDoubleShortHashMap doubleMap = new TDoubleShortHashMap();
        TDoubleShortMapDecorator decorator = new TDoubleShortMapDecorator(doubleMap);
        
        // When: The containsKey() method is called with a null key
        boolean containsNullKey = decorator.containsKey((Object) null);
        
        // Then: It should return false, indicating that the null key does not exist in the map
        assertFalse(containsNullKey);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testContainsValue() throws Throwable  {
        // Given a TDoubleShortHashMap instance with some initial data
        TDoubleShortHashMap arg0 = new TDoubleShortHashMap((-205));
        
        // When calling containsValue(null) on the TDoubleShortMapDecorator
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator(arg0);
        boolean containsValue = tDoubleShortMapDecorator.containsValue((Object) null);
        
        // Then the method should return false, as null is not a valid value for short
        assertFalse(containsValue);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testRemoveReturningNull() throws Throwable  {
        // Given: A TDoubleShortMapDecorator instance with a string key and value
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator();
        
        // When: The remove method is called with the same string key as the one used to put the value
        Short remove = tDoubleShortMapDecorator.remove((Object) "This is a string");
        
        // Then: The value corresponding to the given key should be removed from the map and returned as null
        assertNull(remove);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEntrySet() throws Throwable  {
        // No Comments were added
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator();
        Set<Map.Entry<Double, Short>> arg0 = (Set<Map.Entry<Double, Short>>)tDoubleShortMapDecorator.entrySet();
        Short get = tDoubleShortMapDecorator.get(arg0);
        assertNull(get);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testRemoveReturningPositive() throws Throwable  {
        // Given a TDoubleShortHashMap and a TDoubleShortMapDecorator
        TDoubleShortHashMap map = new TDoubleShortHashMap();
        TDoubleShortMapDecorator decorator = new TDoubleShortMapDecorator(map);
        
        // When we put an element with the key "null" and value 2 into the map using putIfAbsent()
        Short value = new Short((byte) 2);
        decorator.putIfAbsent((Double) null, value);
        
        // Then the map should not be empty
        assertFalse(decorator.isEmpty());
        
        // When we remove the element with the key "null" from the map using remove()
        Short removedValue = decorator.remove((Object) null);
        
        // Then the returned value should be 2 (the original value that was put in the map)
        assertEquals((short) 2, (short) removedValue);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testUnwrapValue() throws Throwable  {
        // Tests the unwrapValue method of TDoubleShortMapDecorator class
        // Creates a new instance of TDoubleShortMapDecorator
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator();
        
        // Creates a short value with the value 12105
        Short arg0 = new Short((short)12105);
        
        // Calls the unwrapValue method on the decorator object
        short unwrapValue = tDoubleShortMapDecorator.unwrapValue(arg0);
        
        // Asserts that the returned value is equal to the original short value
        assertEquals((short)12105, unwrapValue);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testReadExternalThrowsNullPointerException() throws Throwable  {
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator();
        try {
        tDoubleShortMapDecorator.readExternal(null); // throws NullPointerException
        fail("Expecting exception: NullPointerException");
        } catch (NullPointerException e) {
        // no message in exception (getMessage() returned null)
        verifyException("gnu.trove.decorator.TDoubleShortMapDecorator", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testClear() throws Throwable  {
        // No Comments were added
        TDoubleShortHashMap arg0 = new TDoubleShortHashMap(1084);
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator(arg0);
        tDoubleShortMapDecorator.clear();
        assertEquals(0, tDoubleShortMapDecorator.size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testWrapValueReturningPositive() throws Throwable  {
        // Given a TDoubleShortMapDecorator instance with a short value 2501
        TDoubleShortMapDecorator tDoubleShortMapDecorator = new TDoubleShortMapDecorator();
        short inputValue = (short)2501;
        
        // When the wrapValue method is called with the input value
        Short wrappedValue = tDoubleShortMapDecorator.wrapValue(inputValue);
        
        // Then the returned value should be equal to the input value
        assertEquals((short)2501, (short)wrappedValue);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetMapReturningNull() throws Throwable  {
        // Given a TDoubleShortMapDecorator instance,
        TDoubleShortMapDecorator decorator = new TDoubleShortMapDecorator();
        
        // When the getMap() method is called,
        TDoubleShortMap map = decorator.getMap();
        
        // Then the returned map should be null.
        assertNull(map);
    }
  }
  