content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Mon Mar 18 16:22:19 GMT 2024
   */
  
  package org.apache.commons.lang3;
  
  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.util.List;
  import java.util.Locale;
  import java.util.Set;
  import org.apache.commons.lang3.LocaleUtils;
  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 LocaleUtils_ESTest extends LocaleUtils_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAvailableLocaleList() throws Throwable  {
        // Given a list of available locales
        List<Locale> availableLocaleList = LocaleUtils.availableLocaleList();
        
        // When the list is not empty
        if (!availableLocaleList.isEmpty()) {
        // Then we can assert that the list contains at least one element
        assertFalse(availableLocaleList.isEmpty());}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCountriesByLanguageWithNull() throws Throwable  {
        // No Comments were added
        List<Locale> countriesByLanguage = LocaleUtils.countriesByLanguage((String) null);
        assertTrue(countriesByLanguage.isEmpty());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCountriesByLanguageWithNonEmptyString() throws Throwable  {
        // Test that the method returns an empty list when given a non-existent language code
        List<Locale> countriesByLanguage = LocaleUtils.countriesByLanguage("zzz");
        assertTrue(countriesByLanguage.isEmpty());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLanguagesByCountryWithNonEmptyString() throws Throwable  {
        // No Comments were added
        List<Locale> languagesByCountry = LocaleUtils.languagesByCountry("Qv+}^E[E}");
        assertEquals(0, languagesByCountry.size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLanguagesByCountryWithNull() throws Throwable  {
        // No Comments were added
        List<Locale> languagesByCountry = LocaleUtils.languagesByCountry((String) null);
        assertTrue(languagesByCountry.isEmpty());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLocaleLookupListTaking2ArgumentsWithNull() throws Throwable  {
        // Given a list of locales and a target locale
        // When the locale lookup list is created with the specified locales
        // Then the returned list should have the expected size
        Locale arg0 = new Locale("org.apache.commons.lang3.LocaleUtils");
        List<Locale> localeLookupList = LocaleUtils.localeLookupList(arg0, (Locale) null);
        assertEquals(2, localeLookupList.size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLocaleLookupListTaking2Arguments() throws Throwable  {
        // Create a new Locale object
        Locale arg1 = new Locale("en-US", "USA", "America");
        // Invoke the method being tested with the input parameter
        List<Locale> localeLookupList = LocaleUtils.localeLookupList(arg1, arg1);
        // Verify that the result is correct
        assertEquals(3, localeLookupList.size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLocaleLookupListTaking2ArgumentsWithNullAndNull() throws Throwable  {
        // rollbacked to evosuite
        List<Locale> localeLookupList = LocaleUtils.localeLookupList((Locale) null, (Locale) null);
        assertEquals(0, localeLookupList.size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException0() throws Throwable  {
        // No Comments were added
        // Undeclared exception!
        try { 
          LocaleUtils.toLocale("sp_S*_}");
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // Invalid locale format: sp_S*_}
           //
           verifyException("org.apache.commons.lang3.LocaleUtils", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocale0() throws Throwable  {
        // Create a Locale object from a string representation.
        Locale locale = LocaleUtils.toLocale("sp__}");
        
        // Check that the variant is correct.
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException1() throws Throwable  {
        // No Comments were added
        // Undeclared exception!
        try { 
          LocaleUtils.toLocale("pcu_S_");
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // Invalid locale format: pcu_S_
           //
           verifyException("org.apache.commons.lang3.LocaleUtils", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException2() throws Throwable  {
        // No Comments were added
        // Undeclared exception!
        try { 
          LocaleUtils.toLocale("p_[4*_}");
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // Invalid locale format: p_[4*_}
           //
           verifyException("org.apache.commons.lang3.LocaleUtils", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException3() throws Throwable  {
        // No Comments were added
        // Undeclared exception!
        try { 
          LocaleUtils.toLocale("zM c'G7wmsWBd_]8_");
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // Invalid locale format: zM c'G7wmsWBd_]8_
           //
           verifyException("org.apache.commons.lang3.LocaleUtils", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException4() throws Throwable  {
        // No Comments were added
        // Undeclared exception!
        try { 
          LocaleUtils.toLocale("kn_Wu");
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // Invalid locale format: kn_Wu
           //
           verifyException("org.apache.commons.lang3.LocaleUtils", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException5() throws Throwable  {
        // No Comments were added
        // Undeclared exception!
        try { 
          LocaleUtils.toLocale("kqn_X[TcY*/WD*IMm");
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // Invalid locale format: kqn_X[TcY*_/WD*IMm
           //
           verifyException("org.apache.commons.lang3.LocaleUtils", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException6() throws Throwable  {
        // No Comments were added
        // Undeclared exception!
        try { 
          LocaleUtils.toLocale("k_Xj[TcY*/4U*i\"Iqm");
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // Invalid locale format: k_Xj[TcY*_/4U*i\"Iqm
           //
           verifyException("org.apache.commons.lang3.LocaleUtils", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException7() throws Throwable  {
        // Test that an IllegalArgumentException is thrown when using an invalid locale format
        try {
        LocaleUtils.toLocale("VC_Px)Nnl");
        fail("Expecting exception: IllegalArgumentException");
        } catch(IllegalArgumentException e) {
        // Verify that the exception message matches the expected value
        assertEquals("Invalid locale format: VC_Px)Nnl", e.getMessage());}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException8() throws Throwable  {
        // Test that an IllegalArgumentException is thrown when trying to create a Locale from an invalid string
        try {
        // This code is expected to throw an IllegalArgumentException because the locale format "gnytu" is not valid
        LocaleUtils.toLocale("gnytu");
        fail("Expecting exception: IllegalArgumentException");
        } catch(IllegalArgumentException e) {
        // This exception is expected to be thrown, as the locale format "gnytu" is not valid
        verifyException("org.apache.commons.lang3.LocaleUtils", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLocaleLookupListTaking2ArgumentsAndToLocale() throws Throwable  {
        // Given a Locale object with language "th"
        Locale arg1 = new Locale("th");
        
        // When the localeLookupList method is called with this Locale object as argument
        List<Locale> localeLookupList = LocaleUtils.localeLookupList(arg1, arg1);
        
        // Then assert that the size of the list returned is 1
        assertEquals(1, localeLookupList.size());
        
        // And assert that the language of the first element in the list is "th"
        assertEquals("th", localeLookupList.get(0).getLanguage());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocale1() throws Throwable  {
        // No Comments were added
        Locale locale = LocaleUtils.toLocale("eot");
        assertEquals("eot", locale.toString());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException9() throws Throwable  {
        try {
        LocaleUtils.toLocale(".__/K03e6Oe`T!Ap_5");
        fail("Expecting exception: IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        // Invalid locale format: .__/K03e6Oe`T!Ap_5
        verifyException("org.apache.commons.lang3.LocaleUtils", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException10() throws Throwable  {
        // Test that an exception is thrown for an invalid locale format
        try {
        LocaleUtils.toLocale("pt_BR_");
        fail("Expecting exception: IllegalArgumentException");
        } catch(IllegalArgumentException e) {
        // Invalid locale format: pt_BR_
        verifyException("org.apache.commons.lang3.LocaleUtils", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocale2() throws Throwable  {
        // Convert a language tag to a Locale object
        Locale locale = LocaleUtils.toLocale("en_US");
        
        // Verify that the converted Locale is as expected
        assertEquals("en_US", locale.toString());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocale3() throws Throwable  {
        // No Comments were added
        Locale locale = LocaleUtils.toLocale("_IR_+g}KJ");
        assertEquals("+g}KJ", locale.getVariant());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException11() throws Throwable  {
        // Test for IllegalArgumentException when using an invalid locale format
        try {
        // Attempt to convert the string "_FKF" to a Locale object
        LocaleUtils.toLocale("_FKF");
        
        // If we reach this point, it means that no exception was thrown and the conversion succeeded
        fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
        // The expected exception is caught here
        verifyException("org.apache.commons.lang3.LocaleUtils", e);
        
        // Verify that the error message contains the correct information about the invalid locale format
        assertTrue(e.getMessage().contains("Invalid locale format: _FKF"));}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocale4() throws Throwable  {
        // No Comments were added
        Locale locale = LocaleUtils.toLocale("_FF");
        assertEquals("_FF", locale.toString());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException12() throws Throwable  {
        // Undeclared exception!
        try {
        // Attempt to convert a string to a locale using the LocaleUtils.toLocale() method
        LocaleUtils.toLocale("_FfesHF");
        
        // Fail if an IllegalArgumentException is not thrown
        fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
        // Catch the expected exception
        
        // Verify that the exception is correct and has the right message
        verifyException("org.apache.commons.lang3.LocaleUtils", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException13() throws Throwable  {
        // No Comments were added
        // Undeclared exception!
        try { 
          LocaleUtils.toLocale("_)`[Mb%01}+");
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // Invalid locale format: _)`[Mb%01}+
           //
           verifyException("org.apache.commons.lang3.LocaleUtils", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException14() throws Throwable  {
        // Test that an exception is thrown when the input string has an invalid locale format
        try {
        LocaleUtils.toLocale("_3"); // This call should throw an IllegalArgumentException
        fail("Expecting exception: IllegalArgumentException"); // We expect an exception to be thrown
        } catch(IllegalArgumentException e) {
        // This is the expected exception that we are catching and verifying
        verifyException("org.apache.commons.lang3.LocaleUtils", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException15() throws Throwable  {
        // Test that an exception is thrown when the input string does not represent a valid locale format
        try {
        LocaleUtils.toLocale("_IKvKF");
        fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
        //
        // Invalid locale format: _IKvKF
        //
        verifyException("org.apache.commons.lang3.LocaleUtils", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException16() throws Throwable  {
        // Test that the toLocale method throws an IllegalArgumentException when passed an invalid locale string
        try {
        LocaleUtils.toLocale("\n");
        fail("Expecting exception: IllegalArgumentException");
        } catch(IllegalArgumentException e) {
        // Verify that the exception is thrown with the correct message
        verifyException("org.apache.commons.lang3.LocaleUtils", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException17() throws Throwable  {
        // No Comments were added
        // Undeclared exception!
        try { 
          LocaleUtils.toLocale("+#)");
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // Invalid locale format: +#)
           //
           verifyException("org.apache.commons.lang3.LocaleUtils", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testIsAvailableLocaleReturningTrue() throws Throwable  {
        // Given a locale object
        Locale arg0 = new Locale("en", "US");
        
        // When the isAvailableLocale method is called with the locale object
        boolean availableLocale = LocaleUtils.isAvailableLocale(arg0);
        
        // Then the method should return true if the locale is supported by the JVM
        assertTrue(availableLocale);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleReturningNull() throws Throwable  {
        // Arrange
        // Nothing to arrange, the input is a null string.
        
        // Act
        Locale locale = LocaleUtils.toLocale((String) null);
        
        // Assert
        assertNull(locale);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToLocaleThrowsIllegalArgumentException18() throws Throwable  {
        // Test that an exception is thrown for an invalid locale format
        try {
        // Attempt to convert a string to a Locale object using an invalid locale format (en-US)
        LocaleUtils.toLocale("en-US");
        
        // Fail the test if no exception is thrown
        fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
        // Verify that the correct exception was thrown with the appropriate error message
        verifyException("org.apache.commons.lang3.LocaleUtils", e);
        
        // Assert that the exception has the expected message
        assertEquals("Invalid locale format: en-US", e.getMessage());}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesSyncAvoid() throws Throwable  {
        // No Comments were added
        LocaleUtils.SyncAvoid localeUtils_SyncAvoid = new LocaleUtils.SyncAvoid();
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testIsAvailableLocaleReturningFalse() throws Throwable  {
        // No Comments were added
        boolean availableLocale = LocaleUtils.isAvailableLocale((Locale) null);
        assertFalse(availableLocale);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAvailableLocaleSet() throws Throwable  {
        // Given a set of available locales
        Set<Locale> availableLocaleSet = LocaleUtils.availableLocaleSet();
        
        // When the size of the set is retrieved
        int size = availableLocaleSet.size();
        
        // Then the size should be 160 (the number of available locales)
        assertEquals(160, size);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testLocaleLookupListTakingLocale() throws Throwable  {
        Locale arg0 = Locale.TAIWAN;
        // Given a Locale object representing Taiwan
        
        List<Locale> localeLookupList = LocaleUtils.localeLookupList(arg0);
        // When the method localeLookupList is called with the given Locale object
        
        assertEquals(2, localeLookupList.size());
        // Then the returned list should have 2 elements
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesLocaleUtils() throws Throwable  {
        // rollbacked to evosuite
        LocaleUtils localeUtils = new LocaleUtils();
    }
  }
  