content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Mon Mar 18 14:47:59 GMT 2024
   */
  
  package org.apache.commons.lang3.text;
  
  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 java.text.Format;
  import java.util.HashMap;
  import java.util.Locale;
  import org.apache.commons.lang3.text.ExtendedMessageFormat;
  import org.apache.commons.lang3.text.FormatFactory;
  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 ExtendedMessageFormat_ESTest extends ExtendedMessageFormat_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesExtendedMessageFormatTaking3Arguments() throws Throwable  {
        // Given a Locale object representing Simplified Chinese and a HashMap containing FormatFactory objects
        Locale arg1 = Locale.SIMPLIFIED_CHINESE;
        HashMap<String, FormatFactory> arg2 = new HashMap<>();
        
        // When creating an ExtendedMessageFormat with the pattern "b EH^-aK" and the given Locale and HashMap
        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("b EH^-aK", arg1, arg2);
        
        // Then assert that the toPattern() method returns the expected pattern "b EH^-aK"
        assertEquals("b EH^-aK", extendedMessageFormat.toPattern());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesExtendedMessageFormatTaking2Arguments() throws Throwable  {
        // Create a Locale object representing Korean
        Locale arg1 = new Locale("ko", "KO");
        
        // Create an ExtendedMessageFormat instance using the Korean locale
        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("", arg1);
        
        // Check that the toPattern method returns an empty string
        assertEquals("", extendedMessageFormat.toPattern());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToPatternReturningNonEmptyString() throws Throwable  {
        // Given a map of FormatFactory objects, we want to create an ExtendedMessageFormat object
        HashMap<String, FormatFactory> formatFactories = new HashMap<>();
        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("mi6U|S0<6R", formatFactories);
        
        // When we call the ExtendedMessageFormat.toPattern() method, we expect it to return the same pattern as the original constructor
        String pattern = extendedMessageFormat.toPattern();
        
        // Then we assert that the returned pattern is the same as the original constructor argument
        assertEquals("mi6U|S0<6R", pattern);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesExtendedMessageFormatTaking2ArgumentsAndCallsApplyPattern0() throws Throwable  {
        // Given a HashMap of String and FormatFactory objects
        HashMap<String, FormatFactory> arg1 = new HashMap<String, FormatFactory>();
        
        // When a new ExtendedMessageFormat object is created with the given pattern and arguments
        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("eQ{5}/)Sf7rH5", arg1);
        
        // Then the resulting ExtendedMessageFormat object should have the same pattern as the input
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFailsToCreateExtendedMessageFormatTaking2ArgumentsThrowsIllegalArgumentException0() throws Throwable  {
        // No Comments were added
        HashMap<String, FormatFactory> arg1 = new HashMap<String, FormatFactory>();
        ExtendedMessageFormat extendedMessageFormat = null;
        try {
          extendedMessageFormat = new ExtendedMessageFormat("DQ/!u5+cyGZqL\"{,", arg1);
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // Invalid format argument index at position 15: ,
           //
           verifyException("org.apache.commons.lang3.text.ExtendedMessageFormat", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFailsToCreateExtendedMessageFormatTaking2ArgumentsThrowsIllegalArgumentException1() throws Throwable  {
        // Given a format string with an unterminated format element
        String format = "IUj/,cO&-fl.;k s0{ ";
        HashMap<String, FormatFactory> arg1 = new HashMap<String, FormatFactory>();
        
        ExtendedMessageFormat extendedMessageFormat = null;
        
        // When trying to construct an instance with the format string
        try {
        extendedMessageFormat = new ExtendedMessageFormat(format, arg1);
        fail("Expecting exception: IllegalArgumentException");
        
        } catch (IllegalArgumentException e) {
        // Then an IllegalArgumentException is thrown
        verifyException("org.apache.commons.lang3.text.ExtendedMessageFormat", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFailsToCreateExtendedMessageFormatTaking2ArgumentsThrowsIllegalArgumentException2() throws Throwable  {
        // Given a map of format arguments and a message format string with an invalid argument index
        HashMap<String, FormatFactory> arg1 = new HashMap<String, FormatFactory>();
        ExtendedMessageFormat extendedMessageFormat = null;
        
        // When attempting to create the ExtendedMessageFormat instance with the message format string and map of arguments
        try {
        extendedMessageFormat = new ExtendedMessageFormat("eQ{5 /)S+=7b(rH", arg1);
        fail("Expecting exception: IllegalArgumentException");
        
        } catch (IllegalArgumentException e) {
        // Then an IllegalArgumentException is thrown with the expected message
        verifyException("org.apache.commons.lang3.text.ExtendedMessageFormat", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEquals() throws Throwable  {
        // Given: Two instances of ExtendedMessageFormat, one with a empty pattern and another with a non-empty pattern
        HashMap<String, FormatFactory> arg1 = new HashMap<>();
        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("", arg1);
        ExtendedMessageFormat arg0 = new ExtendedMessageFormat("");
        
        // When: The "equals" method is called on these two instances
        boolean equals = extendedMessageFormat.equals(arg0);
        
        // Then: The result of the "equals" method should be false, since the two instances have different patterns
        assertFalse(equals);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesExtendedMessageFormatTakingStringAndCallsEquals0() throws Throwable  {
        // Create two instances of ExtendedMessageFormat class with different parameters
        ExtendedMessageFormat extendedMessageFormat1 = new ExtendedMessageFormat("eQ{5}/)Sf7rH5");
        ExtendedMessageFormat extendedMessageFormat2 = new ExtendedMessageFormat("eQ{5}/)Sf7rH5");
        
        // Check if the instances are equal
        boolean equals = extendedMessageFormat1.equals(extendedMessageFormat2);
        
        // Assert that the instances are equal
        assertTrue(equals);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testEqualsWithNull() throws Throwable  {
        // Given
        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("");
        
        // When
        boolean equals = extendedMessageFormat.equals((Object) null);
        
        // Then
        assertFalse(equals);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesExtendedMessageFormatTakingStringAndCallsEquals1() throws Throwable  {
        // Arrange
        ExtendedMessageFormat format1 = new ExtendedMessageFormat("eQ{5}/)f7rH5");
        
        // Act
        boolean equals = format1.equals(format1);
        
        // Assert
        assertTrue(equals);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesExtendedMessageFormatTakingStringAndEqualsAndEqualsReturningFalse() throws Throwable  {
        // Given
        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("");
        
        // When
        boolean equals = extendedMessageFormat.equals("");
        
        // Then
        assertFalse(equals);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesExtendedMessageFormatTaking2ArgumentsAndCallsApplyPattern1() throws Throwable  {
        // Create a HashMap object to hold the format arguments
        HashMap<String, FormatFactory> arg1 = new HashMap<String, FormatFactory>();
        
        // Create an instance of the ExtendedMessageFormat class with a pattern and argument map
        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("k|0}.@'kH9E:Wm", arg1);
        
        // Apply a new pattern to the message format object
        extendedMessageFormat.applyPattern("k|0}.@'kH9E:Wm");
        
        // Assert that the applied pattern is equal to the expected pattern
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetFormatByArgumentIndexThrowsUnsupportedOperationException() throws Throwable  {
        // Create an ExtendedMessageFormat object with the format string "FFE"
        ExtendedMessageFormat arg1 = new ExtendedMessageFormat("FFE");
        
        // Try to set the format for argument index 44 using the setFormatByArgumentIndex method
        try {
        arg1.setFormatByArgumentIndex(44, arg1);
        fail("Expecting exception: UnsupportedOperationException");
        } catch(UnsupportedOperationException e) {
        // Verify that the expected exception is thrown
        verifyException("org.apache.commons.lang3.text.ExtendedMessageFormat", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testHashCode() throws Throwable  {
        // Given a non-empty string as input, create an instance of ExtendedMessageFormat class.
        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("");
        
        // When the hashCode() method is called on the instance.
        int actualHashCode = extendedMessageFormat.hashCode();
        
        // Then the return value should be a non-negative integer.
        assertTrue(actualHashCode >= 0);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToPatternReturningEmptyString() throws Throwable  {
        // Given a message format with no placeholders
        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("");
        
        // When the method toPattern is called
        String pattern = extendedMessageFormat.toPattern();
        
        // Then the pattern should be empty
        assertEquals("", pattern);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetFormatsThrowsUnsupportedOperationException() throws Throwable  {
        // Arrange
        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("5");
        Format[] emptyFormatsArray = new Format[0];
        
        try {
        // Act
        extendedMessageFormat.setFormats(emptyFormatsArray);
        
        // Assert
        fail("Expecting exception: UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
        // Verify that the correct exception is thrown and that it contains the expected message
        assertEquals("Cannot set formats for an ExtendedMessageFormat instance.", e.getMessage());}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetFormatsByArgumentIndexThrowsUnsupportedOperationException() throws Throwable  {
        HashMap<String, FormatFactory> arg1 = new HashMap<String, FormatFactory>();
        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("+u<", arg1);
        // Create an array of formats to be set on the ExtendedMessageFormat instance
        Format[] arg0 = new Format[8];
        
        // Attempt to set the formats on the ExtendedMessageFormat instance
        try {
        extendedMessageFormat.setFormatsByArgumentIndex(arg0);
        fail("Expecting exception: UnsupportedOperationException");
        
        } catch(UnsupportedOperationException e) {
        // Verify that the correct exception is thrown
        verifyException("org.apache.commons.lang3.text.ExtendedMessageFormat", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetFormatThrowsUnsupportedOperationException() throws Throwable  {
        // No Comments were added
        ExtendedMessageFormat arg1 = new ExtendedMessageFormat("eQ{5}/)f7rH5");
        // Undeclared exception!
        try { 
          arg1.setFormat(39, arg1);
          fail("Expecting exception: UnsupportedOperationException");
        
        } catch(UnsupportedOperationException e) {
           //
           // no message in exception (getMessage() returned null)
           //
           verifyException("org.apache.commons.lang3.text.ExtendedMessageFormat", e);
        }
    }
  }
  