content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Mon Mar 18 08:35:17 GMT 2024
   */
  
  package jigl.image.ops;
  
  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 jigl.image.ops.ConnectedComponents;
  import jigl.image.types.BinaryImage;
  import jigl.image.types.GrayImage;
  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 ConnectedComponents_ESTest extends ConnectedComponents_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testApplyReturningGrayImageWhereXIsZeroAndGrayImageWhereYIsZero() throws Throwable  {
        // Given an empty binary image
        BinaryImage arg0 = new BinaryImage();
        
        // When applying the connected components algorithm
        ConnectedComponents connectedComponents = new ConnectedComponents(0, 0);
        GrayImage apply = connectedComponents.apply(arg0);
        
        // Then the result is an empty image with a zero square sum
        assertEquals(0L, apply.sqrSum());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testApply0() throws Throwable  {
        // Given a binary image with 1 row and 1306 columns
        BinaryImage input = new BinaryImage(1, 1306);
        
        // When we apply the connected components algorithm to the image
        ConnectedComponents connectedComponents = new ConnectedComponents(1, 1);
        GrayImage output = connectedComponents.apply(input);
        
        // Then the sum of the squared values in the output image should be equal to 1306L
        assertEquals(1306L, output.sqrSum());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testApply1() throws Throwable  {
        // Given a binary image with three rows and one column
        BinaryImage arg0 = new BinaryImage(3, 1);
        
        // When the connected components are applied to the image
        ConnectedComponents connectedComponents = new ConnectedComponents(0, 1);
        GrayImage apply = connectedComponents.apply(arg0);
        
        // Then the resulting image should have a sum of 3
        assertEquals(3, apply.addSum());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testApply2() throws Throwable  {
        // Given an image with a single pixel in row 1 and column 1306
        BinaryImage inputImage = new BinaryImage(1, 1306);
        
        // When we apply the ConnectedComponents algorithm to this image
        ConnectedComponents connectedComponents = new ConnectedComponents(0, 1);
        GrayImage outputImage = connectedComponents.apply(inputImage);
        
        // Then the resulting image should have a total sum of 1306 pixels
        assertEquals(1306L, outputImage.sqrSum());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFailsToCreateConnectedComponentsThrowsException0() throws Throwable  {
        // Test that a ConnectedComponents object is not created with an invalid threshold value
        // (threshold must be in the range of 0 to 255)
        
        // Setup: create a ConnectedComponents object with a negative threshold value
        ConnectedComponents connectedComponents = null;
        try {
        connectedComponents = new ConnectedComponents(-1, 255);
        fail("Expecting exception: Exception");
        
        } catch(Throwable e) {
        //
        // no message in exception (getMessage() returned null)
        //
        verifyException("jigl.image.ops.ConnectedComponents", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testApplyReturningGrayImageWhereSqrSumIsZero() throws Throwable  {
        // Given a binary image with only one pixel set to true (representing the connected component)
        ConnectedComponents connectedComponents = new ConnectedComponents(0, 0);
        BinaryImage arg0 = new BinaryImage(1, 1306);
        
        // When applying the connected components algorithm on this image
        GrayImage apply = connectedComponents.apply(arg0);
        
        // Then the resulting image should have a sum of squares equal to zero, indicating that all pixels are part of the same connected component
        assertEquals(0L, apply.sqrSum());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFailsToCreateConnectedComponentsThrowsException1() throws Throwable  {
        // Test that the constructor throws an exception if the image is not valid
        ConnectedComponents connectedComponents = null;
        try {
        connectedComponents = new ConnectedComponents(10, 20);
        fail("Expecting exception: Exception");
        } catch(Throwable e) {
        // Verify that the exception is the expected type
        assertEquals(Exception.class, e.getClass());
        // Verify that the message in the exception is null (no message was set)
        assertNull(e.getMessage());}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testApplyThrowsNullPointerException() throws Throwable  {
        // rollbacked to evosuite
        ConnectedComponents connectedComponents = new ConnectedComponents(1, 1);
        BinaryImage arg0 = new BinaryImage(999, 67);
        // Undeclared exception!
        try { 
          connectedComponents.apply(arg0);
          fail("Expecting exception: NullPointerException");
        
        } catch(NullPointerException e) {
           //
           // no message in exception (getMessage() returned null)
           //
           verifyException("jigl.image.ops.ConnectedComponents", e);
        }
    }
  }
  