content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Mon Mar 18 09:49:43 GMT 2024
   */
  
  package Newzgrabber;
  
  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 Newzgrabber.Downloader;
  import Newzgrabber.Newzgrabber;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.evosuite.runtime.mock.java.io.MockFile;
  import org.junit.runner.RunWith;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class Downloader_ESTest extends Downloader_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetTotalLinesReturningNegative() throws Throwable  {
        // Given a Downloader instance with a negative total lines value
        Downloader downloader = new Downloader();
        downloader.setTotalLines(-2009L);
        
        // When the getTotalLines method is called
        long totalLines = downloader.getTotalLines();
        
        // Then the total lines value should be negative
        assertEquals(-2009L, totalLines);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetTimeoutReturningZero() throws Throwable  {
        // Given a Downloader instance with default timeout of -1
        Downloader downloader = new Downloader();
        assertEquals(-1, downloader.getTimeout());
        
        // When the timeout is set to 0
        downloader.setTimeout(0);
        
        // Then the timeout should be set to 0
        int timeout = downloader.getTimeout();
        assertEquals(0, timeout);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetGroupReturningEmptyString() throws Throwable  {
        // rollbacked to evosuite
        Downloader downloader = new Downloader();
        downloader.setGroup("");
        downloader.getGroup();
        assertEquals((-1), downloader.getTimeout());
        assertFalse(downloader.ABORT);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetBaseMessageIdReturningPositive() throws Throwable  {
        // Given a Downloader object with a set of IDs
        Downloader downloader = new Downloader();
        long[] ids = new long[4];
        ids[0] = (long) 123;
        downloader.setIds(ids);
        
        // When the baseMessageId is requested
        long baseMessageId = downloader.getBaseMessageId();
        
        // Then the method returns the first ID in the list of IDs
        assertEquals(123L, baseMessageId);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testStartDownloadThrowsNullPointerException0() throws Throwable  {
        Downloader downloader = new Downloader();
        long[] arg0 = new long[21];
        downloader.setIds(arg0);
        Newzgrabber.verbose = true;
        
        try {
        downloader.startDownload();
        fail("Expecting exception: NullPointerException");
        } catch (NullPointerException e) {
        // Verify that the correct exception is thrown
        verifyException("Newzgrabber.Downloader", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testStartDownload() throws Throwable  {
        // rollbacked to evosuite
        Downloader downloader = new Downloader();
        long[] arg0 = new long[0];
        downloader.setIds(arg0);
        downloader.startDownload();
        assertFalse(downloader.ABORT);
        assertEquals((-1), downloader.getTimeout());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testStartDownloadThrowsNullPointerException1() throws Throwable  {
        Downloader downloader = new Downloader();
        long[] arg0 = new long[21];
        downloader.setIds(arg0);
        try {
        downloader.startDownload();
        fail("Expecting exception: NullPointerException");
        } catch(NullPointerException e) {
        // Verify that the exception is thrown due to a null pointer in the setIds method
        assertTrue(e.getMessage().contains("null"));}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testClose0() throws Throwable  {
        // rollbacked to evosuite
        Downloader downloader = new Downloader();
        Newzgrabber.verbose = true;
        downloader.close();
        assertFalse(downloader.ABORT);
        assertEquals((-1), downloader.getTimeout());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testClose1() throws Throwable  {
        // Given a Downloader object
        Downloader downloader = new Downloader();
        
        // When the close method is called on the Downloader
        downloader.close();
        
        // Then the ABORT field should be false
        assertFalse(downloader.ABORT);
        
        // And the timeout field should be set to -1
        assertEquals((-1), downloader.getTimeout());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetBaseMessageIdReturningZero() throws Throwable  {
        // No Comments were added
        Downloader downloader = new Downloader();
        long[] arg0 = new long[4];
        downloader.setIds(arg0);
        downloader.getBaseMessageId();
        assertFalse(downloader.ABORT);
        assertEquals((-1), downloader.getTimeout());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetBaseMessageIdReturningNegative() throws Throwable  {
        // Given a Downloader instance with default values
        Downloader downloader = new Downloader();
        
        // When the base message ID is retrieved
        long baseMessageId = downloader.getBaseMessageId();
        
        // Then the expected value of -1L is returned
        assertEquals((-1L), baseMessageId);
        
        // And the instance is not in an ABORT state
        assertFalse(downloader.ABORT);
        
        // And the timeout value is set to the default value of -1
        assertEquals((-1), downloader.getTimeout());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetTimeoutReturningNegative() throws Throwable  {
        // rollbacked to evosuite
        Downloader downloader = new Downloader();
        int timeout = downloader.getTimeout();
        assertFalse(downloader.ABORT);
        assertEquals((-1), timeout);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetDownloadDirectory() throws Throwable  {
        // Given
        Downloader downloader = new Downloader();
        MockFile arg0 = new MockFile("C:UsersUserDocumentsDownloads", "U9EZn6");
        
        // When
        downloader.setDownloadDirectory(arg0);
        
        // Then
        assertEquals((-1), downloader.getTimeout());
        assertFalse(downloader.ABORT);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetPassword() throws Throwable  {
        // Set the password for the downloader
        Downloader downloader = new Downloader();
        downloader.setPassword("qwerty");
        
        // Verify that the timeout is set to -1 (infinite)
        assertEquals((-1), downloader.getTimeout());
        
        // Verify that the download is not aborted (ABORT is false)
        assertFalse(downloader.ABORT);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetTimeoutReturningPositive() throws Throwable  {
        // Given a Downloader instance with default timeout value of -1
        Downloader downloader = new Downloader();
        assertEquals((-1), downloader.getTimeout());
        
        // When the timeout value is set to 1000 using the setter method
        downloader.setTimeout(1000);
        
        // Then the getter method returns the updated timeout value of 1000
        int timeout = downloader.getTimeout();
        assertEquals(1000, timeout);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetGroupReturningNonEmptyString() throws Throwable  {
        // Given a Downloader object, we want to verify that the group is set correctly and that the timeout is set to -1.
        // When the downloader is created and the group is set to "Marketing"
        Downloader downloader = new Downloader();
        downloader.setGroup("Marketing");
        
        // Then we expect the group to be "Marketing" and the timeout to be -1
        assertEquals("Marketing", downloader.getGroup());
        assertEquals(-1, downloader.getTimeout());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetTotalLinesReturningZero() throws Throwable  {
        // rollbacked to evosuite
        Downloader downloader = new Downloader();
        downloader.getTotalLines();
        assertEquals((-1), downloader.getTimeout());
        assertFalse(downloader.ABORT);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetGroupReturningNull() throws Throwable  {
        // This test case verifies that the downloader can handle a group of files correctly.
        
        Downloader downloader = new Downloader();
        
        // Verify that the downloader is not aborted after downloading a group of files.
        assertFalse(downloader.ABORT);
        
        // Verify that the timeout for downloading a group of files is set to -1.
        assertEquals((-1), downloader.getTimeout());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetUsername() throws Throwable  {
        // Create a new instance of the Downloader class and set the username to "user12345"
        Downloader downloader = new Downloader();
        downloader.setUsername("user12345");
        
        // Test that the download was not aborted
        assertFalse(downloader.ABORT);
        
        // Test that the timeout is set to -1 (infinite)
        assertEquals((-1), downloader.getTimeout());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetTitle() throws Throwable  {
        // Given an NNTP object
        Downloader downloader = new Downloader();
        
        // When the title is set to "Created NNTP object"
        downloader.setTitle("Created NNTP object");
        
        // Then the ABORT flag should be false
        assertFalse(downloader.ABORT);
        
        // And the timeout should be -1
        assertEquals((-1), downloader.getTimeout());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetServer() throws Throwable  {
        // rollbacked to evosuite
        Downloader downloader = new Downloader();
        downloader.setServer("https://www.example.com");
        assertFalse(downloader.ABORT);
        assertEquals((-1), downloader.getTimeout());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetTableIndex() throws Throwable  {
        Downloader downloader = new Downloader();
        
        // Given a specific table index
        downloader.setTableIndex(13);
        
        // When aborting the download process
        downloader.ABORT = true;
        
        // Then the download should be aborted
        assertTrue(downloader.ABORT);
        
        // And the timeout should be set to -1
        assertEquals(-1, downloader.getTimeout());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetDownloadData() throws Throwable  {
        // Test that the Downloader class can be instantiated and set up correctly
        Downloader downloader = new Downloader();
        Object[] arg0 = new Object[1];
        downloader.setDownloadData(arg0);
        assertEquals((-1), downloader.getTimeout()); // Assert that the timeout is initialized to -1
        assertFalse(downloader.ABORT); // Assert that the ABORT flag is set to false
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetTotalLinesReturningPositive() throws Throwable  {
        // Given a Downloader instance with the total lines set to 1000000L
        Downloader downloader = new Downloader();
        downloader.setTotalLines(1000000L);
        
        // When the total lines are retrieved from the Downloader instance
        long totalLines = downloader.getTotalLines();
        
        // Then the total lines should be 1000000L
        assertEquals(1000000L, totalLines);
    }
  }
  