content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Mon Mar 18 10:21:32 GMT 2024
   */
  
  package com.puppycrawl.tools.checkstyle.utils;
  
  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 com.puppycrawl.tools.checkstyle.api.DetailAST;
  import com.puppycrawl.tools.checkstyle.utils.AnnotationUtility;
  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 AnnotationUtility_ESTest extends AnnotationUtility_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetAnnotationThrowsNullPointerException() throws Throwable  {
        // Given a DetailAST instance representing an annotation,
        // when the getAnnotation method is called with an invalid argument,
        // then it should throw a NullPointerException.
        
        DetailAST arg0 = new DetailAST();
        try {
        AnnotationUtility.getAnnotation(arg0, "!'jF=");
        fail("Expecting exception: NullPointerException");
        } catch (NullPointerException e) {
        // no message in exception (getMessage() returned null)
        verifyException("com.puppycrawl.tools.checkstyle.utils.AnnotationUtility", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetAnnotationWithNullAndDetailASTWhereGetTypeIsZero() throws Throwable  {
        // Given: The DetailAST object arg0 has not been declared and is null
        DetailAST arg0 = new DetailAST();
        
        // When: Trying to get the annotation of a null argument
        try {
        AnnotationUtility.getAnnotation(arg0, (String) null);
        fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
        //
        // the annotation is null
        //
        verifyException("com.puppycrawl.tools.checkstyle.utils.AnnotationUtility", e);
        }
        
        // Then: The method throws an IllegalArgumentException because of the null argument
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetAnnotationHolderWithDetailASTWhereGetTypeIsZero() throws Throwable  {
        // Given: a DetailAST object is created with null value
        DetailAST arg0 = new DetailAST();
        
        // When: the method getAnnotationHolder is called on the DetailAST object
        DetailAST annotationHolder = AnnotationUtility.getAnnotationHolder(arg0);
        
        // Then: the returned value should be null
        assertNull(annotationHolder);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetAnnotationThrowsIllegalArgumentException() throws Throwable  {
        DetailAST detailAST = new DetailAST();
        try {
        AnnotationUtility.getAnnotation(detailAST, "");
        fail("Expecting exception: IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        // the annotation is empty or spaces
        verifyException("com.puppycrawl.tools.checkstyle.utils.AnnotationUtility", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testContainsAnnotationTaking2ArgumentsWithNull() throws Throwable  {
        DetailAST ast = new DetailAST();
        // Given: the AST is not null
        assertNotNull(ast);
        
        try {
        AnnotationUtility.containsAnnotation(ast, (String) null);
        fail("Expecting exception: IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        // When: the annotation is null
        verifyException("com.puppycrawl.tools.checkstyle.utils.AnnotationUtility", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetAnnotationWithNullAndEmptyString() throws Throwable  {
        // No Comments were added
        // Undeclared exception!
        try { 
          AnnotationUtility.getAnnotation((DetailAST) null, "");
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // the ast is null
           //
           verifyException("com.puppycrawl.tools.checkstyle.utils.AnnotationUtility", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetAnnotationHolderReturningNull() throws Throwable  {
        // Given a valid DetailAST object as argument
        DetailAST arg0 = new DetailAST();
        arg0.setType(16);
        
        // When the method getAnnotationHolder is invoked with the argument
        DetailAST annotationHolder = AnnotationUtility.getAnnotationHolder(arg0);
        
        // Then the method should return a non-null value, which represents the holder of annotations for the given AST node
        assertNotNull(annotationHolder);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetAnnotationHolderWithDetailASTWhereGetColumnIsZero() throws Throwable  {
        // Given: A DetailAST object with no annotations
        DetailAST arg0 = new DetailAST();
        arg0.initialize(155, "A descriptive variable name");
        
        // When: The getAnnotationHolder method is called on the DetailAST object
        DetailAST annotationHolder = AnnotationUtility.getAnnotationHolder(arg0);
        
        // Then: The returned value should be null
        assertNull(annotationHolder);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetAnnotationHolderThrowsIllegalArgumentException() throws Throwable  {
        // No Comments were added
        // Undeclared exception!
        try { 
          AnnotationUtility.getAnnotationHolder((DetailAST) null);
          fail("Expecting exception: IllegalArgumentException");
        
        } catch(IllegalArgumentException e) {
           //
           // the ast is null
           //
           verifyException("com.puppycrawl.tools.checkstyle.utils.AnnotationUtility", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testContainsAnnotationTakingDetailASTThrowsIllegalArgumentException() throws Throwable  {
        // Given: We have a JUnit test that uses a try-catch block to handle an exception
        // When: The test is executed and an exception is thrown
        // Then: The test will fail if the expected exception is not thrown
        try {
        // Undeclared exception!
        AnnotationUtility.containsAnnotation((DetailAST) null);
        fail("Expecting exception: IllegalArgumentException");
        } catch(IllegalArgumentException e) {
        //
        // the ast is null
        //
        verifyException("com.puppycrawl.tools.checkstyle.utils.AnnotationUtility", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testContainsAnnotationTakingDetailAST() throws Throwable  {
        // Given a DetailAST object with no annotations
        DetailAST detailAST = new DetailAST();
        
        // When checking if the DetailAST contains an annotation
        boolean containsAnnotation = AnnotationUtility.containsAnnotation(detailAST);
        
        // Then, assert that the containsAnnotation variable is false
        assertFalse(containsAnnotation);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testContainsAnnotationTaking2ArgumentsWithNullAndNonEmptyString() throws Throwable  {
        try {
        AnnotationUtility.containsAnnotation((DetailAST) null, "/$]2LIJ?!");
        fail("Expecting exception: IllegalArgumentException");
        } catch(IllegalArgumentException e) {
        // The ast is null
        verifyException("com.puppycrawl.tools.checkstyle.utils.AnnotationUtility", e);}
    }
  }
  