content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Thu Mar 21 13:19:08 GMT 2024
   */
  
  package org.apache.commons.math3.distribution.fitting;
  
  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 org.apache.commons.math3.distribution.MixtureMultivariateNormalDistribution;
  import org.apache.commons.math3.distribution.fitting.MultivariateNormalMixtureExpectationMaximization;
  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 MultivariateNormalMixtureExpectationMaximization_ESTest extends MultivariateNormalMixtureExpectationMaximization_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEstimateWithPositive() throws Throwable  {
        // Test that a MultivariateNormalMixtureExpectationMaximization throws an IllegalArgumentException when the number of components is larger than the maximum.
        double[][] arg0 = new double[9][4]; // Input data for the multivariate normal mixture expectation maximization algorithm
        try {
        MultivariateNormalMixtureExpectationMaximization.estimate(arg0, 41);
        fail("Expecting exception: IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        // Verify that the expected exception is thrown when the number of components is larger than the maximum
        verifyException("org.apache.commons.math3.distribution.fitting.MultivariateNormalMixtureExpectationMaximization", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEstimate0() throws Throwable  {
        double[][] arg0 = new double[9][4];
        // Undeclared exception!
        try {
        MultivariateNormalMixtureExpectationMaximization.estimate(arg0, -489);
        fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
        // Verify that the exception is thrown because of a small number of components
        assertEquals("Number of components must be greater than 2", e.getMessage());}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEstimate1() throws Throwable  {
        // Given: We have a 2D array of doubles representing the input data for our test case.
        double[][] arg0 = new double[1][4];
        
        // When: We call the estimate method with the input data and a threshold value.
        try {
        MultivariateNormalMixtureExpectationMaximization.estimate(arg0, (-1059));
        fail("Expecting exception: IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        // Then: We expect an IllegalArgumentException to be thrown because the threshold value is negative.
        verifyException("org.apache.commons.math3.distribution.fitting.MultivariateNormalMixtureExpectationMaximization", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFitWithPositiveAndZero() throws Throwable  {
        double[][] data = new double[9][4];
        MultivariateNormalMixtureExpectationMaximization mixtureModel = new MultivariateNormalMixtureExpectationMaximization(data);
        
        // Given a dataset of 9 rows with 4 columns each, create an instance of the MultivariateNormalMixtureExpectationMaximization class with the data as input
        
        try {
        // When we call fit() with a null MixtureMultivariateNormalDistribution object and a maximum number of components (4) and a convergence threshold (0.0), an IllegalArgumentException is expected to be thrown
        mixtureModel.fit((MixtureMultivariateNormalDistribution) null, 4, 0.0);
        fail("Expecting exception: IllegalArgumentException");
        } catch(IllegalArgumentException e) {
        // Then we verify that the exception is a IllegalArgumentException with the correct message
        assertEquals("The input data cannot be null", e.getMessage());}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFitWithNegativeAndNegative() throws Throwable  {
        // Given
        double[][] arg0 = new double[9][4];
        MultivariateNormalMixtureExpectationMaximization multivariateNormalMixtureExpectationMaximization = new MultivariateNormalMixtureExpectationMaximization(arg0);
        
        // When
        try {
        multivariateNormalMixtureExpectationMaximization.fit((MixtureMultivariateNormalDistribution) null, -1877, -1877);
        } catch (IllegalArgumentException e) {
        // Then
        assertTrue(e instanceof IllegalArgumentException);
        verifyException("org.apache.commons.math3.distribution.fitting.MultivariateNormalMixtureExpectationMaximization", e);
        return;
        }
        fail("Expected exception not thrown");
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesMultivariateNormalMixtureExpectationMaximization0() throws Throwable  {
        // No Comments were added
        double[][] arg0 = new double[7][9];
        double[] doubleArray = new double[0];
        arg0[0] = doubleArray;
        MultivariateNormalMixtureExpectationMaximization multivariateNormalMixtureExpectationMaximization = null;
        try {
          multivariateNormalMixtureExpectationMaximization = new MultivariateNormalMixtureExpectationMaximization(arg0);
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // 0 is smaller than the minimum (2)
           //
           verifyException("org.apache.commons.math3.distribution.fitting.MultivariateNormalMixtureExpectationMaximization", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesMultivariateNormalMixtureExpectationMaximization1() throws Throwable  {
        // Given
        double[][] arg0 = new double[9][6];
        double[] doubleArray = new double[0];
        arg0[7] = doubleArray;
        
        // When
        MultivariateNormalMixtureExpectationMaximization multivariateNormalMixtureExpectationMaximization = null;
        try {
        multivariateNormalMixtureExpectationMaximization = new MultivariateNormalMixtureExpectationMaximization(arg0);
        } catch (IllegalArgumentException e) {
        // Then
        verifyException("org.apache.commons.math3.distribution.fitting.MultivariateNormalMixtureExpectationMaximization", e);
        throw e;}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesMultivariateNormalMixtureExpectationMaximization2() throws Throwable  {
        // Given: A 2D array of doubles representing a dataset
        double[][] data = new double[0][1];
        
        // When: Creating a MultivariateNormalMixtureExpectationMaximization instance with the dataset
        MultivariateNormalMixtureExpectationMaximization multivariateNormalMixtureExpectationMaximization = null;
        try {
        multivariateNormalMixtureExpectationMaximization = new MultivariateNormalMixtureExpectationMaximization(data);
        fail("Expecting exception: IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        // Then: The constructor throws an IllegalArgumentException because the dataset is empty
        verifyException("org.apache.commons.math3.distribution.fitting.MultivariateNormalMixtureExpectationMaximization", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetFittedModelThrowsNullPointerException() throws Throwable  {
        // Given: A MultivariateNormalMixtureExpectationMaximization object with a null input array
        double[][] arg0 = new double[1][2];
        MultivariateNormalMixtureExpectationMaximization multivariateNormalMixtureExpectationMaximization = new MultivariateNormalMixtureExpectationMaximization(arg0);
        
        // When: The getFittedModel method is called with the null input array
        try {
        multivariateNormalMixtureExpectationMaximization.getFittedModel();
        } catch (NullPointerException e) {
        // Then: An exception should be thrown, indicating that the input array cannot be null
        assertEquals("Input array cannot be null", e.getMessage());
        throw e;}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetLogLikelihood() throws Throwable  {
        // rollbacked to evosuite
        double[][] arg0 = new double[5][4];
        MultivariateNormalMixtureExpectationMaximization multivariateNormalMixtureExpectationMaximization = new MultivariateNormalMixtureExpectationMaximization(arg0);
        double logLikelihood = multivariateNormalMixtureExpectationMaximization.getLogLikelihood();
        assertEquals(0.0, logLikelihood, 0.01);
    }
  }
  