content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Thu Mar 21 11:37:01 GMT 2024
   */
  
  package src;
  
  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.ArrayList;
  import java.util.Iterator;
  import java.util.LinkedList;
  import java.util.ListIterator;
  import java.util.NoSuchElementException;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.junit.runner.RunWith;
  import src.Fiefdoms;
  import src.Purchase;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class Purchase_ESTest extends Purchase_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testVassalThrowsNoSuchElementException() throws Throwable  {
        Purchase purchase = new Purchase();
        LinkedList<Fiefdoms> linkedList = new LinkedList<>();
        ListIterator<Fiefdoms> arg0 = linkedList.listIterator(0);
        
        // When the vassal method is called with an empty iterator, it should throw a NoSuchElementException
        try {
        purchase.vassal(arg0);
        fail("Expecting exception: NoSuchElementException");
        
        } catch(NoSuchElementException e) {
        // Verify that the correct exception was thrown
        verifyException("java.util.LinkedList$ListItr", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testMercenaryThrowsNoSuchElementException() throws Throwable  {
        Purchase purchase = new Purchase();
        LinkedList<Fiefdoms> linkedList = new LinkedList<Fiefdoms>();
        Iterator<Fiefdoms> arg0 = linkedList.descendingIterator();
        // Test that mercenary() throws a NoSuchElementException when the iterator is empty
        try {
        purchase.mercenary(arg0);
        fail("Expecting exception: NoSuchElementException");
        } catch (NoSuchElementException e) {
        // Verify that the exception was thrown by mercenary() and not by the iterator
        verifyException("java.util.LinkedList$ListItr", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCastlePersonalThrowsNoSuchElementException() throws Throwable  {
        Purchase purchase = new Purchase();
        LinkedList<Fiefdoms> linkedList = new LinkedList<Fiefdoms>();
        ListIterator<Fiefdoms> iterator = linkedList.listIterator(0);
        // Given a list of fiefdoms
        // When trying to buy a personal castle from the list
        try {
        purchase.castlePersonal(iterator);
        fail("Expecting exception: NoSuchElementException");
        } catch(NoSuchElementException e) {
        // Then an exception should be thrown because there are no more fiefdoms in the list
        verifyException("java.util.LinkedList$ListItr", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCastleFiefdomThrowsNoSuchElementException() throws Throwable  {
        // Given: A purchase object and an empty ArrayList of objects.
        Purchase purchase = new Purchase();
        ArrayList<Object> arrayList = new ArrayList<>();
        
        // When: The castleFiefdom method is called with the iterator of the empty ArrayList.
        Iterator<Object> arg0 = arrayList.iterator();
        try {
        // Then: A NoSuchElementException should be thrown, as there are no elements in the list to iterate over.
        purchase.castleFiefdom(arg0);
        fail("Expecting exception: NoSuchElementException");
        } catch (NoSuchElementException e) {
        // Verify that the exception is of the expected type and has no message.
        verifyException("java.util.ArrayList$Itr", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testPerform() throws Throwable  {
        // rollbacked to evosuite
        Purchase purchase = new Purchase();
        ArrayList<Fiefdoms> arg0 = new ArrayList<Fiefdoms>();
        purchase.perform(arg0);
        assertTrue(arg0.isEmpty());
    }
  }
  