content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Wed Mar 20 15:18:48 GMT 2024
   */
  
  package twitter4j;
  
  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.List;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.junit.runner.RunWith;
  import twitter4j.HttpParameter;
  import twitter4j.Paging;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class Paging_ESTest extends Paging_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testMaxIdReturningPagingWhereGetSinceIdIsPositive() throws Throwable  {
        // Given a Paging object with a specific page number and count
        Paging paging = new Paging(2102, 2102);
        
        // When we call the maxId() method on this Paging object
        Paging maxId = paging.maxId(2102);
        
        // Then the returned Paging object has the correct page and count values
        assertEquals(2102, maxId.getPage());
        assertEquals(2102, maxId.getCount());
        
        // And the sinceId and maxId values are also set correctly
        assertEquals(2102L, maxId.getSinceId());
        assertEquals(2102L, maxId.getMaxId());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesPagingTaking3Arguments() throws Throwable  {
        // Given a Paging object with the page size of 31 and the starting ID of 2335
        Paging paging = new Paging(31, 2335, 2335);
        
        // When the getSinceId method is called
        long sinceId = paging.getSinceId();
        
        // Then the value returned should be the same as the starting ID of 2335
        assertEquals(2335, paging.getCount());
        assertEquals(2335L, sinceId);
        
        // And the max ID should be -1 (meaning no maximum)
        assertEquals((-1L), paging.getMaxId());
        
        // And the page number should be 31 (the page size)
        assertEquals(31, paging.getPage());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetPageReturningPositive() throws Throwable  {
        // Given: A Paging object is created with a page number of 2102
        Paging paging = new Paging(2102, 2102, 2102, 2102);
        
        // When: The getPage() method is called on the Paging object
        int page = paging.getPage();
        
        // Then: The value returned should be the same as the page number passed in the constructor (2102)
        assertEquals(2102L, paging.getMaxId());
        assertEquals(2102L, paging.getSinceId());
        assertEquals(2102, page);
        assertEquals(2102, paging.getCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetMaxIdReturningPositive() throws Throwable  {
        // Given: We have a Paging object with a maximum ID of 26.
        Paging paging = new Paging();
        paging.maxId(26L);
        
        // When: We retrieve the maximum ID from the Paging object.
        long maxId = paging.getMaxId();
        
        // Then: The maximum ID should be equal to 26.
        assertEquals(26L, maxId);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCountReturningPagingWhereGetPageIsPositive() throws Throwable  {
        // Given a Paging object with default values
        Paging paging = new Paging();
        
        // When we set the sinceId to 69 and count to 39
        paging.sinceId(69);
        paging.count(39);
        
        // Then the getSinceId method should return 69
        assertEquals(69L, paging.getSinceId());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAsPostParameterListTaking2ArgumentsReturningListWhereIsEmptyIsTrue() throws Throwable  {
        // Given
        Paging paging = new Paging();
        char[] arg0 = new char[6];
        
        // When
        List<HttpParameter> asPostParameterList = paging.asPostParameterList(arg0, "QoyZ");
        
        // Then
        assertEquals(0, asPostParameterList.size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAsPostParameterListTaking2ArgumentsAndSetCount() throws Throwable  {
        // Given: A Paging object with a count of 2,146,842,416
        Paging paging = new Paging();
        paging.setCount(2146842416);
        
        // When: The Paging object is converted to a post parameter list with the character 'c' and an empty string as the separator
        char[] arg0 = new char[2];
        arg0[0] = 'c';
        paging.asPostParameterList(arg0, "");
        
        // Then: The Paging object's count should be equal to 2,146,842,416
        assertEquals(2146842416, paging.getCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAsPostParameterListTakingCharArrayReturningListWhereIsEmptyIsFalse() throws Throwable  {
        // Given a Paging object with a maxId of 99L
        Paging paging = new Paging();
        paging.maxId(99L);
        
        // When the asPostParameterList method is called on the Paging object with an array of chars containing 'm' at index 2
        char[] arg0 = new char[9];
        arg0[2] = 'm';
        paging.asPostParameterList(arg0);
        
        // Then the getMaxId method should return 99L
        assertEquals(99L, paging.getMaxId());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAsPostParameterListTakingNoArgumentsReturningListWhereIsEmptyIsFalse() throws Throwable  {
        // rollbacked to evosuite
        Paging paging = new Paging();
        Paging count = paging.count(5977);
        count.asPostParameterList();
        assertEquals(5977, paging.getCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetSinceId() throws Throwable  {
        // Given: a Paging instance with default values
        Paging paging = new Paging();
        
        // When: setting the sinceId to 1001L
        paging.setSinceId(1001L);
        
        // Then: the sinceId should be equal to 1001L
        assertEquals(1001L, paging.getSinceId());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetPage() throws Throwable  {
        // Given: A new instance of the Paging class is created
        Paging paging = new Paging();
        
        // When: The page number is set to 5
        paging.setPage(5);
        
        // Then: The page number should be equal to 5
        assertEquals(5, paging.getPage());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSinceIdReturningNegative() throws Throwable  {
        Paging paging = new Paging();
        long sinceId = paging.getSinceId();
        assertEquals((-1L), sinceId);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetMaxIdReturningNegative() throws Throwable  {
        // This test ensures that the getMaxId method returns -1 when there are no items in the paging.
        Paging paging = new Paging();
        long maxId = paging.getMaxId();
        assertEquals(-1L, maxId);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetCount() throws Throwable  {
        // Given a paging object with a negative one value for the count field
        Paging paging = new Paging();
        int expectedCount = -1;
        
        // When the getCount method is called on this paging object
        int actualCount = paging.getCount();
        
        // Then the returned value should be negative one
        assertEquals(expectedCount, actualCount);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetPageReturningNegative() throws Throwable  {
        // Given a Paging object with a negative page number
        Paging paging = new Paging();
        paging.setPage(-1);
        
        // When the getPage method is called
        int page = paging.getPage();
        
        // Then the returned page number should be -1
        assertEquals(-1, page);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSinceIdReturningPagingWhereGetPageIsNegative() throws Throwable  {
        // Given
        Paging paging = new Paging();
        paging.sinceId(3600L);
        
        // When
        Paging arg0 = new Paging();
        boolean equals = paging.equals(arg0);
        
        // Then
        assertEquals(3600L, paging.getSinceId());
        assertFalse(equals);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesPagingTakingInt() throws Throwable  {
        // Given two instances of Paging, paging and arg0
        Paging paging = new Paging();
        Paging arg0 = new Paging(8);
        
        // When we compare these instances using the equals method
        boolean areEqual = paging.equals(arg0);
        
        // Then we expect that they are not equal
        assertFalse(areEqual);
        
        // And we expect the values of some properties to be different
        assertEquals(-1, arg0.getCount());
        assertEquals(8, arg0.getPage());
        assertEquals(-1L, arg0.getSinceId());
        assertFalse(arg0.equals((Object)paging));
        assertEquals(-1L, arg0.getMaxId());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetMaxId() throws Throwable  {
        // Create two Paging objects with the same max id and verify that they are equal
        Paging arg0 = new Paging();
        Paging paging = new Paging(8);
        assertEquals(paging, arg0);
        
        // Set the max id on one of the Paging objects and verify that it is now unequal to the other object
        paging.setMaxId(8);
        assertNotEquals(paging, arg0);
        
        // Verify that the getMaxId() method returns the correct value for both objects
        assertEquals(8L, paging.getMaxId());
        assertEquals(8L, arg0.getMaxId());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCount() throws Throwable  {
        // Given a Paging object with a count of 9
        Paging arg0 = new Paging();
        arg0.count(9);
        
        // When the equals method is called on two objects with different counts
        Paging paging = new Paging();
        boolean equals = paging.equals(arg0);
        
        // Then the result should be false
        assertFalse(equals);
        
        // And the count of the first object should be equal to 9
        assertEquals(9, arg0.getCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEqualsReturningTrue() throws Throwable  {
        // Given: two instances of the same class with the same data
        Paging arg0 = new Paging();
        Paging paging = new Paging();
        
        // When: we call the equals method on both instances
        boolean equals = paging.equals(arg0);
        
        // Then: the two instances should be equal
        assertTrue(equals);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesPagingTakingNoArguments() throws Throwable  {
        // Given a Paging instance, arg0
        Paging paging1 = new Paging();
        
        // When the equals method is called on the instance with itself as an argument
        boolean equals = paging1.equals(paging1);
        
        // Then the result should be true
        assertTrue(equals);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEqualsReturningFalse() throws Throwable  {
        // Create a new instance of Paging with some sample values
        Paging paging = new Paging();
        paging.setPage(2);
        paging.setCount(84);
        paging.setSinceId(1731);
        paging.setMaxId(1731);
        
        // Call the equals method on the created instance with a string containing similar values
        boolean equals = paging.equals("Paging{page=2, count=84, sinceId=1731, maxId=1731}");
        
        // Assert that the result of the call is false
        assertFalse(equals);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetMaxIdThrowsIllegalArgumentException() throws Throwable  {
        // Given: A Paging object with a maximum ID of 0L
        Paging paging = new Paging();
        paging.setMaxId(0L);
        
        // When: The setMaxId() method is called with an invalid value (0)
        try {
        paging.setMaxId(0L);
        fail("Expecting exception: IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        // Then: An IllegalArgumentException should be thrown, indicating that the maximum ID must be a positive integer
        verifyException("twitter4j.Paging", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetSinceIdThrowsIllegalArgumentException() throws Throwable  {
        // rollbacked to evosuite
        Paging paging = new Paging();
        // Undeclared exception!
        try { 
          paging.setSinceId((-2481L));
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // since_id should be positive integer. passed:-2481
           //
           verifyException("twitter4j.Paging", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetPageThrowsIllegalArgumentException() throws Throwable  {
        Paging paging = new Paging();
        // Test that a negative page number throws an IllegalArgumentException.
        try {
        paging.setPage(-1);
        fail("Expecting exception: IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        // Verify that the correct exception is thrown.
        verifyException("twitter4j.Paging", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAsPostParameterArrayTaking2ArgumentsReturningEmptyArray() throws Throwable  {
        // Given: A Paging object and some input parameters
        Paging paging = new Paging();
        char[] arg0 = new char[1];
        arg0[0] = ',';
        String sinceId = "12345";
        
        // When: The asPostParameterArray method is called with the input parameters
        HttpParameter[] postParameters = paging.asPostParameterArray(arg0, sinceId);
        
        // Then: The length of the returned array should be 0, since the input parameter 'sinceId' is not a valid parameter for this method
        assertEquals(0, postParameters.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAsPostParameterArrayTaking2ArgumentsReturningNonEmptyArray() throws Throwable  {
        // Given
        Paging paging = new Paging();
        char[] arg0 = new char[1];
        arg0[0] = 'c';
        
        // When
        paging.asPostParameterArray(arg0, ", sinceId=");
        
        // Then
        assertEquals(2, paging.getCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAsPostParameterArrayTakingNoArgumentsReturningNonEmptyArray() throws Throwable  {
        // rollbacked to evosuite
        Paging paging = new Paging();
        paging.setCount(2146842416);
        paging.asPostParameterArray();
        assertEquals(2146842416, paging.getCount());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSinceIdReturningPagingWhereGetCountIsPositive() throws Throwable  {
        // Given: A Paging object with a specific sinceId value
        Paging paging = new Paging(4, 4, 4, 1952257861L);
        
        // When: The sinceId is set to a different value
        paging.sinceId(1952257861L);
        
        // Then: The getSinceId method should return the new value
        assertEquals(1952257861L, paging.getSinceId());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAsPostParameterListTakingNoArgumentsReturningListWhereIsEmptyIsTrue() throws Throwable  {
        // Given: A Paging object is created with no parameters set.
        Paging paging = new Paging();
        
        // When: The asPostParameterList method is called on the Paging object.
        List<HttpParameter> asPostParameterList = paging.asPostParameterList();
        
        // Then: The returned list should be empty, as there are no parameters set.
        assertEquals(0, asPostParameterList.size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesPagingTakingLong() throws Throwable  {
        // Given a Paging object with a max id of -1 and a page number of -1,
        // and a since id of 5 and a count of -1.
        Paging paging = new Paging(5L);
        
        // When the getMaxId() method is called on this Paging object,
        assertEquals(-1L, paging.getMaxId());
        
        // Then the returned value should be -1, indicating that there is no max id.
        
        // When the getPage() method is called on this Paging object,
        assertEquals(-1, paging.getPage());
        
        // Then the returned value should be -1, indicating that there is no page number.
        
        // When the getSinceId() method is called on this Paging object,
        assertEquals(5L, paging.getSinceId());
        
        // Then the returned value should be 5, indicating that the since id is set to 5.
        
        // When the getCount() method is called on this Paging object,
        assertEquals(-1, paging.getCount());
        
        // Then the returned value should be -1, indicating that there is no count.
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToString() throws Throwable  {
        // Given: a Paging object with valid input values
        Paging paging = new Paging();
        paging.setPage(1);
        paging.setCount(20);
        paging.setSinceId(100);
        paging.setMaxId(500);
        
        // When: calling the toString() method on the Paging object
        String string = paging.toString();
        
        // Then: the resulting string should be a well-formed JSON string representation of the Paging object
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetCountThrowsIllegalArgumentException() throws Throwable  {
        // Given: A Paging instance with a valid count value (4) and size value (4)
        Paging paging = new Paging(4, 4);
        
        // When: We try to set the count to an invalid value (-960)
        paging.setCount(-960);
        
        // Then: An IllegalArgumentException should be thrown with a clear message indicating the error
        try {
        fail("Expecting exception: IllegalArgumentException");
        } catch(IllegalArgumentException e) {
        // count should be positive integer. passed:-960
        verifyException("twitter4j.Paging", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAsPostParameterListTakingCharArrayReturningListWhereIsEmptyIsTrue() throws Throwable  {
        Paging paging = new Paging();
        // Assert that the count, page, sinceId, and maxId values are all -1
        assertEquals(-1, paging.getCount());
        assertEquals(-1, paging.getPage());
        assertEquals(-1L, paging.getSinceId());
        assertEquals(-1L, paging.getMaxId());
        
        // Test the asPostParameterList method with an empty char array argument
        char[] arg0 = new char[0];
        List<HttpParameter> asPostParameterList = paging.asPostParameterList(arg0);
        // Assert that the list is empty
        assertTrue(asPostParameterList.isEmpty());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCountReturningPagingWhereGetMaxIdIsPositive() throws Throwable  {
        // Given a Paging object with a count of 579 and no sinceId
        Paging paging = new Paging();
        paging.count(579);
        
        // When the maxId method is called with an argument of 1
        Paging maxId = paging.maxId(1);
        
        // Then the count should be set to 579
        assertEquals(579, paging.getCount());
        
        // And the sinceId should be set to -1
        assertEquals(-1L, paging.getSinceId());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesPagingTaking2ArgumentsAndCallsHashCode() throws Throwable  {
        // Given
        Paging paging = new Paging(69, 69);
        
        // When
        paging.hashCode();
        
        // Then
        assertEquals(69, paging.getCount());
        assertEquals((-1L), paging.getMaxId());
        assertEquals(69, paging.getPage());
        assertEquals((-1L), paging.getSinceId());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAsPostParameterArrayTaking2ArgumentsThrowsIllegalStateException() throws Throwable  {
        // Given a Paging instance with a count parameter set to 10
        Paging paging = new Paging();
        paging.count(10);
        
        // When the asPostParameterArray method is called with an invalid argument (a char array with length of 1) and a sinceId parameter
        char[] arg0 = new char[1];
        IllegalStateException exception = null;
        try {
        paging.asPostParameterArray(arg0, ", sinceId=98765");
        } catch (IllegalStateException e) {
        exception = e;
        }
        
        // Then an IllegalStateException is thrown with the expected message "Paging parameter [, sinceId=98765] is not supported with this operation"
        assertNotNull(exception);
        verifyException("twitter4j.Paging", exception);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAsPostParameterArrayTakingNoArgumentsReturningEmptyArray() throws Throwable  {
        // Given: A Paging object with no parameters set
        Paging paging = new Paging();
        
        // When: The asPostParameterArray method is called on the Paging object
        HttpParameter[] asPostParameterArray = paging.asPostParameterArray();
        
        // Then: An empty array is returned, indicating that no parameters are set
        assertEquals(0, asPostParameterArray.length);
    }
  }
  