content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Mon Mar 18 09:34:57 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.Newzgrabber;
  import java.awt.HeadlessException;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.evosuite.runtime.System;
  import org.evosuite.runtime.testdata.EvoSuiteFile;
  import org.evosuite.runtime.testdata.FileSystemHandling;
  import org.junit.runner.RunWith;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class Newzgrabber_ESTest extends Newzgrabber_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFailsToCreateNewzgrabberTakingNoArgumentsThrowsHeadlessException() throws Throwable  {
        // Create a new Newzgrabber instance
        Newzgrabber newzgrabber = null;
        try {
        newzgrabber = new Newzgrabber();
        fail("Expecting exception: HeadlessException");
        } catch(HeadlessException e) {
        // Verify that the exception is of type HeadlessException
        verifyException("java.awt.GraphicsEnvironment", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFindDirectory0() throws Throwable  {
        // No Comments were added
        String findDirectory = Newzgrabber.findDirectory("b@*'FBYIq#2%");
        assertNull(findDirectory);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testMain0() throws Throwable  {
        // Given: The NewzGrabbers's main method is being executed with a debug flag
        String[] args = new String[1];
        args[0] = "-debug";
        Newzgrabber.main(args);
        
        // When: The NewzGrabber's main method is executed with the debug flag
        Newzgrabber.main(args);
        
        // Then: The NewzGrabbers's debug mode is enabled, and the number of arguments passed to the main method is equal to 1
        assertEquals(1, args.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testMainThrowsSystemExitException() throws Throwable  {
        String[] args = new String[1];
        args[0] = "-batch";
        
        // When we call main with an invalid argument
        try {
        Newzgrabber.main(args);
        
        // Then we expect a SystemExitException to be thrown
        fail("Expecting exception: System.SystemExitException");
        } catch (System.SystemExitException e) {
        // Verify that the exception is of the correct type
        verifyException("org.evosuite.runtime.System", e);
        
        // And no message is provided with the exception (getMessage() returns null)
        assertNull(e.getMessage());}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testMain1() throws Throwable  {
        // Given a command line argument for batch mode
        String[] arg0 = new String[1];
        arg0[0] = "--batch";
        
        // When the program is run in batch mode
        Newzgrabber.main(arg0);
        
        // Then the length of the argument array should be 1
        assertEquals(1, arg0.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testMainWithEmptyArray() throws Throwable  {
        // Given: no arguments are passed to the main method
        String[] args = new String[0];
        
        // When: the main method is called with no arguments
        Newzgrabber.main(args);
        
        // Then: the length of the array should be 0
        assertEquals(0, args.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFindDirectoryReturningNonEmptyString() throws Throwable  {
        // Given: Newzgrabber is a class that contains methods for finding directories in the file system
        // When: We call the "findDirectory" method with a path to a jar file as input
        String findDirectory = Newzgrabber.findDirectory("EvoSuite_pathingJar5447796544197742539.jar");
        // Then: We expect the "findDirectory" method to return a non-null string representing the directory path of the jar file
        assertNotNull(findDirectory);
        // And: The returned directory path should be "/tmp"
        assertEquals("/tmp", findDirectory);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFindDirectory1() throws Throwable  {
        // Given: We have an EvoSuiteFile object representing a file that does not exist
        EvoSuiteFile arg0 = new EvoSuiteFile("/tmp/EvoSuite_pathingJar5447796544197742539.jar");
        
        // When: We call the findDirectory method with a file that does not exist
        String findDirectory = Newzgrabber.findDirectory("b@*'FBYIq#2%");
        
        // Then: The result should be null, as the file does not exist and cannot be found
        assertNull(findDirectory);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testMainAndSetupBasicSystem() throws Throwable  {
        // rollbacked to evosuite
        String[] arg0 = new String[1];
        arg0[0] = "-verbose";
        Newzgrabber.main(arg0);
        Newzgrabber.setupBasicSystem();
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetupBasicSystem() throws Throwable  {
        // No Comments were added
        Newzgrabber.setupBasicSystem();
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFailsToCreateNewzgrabberTakingStringThrowsHeadlessException() throws Throwable  {
        // rollbacked to evosuite
        Newzgrabber newzgrabber = null;
        try {
          newzgrabber = new Newzgrabber("The quick brown fox jumps over the lazy dog.");
          fail("Expecting exception: HeadlessException");
        
        } catch(HeadlessException e) {
           //
           // no message in exception (getMessage() returned null)
           //
           verifyException("java.awt.GraphicsEnvironment", e);
        }
    }
  }
  