content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Thu Mar 21 05:08:48 GMT 2024
   */
  
  package mindbright.ssh;
  
  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 com.gotoservers.ftp.RemoteFileBrowser;
  import com.isnetworks.ssh.FileDisplay;
  import java.awt.Frame;
  import java.awt.HeadlessException;
  import mindbright.gui.ProgressBar;
  import mindbright.ssh.SSHSCPGUIThread;
  import mindbright.ssh.SSHSCPPanel;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.evosuite.runtime.System;
  import org.junit.runner.RunWith;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class SSHSCPGUIThread_ESTest extends SSHSCPGUIThread_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testStartFileThrowsNullPointerException() throws Throwable  {
        // Test that startFile() throws NullPointerException when given an invalid file name
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, true, true, true, true, (SSHSCPPanel) null);
        try {
        // Try to start the file with an invalid name
        sSHSCPGUIThread.startFile("Unable to rename file ", (-2064L));
        fail("Expecting exception: NullPointerException");
        } catch(NullPointerException e) {
        // Verify that the correct exception was thrown
        verifyException("mindbright.ssh.SSHSCPGUIThread", e);
        
        // Check that no message is returned in the exception (getMessage() should return null)
        assertEquals(null, e.getMessage());}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testRoundReturningPositive() throws Throwable  {
        // rollbacked to evosuite
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, false, false, false, true, (SSHSCPPanel) null);
        double round = sSHSCPGUIThread.round(1563.4180847058092);
        assertEquals(1563.4, round, 0.01);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testRoundReturningNegative() throws Throwable  {
        // Given: A SSHSCPGUIThread object is created with the required parameters
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, true, true, true, true, (SSHSCPPanel) null);
        
        // When: The round() method is called with a negative value as an argument
        double round = sSHSCPGUIThread.round((-3442.850444855619));
        
        // Then: The method should return the rounded value of the input number
        assertEquals((-3442.9), round, 0.01);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCutNameReturningNonEmptyString() throws Throwable  {
        // Test that the cutName method returns the correct substring
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, false, false, false, true, (SSHSCPPanel) null);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCutNameReturningEmptyString() throws Throwable  {
        // Given a SSHSCPGUIThread object and some test data
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, false, false, false, false, (SSHSCPPanel) null);
        String testData = "This is some sample text";
        
        // When the cutName method is called with an empty string and a length of 176
        String cutName = sSHSCPGUIThread.cutName("", 176);
        
        // Then the cutName method should return an empty string
        assertEquals("", cutName);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAddUniqueReturningPositive() throws Throwable  {
        // Arrange
        String[] arg0 = SSHSCPGUIThread.spaceSplit("access");
        
        // Act
        int addUnique = SSHSCPGUIThread.addUnique(arg0, "does not exist or you do not have permission to access it.", 0);
        
        // Assert
        assertEquals(1, addUnique);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testStartDirThrowsNullPointerException0() throws Throwable  {
        // Given: We have an SSHSCPGUIThread instance with some properties set
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, true, true, true, true, (SSHSCPPanel) null);
        
        // When: We call the startDir method with a null argument
        try {
        sSHSCPGUIThread.startDir("com.isnetworks.ssh.FileDisplay");
        fail("Expecting exception: NullPointerException");
        } catch(NullPointerException e) {
        // Then: We expect an exception to be thrown with a specific message
        verifyException("mindbright.ssh.SSHSCPGUIThread", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testProgressThrowsNullPointerException0() throws Throwable  {
        // Create an instance of SSHSCPGUIThread with null parameters for the constructor
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, true, true, true, true, (SSHSCPPanel) null);
        
        // Set the lastTime and curFileSize properties to 1L
        sSHSCPGUIThread.lastTime = 1L;
        sSHSCPGUIThread.curFileSize = 1L;
        
        // Create a new ProgressBar instance with negative values for all three arguments
        ProgressBar progressBar = new ProgressBar((-1530), (-1530), (-1530));
        
        // Set the progress property to the new ProgressBar instance
        sSHSCPGUIThread.progress = progressBar;
        
        // Set the current time in milliseconds to 1L using System.setCurrentTimeMillis()
        System.setCurrentTimeMillis(1L);
        
        try {
        // Call the progress() method with 1L as an argument
        sSHSCPGUIThread.progress(1L);
        
        // Expect a NullPointerException to be thrown
        fail("Expecting exception: NullPointerException");
        } catch (NullPointerException e) {
        // Verify that the expected exception was thrown
        verifyException("mindbright.ssh.SSHSCPGUIThread", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testProgressThrowsNullPointerException1() throws Throwable  {
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, true, true, true, true, (SSHSCPPanel) null);
        
        // Given a progress bar with a negative value
        ProgressBar progressBar = new ProgressBar(-1530, -1530, -1530);
        
        // When the progress method is called with a non-null argument
        sSHSCPGUIThread.progress = progressBar;
        
        // Then an exception should be thrown because the progress bar value is negative
        try {
        sSHSCPGUIThread.progress(1L);
        fail("Expecting exception: NullPointerException");
        } catch (NullPointerException e) {
        // no message in exception (getMessage() returned null)
        verifyException("mindbright.ssh.SSHSCPGUIThread", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testProgressWithZero() throws Throwable  {
        // rollbacked to evosuite
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, true, true, true, true, (SSHSCPPanel) null);
        sSHSCPGUIThread.curFileSize = 328L;
        sSHSCPGUIThread.progress(0L);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testProgressThrowsNullPointerException2() throws Throwable  {
        // rollbacked to evosuite
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, false, false, false, false, (SSHSCPPanel) null);
        sSHSCPGUIThread.curFileSize = 328L;
        // Undeclared exception!
        try { 
          sSHSCPGUIThread.progress(328L);
          fail("Expecting exception: NullPointerException");
        
        } catch(NullPointerException e) {
           //
           // no message in exception (getMessage() returned null)
           //
           verifyException("mindbright.ssh.SSHSCPGUIThread", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testProgress() throws Throwable  {
        // Given: A SSHSCPGUIThread is being instantiated with some parameters.
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, true, true, true, true, (SSHSCPPanel) null);
        
        // When: The progress() method is called with an argument of 2778L.
        sSHSCPGUIThread.progress(2778L);
        
        // Then: The progress bar should be updated to reflect the new value of 2778L.
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testStartDirThrowsNullPointerException1() throws Throwable  {
        // Create a new SSHSCPGUIThread instance
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, true, false, false, true, (SSHSCPPanel) null);
        
        // Start the directory navigation with an invalid path
        try {
        sSHSCPGUIThread.startDir("i;E-~}1UvIQhme");
        fail("Expecting exception: NullPointerException");
        } catch(NullPointerException e) {
        // Verify that the expected exception was thrown
        verifyException("mindbright.ssh.SSHSCPGUIThread", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testStartDirThrowsNullPointerException2() throws Throwable  {
        // Given a SSHSCPGUIThread instance with null parameters
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, false, true, true, false, (SSHSCPPanel) null);
        // When startDir is called with a valid directory name
        sSHSCPGUIThread.startDir("C");
        // Then an exception should be thrown
        assertThrows(NullPointerException.class, () -> sSHSCPGUIThread.startDir("C"));
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testStartDirThrowsNullPointerException3() throws Throwable  {
        // Start an SSHSCPGUIThread with null parameters to demonstrate
        // exception handling for startDir() method.
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, true, true, true, true, (SSHSCPPanel) null);
        sSHSCPGUIThread.startTime = 1L;
        
        // Expecting NullPointerException because startDir() method is called with a null argument
        try {
        sSHSCPGUIThread.startDir("America/Godthab");
        fail("Expecting exception: NullPointerException");
        } catch(NullPointerException e) {
        // Verify that the expected exception is thrown
        verifyException("mindbright.ssh.SSHSCPGUIThread", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testStarExpandThrowsNullPointerException() throws Throwable  {
        // Given a string with multiple spaces and special characters,
        String[] arg0 = SSHSCPGUIThread.spaceSplit("y/iQ?~}1UMPIQ*N;c8");
        // When we call the starExpand method with this string as input,
        try {
        SSHSCPGUIThread.starExpand(arg0, "y/iQ?~}1UMPIQ*N;c8");
        // Then an exception is thrown because the argument is not a valid array.
        fail("Expecting exception: NullPointerException");
        } catch(NullPointerException e) {
        // Verify that the exception message is as expected.
        verifyException("mindbright.ssh.SSHSCPGUIThread", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testStarExpand() throws Throwable  {
        // Tests the space splitting functionality of the SSHSCPGUIThread class.
        // The test checks that a string containing multiple spaces is split correctly.
        String[] arg0 = {"The file 'myfile.txt' does not exist or you do not have permission to access it."};
        assertNotNull(arg0); // Checks that the input string is not null
        
        // Tests the star expansion functionality of the SSHSCPGUIThread class.
        // The test checks that a string containing multiple spaces is expanded correctly.
        String[] starExpand = SSHSCPGUIThread.starExpand(arg0, "|Cz:G\"");
        assertEquals(14, starExpand.length); // Checks that the length of the expanded array is correct);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAddUniqueReturningNegative() throws Throwable  {
        // Given a string that contains spaces
        String input = "access\"";
        
        // When we split the string into an array using space as the delimiter
        String[] tokens = SSHSCPGUIThread.spaceSplit(input);
        
        // Then we expect the array to have one element, which is the original string
        assertNotNull(tokens);
        assertEquals(1, tokens.length);
        assertEquals(input, tokens[0]);
        
        // When we add a unique element to the array using the "addUnique" method
        int addUnique = SSHSCPGUIThread.addUnique(tokens, " does not exist or you do not have permission to access it.", (-1446209631));
        
        // Then we expect the return value of "addUnique" to be the same as the third argument
        assertEquals((-1446209631), addUnique);
        
        // And we also expect the array to have one more element, which is the unique element that was added
        assertEquals(2, tokens.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSpaceSplitAndSpaceSplitReturningNonEmptyArray0() throws Throwable  {
        // Test that spaceSplit method returns an array of strings with 1 element
        String[] spaceSplit = SSHSCPGUIThread.spaceSplit("Ckj^#/");
        assertNotNull(spaceSplit);
        assertEquals(1, spaceSplit.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSpaceSplitAndSpaceSplitReturningNonEmptyArray1() throws Throwable  {
        // No Comments were added
        String[] spaceSplit = SSHSCPGUIThread.spaceSplit("\"&^p<ltZ}\"K/E");
        assertEquals(1, spaceSplit.length);
        assertNotNull(spaceSplit);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSpaceSplitAndSpaceSplitReturningNonEmptyArray2() throws Throwable  {
        // Test the ability of the SSHSCPGUIThread class to split a string by spaces and return an array of strings.
        String[] testString = new String[]{"FTP", "response", "421", "received.", "Server", "closed", "connection."};
        String[] actualResult = SSHSCPGUIThread.spaceSplit("FTP response 421 received.  Server closed connection.");
        assertEquals(7, actualResult.length);
        assertArrayEquals(testString, actualResult);
        
        // Test the correctness of the split string by checking if each element is equal to an expected value in the test string array.
        for (int i = 0; i < actualResult.length; i++) {
        assertEquals(testString[i], actualResult[i]);
        }
        
        // Test that the method returns a non-null result.
        assertNotNull(actualResult);
        
        // Test that the method correctly handles null input.
        assertThrows(IllegalArgumentException.class, () -> SSHSCPGUIThread.spaceSplit(null));
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSpaceSplitAndSpaceSplitReturningNull0() throws Throwable  {
        // The input string contains a single space character, which should be split into two parts.
        String[] spaceSplit = SSHSCPGUIThread.spaceSplit("EwUFDfi5*X.J/ \"mR");
        
        // Check that the split operation has been performed correctly.
        assertEquals(2, spaceSplit.length);
        assertEquals("EwUFDfi5*X.J", spaceSplit[0]);
        assertEquals("\"mR", spaceSplit[1]);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSpaceSplitAndSpaceSplitReturningNull1() throws Throwable  {
        // No Comments were added
        String[] spaceSplit = SSHSCPGUIThread.spaceSplit("\"7M@<+wUoTND^ Wv");
        assertNull(spaceSplit);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSpaceSplitAndSpaceSplitReturningNonEmptyArray3() throws Throwable  {
        // No Comments were added
        String[] spaceSplit = SSHSCPGUIThread.spaceSplit("\"This is a test string\"M#+|zUoTN^H Wv");
        assertNotNull(spaceSplit);
        assertEquals(3, spaceSplit.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSpaceSplitWithEmptyString() throws Throwable  {
        // Given an empty string as input, spaceSplit should return null
        String[] spaceSplit = SSHSCPGUIThread.spaceSplit("");
        assertNull(spaceSplit);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSpaceSplitWithNull() throws Throwable  {
        // No Comments were added
        String[] spaceSplit = SSHSCPGUIThread.spaceSplit((String) null);
        assertNull(spaceSplit);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testRunThrowsHeadlessException0() throws Throwable  {
        // Given: The SSHSCPGUIThread is initialized with the necessary parameters and is ready to run.
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, false, false, false, false, (SSHSCPPanel) null);
        
        // When: The run() method is called on the SSHSCPGUIThread.
        sSHSCPGUIThread.run();
        
        // Then: An exception is thrown due to the headless environment.
        try {
        fail("Expecting exception: HeadlessException");
        } catch (HeadlessException e) {
        // no message in exception (getMessage() returned null)
        verifyException("java.awt.GraphicsEnvironment", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testRunThrowsHeadlessException1() throws Throwable  {
        // Test that a SSHSCPGUIThread throws a HeadlessException when run on a headless system
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, true, true, true, true, (SSHSCPPanel) null);
        // Undeclared exception!
        try {
        sSHSCPGUIThread.run();
        fail("Expecting exception: HeadlessException");
        
        } catch(HeadlessException e) {
        //
        // No message in exception (getMessage() returned null)
        //
        verifyException("java.awt.GraphicsEnvironment", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testRoundReturningZero() throws Throwable  {
        // rollbacked to evosuite
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, false, false, false, true, (SSHSCPPanel) null);
        double round = sSHSCPGUIThread.round(0.0);
        assertEquals(0.0, round, 0.01);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testConnectedThrowsNullPointerException() throws Throwable  {
        // Given: A new SSHSCPGUIThread object is created with a null Frame and FileDisplay arguments
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, true, true, true, true, (SSHSCPPanel) null);
        
        // When: The connected method is called with an invalid hostname (missing port number)
        try {
        sSHSCPGUIThread.connected("localhost:");
        } catch(NullPointerException e) {
        //
        // no message in exception (getMessage() returned null)
        //
        verifyException("mindbright.ssh.SSHSCPGUIThread", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEndFileThrowsNullPointerException() throws Throwable  {
        // Given: Create a new instance of the SSHSCPGUIThread class
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, true, true, true, true, (SSHSCPPanel) null);
        
        // When: Call the endFile method with a null argument
        NullPointerException exception = assertThrows(NullPointerException.class, () -> sSHSCPGUIThread.endFile());
        
        // Then: Verify that the expected exception is thrown and no message is provided in the exception
        verifyException("mindbright.ssh.SSHSCPGUIThread", exception);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEndDir() throws Throwable  {
        // rollbacked to evosuite
        SSHSCPGUIThread sSHSCPGUIThread = new SSHSCPGUIThread((Frame) null, (FileDisplay) null, (FileDisplay) null, (RemoteFileBrowser) null, false, false, false, false, (SSHSCPPanel) null);
        sSHSCPGUIThread.endDir();
    }
  }
  