content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Thu Mar 21 10:27:17 GMT 2024
   */
  
  package com.jstevh.viewer;
  
  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.shaded.org.mockito.Mockito.*;
  import static org.evosuite.runtime.EvoAssertions.*;
  import com.jstevh.viewer.ClassInfo;
  import com.jstevh.viewer.DirManager;
  import com.jstevh.viewer.MethodData;
  import java.lang.reflect.Array;
  import java.lang.reflect.Member;
  import javax.swing.JFrame;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.evosuite.runtime.ViolatedAssumptionAnswer;
  import org.junit.runner.RunWith;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class ClassInfo_ESTest extends ClassInfo_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetDataTakingClassArray() throws Throwable  {
        // Given an empty array of JFrame classes
        Class<JFrame>[] arg0 = (Class<JFrame>[]) Array.newInstance(Class.class, 0);
        
        // When the getData method is called with this empty array argument
        String[] data = ClassInfo.getData(arg0);
        
        // Then the returned value should be null
        assertNull(data);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetDataTakingMemberArrayReturningNonEmptyArray() throws Throwable  {
        // Set up the test data
        Member[] arg0 = new Member[1];
        Member member = mock(Member.class, new ViolatedAssumptionAnswer());
        arg0[0] = member;
        
        // Invoke the method and get the result
        String[] data = ClassInfo.getData(arg0);
        
        // Assert that the method returned the expected value
        assertEquals(1, data.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetDataTakingMemberArrayReturningNull() throws Throwable  {
        // Given: We have a member array with zero elements
        Member[] members = new Member[0];
        
        // When: We get the class info using the getData method
        String[] data = ClassInfo.getData(members);
        
        // Then: The returned data should be null
        assertNull(data);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testPrintInterfacesAndCreatesClassInfoTakingStringAndMain() throws Throwable  {
        // rollbacked to evosuite
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        String[] arg0 = new String[0];
        ClassInfo.main(arg0);
        String[] printInterfaces = classInfo.printInterfaces();
        assertNull(printInterfaces);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesClassInfoTakingStringAndCallsPrintInterfaces0() throws Throwable  {
        // Test that the method "printInterfaces" returns null when the class has no interfaces implemented
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        String[] printInterfaces = classInfo.printInterfaces();
        assertNull(printInterfaces);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testPrintConstructorsReturningNull() throws Throwable  {
        // rollbacked to evosuite
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo$1");
        String[] arg0 = new String[7];
        arg0[0] = "com.jstevh.viewer.ClassInfo$1";
        ClassInfo.main(arg0);
        String[] printConstructors = classInfo.printConstructors();
        assertNull(printConstructors);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testPrintConstructors() throws Throwable  {
        // No Comments were added
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        String[] arg0 = new String[0];
        ClassInfo.main(arg0);
        classInfo.printConstructors();
        assertTrue(ClassInfo.debug);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testPrintMethodsTakingNoArgumentsReturningNonEmptyArray() throws Throwable  {
        // Then: The returned array of strings should not be null and contain 25 elements
        
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        String[] printMethods = classInfo.printMethods();
        assertNotNull(printMethods);
        assertEquals(25, printMethods.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testPrintFieldsReturningNonEmptyArray() throws Throwable  {
        // rollbacked to evosuite
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        String[] arg0 = new String[0];
        ClassInfo.main(arg0);
        String[] printFields = classInfo.printFields();
        assertEquals(3, printFields.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetClassName() throws Throwable  {
        // Given a class info object for a SAXDirParser class
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.SAXDirParser");
        
        // When we retrieve the name of the class
        String className = classInfo.getClassName();
        
        // Then we expect to get the same name as what was passed in
        assertEquals("com.jstevh.viewer.SAXDirParser", className);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testMainThrowsArrayIndexOutOfBoundsException() throws Throwable  {
        // No Comments were added
        String[] arg0 = new String[1];
        arg0[0] = "new";
        try { 
          ClassInfo.main(arg0);
          fail("Expecting exception: ArrayIndexOutOfBoundsException");
        
        } catch(ArrayIndexOutOfBoundsException e) {
           //
           // 1
           //
           verifyException("com.jstevh.viewer.ClassInfo", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testMain() throws Throwable  {
        // Set up the arguments for the main method
        String[] args = new String[2];
        args[0] = "java.lang.Object";
        
        // Invoke the main method with the arguments
        ClassInfo.main(args);
        
        // Assert that the length of the array is 2
        assertEquals(2, args.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFailsToCreateClassInfoTakingStringThrowsNullPointerException() throws Throwable  {
        // No Comments were added
        ClassInfo classInfo = null;
        try {
          classInfo = new ClassInfo((String) null);
          fail("Expecting exception: NullPointerException");
        
        } catch(NullPointerException e) {
           //
           // no message in exception (getMessage() returned null)
           //
           verifyException("com.jstevh.viewer.ClassInfo", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSrchMethodsTaking2ArgumentsReturningNonEmptyArray() throws Throwable  {
        // rollbacked to evosuite
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.SAXDirParser");
        String[] arg1 = classInfo.printFields();
        classInfo.srchMethods("com.jstevh.viewer.SAXDirParser", arg1);
        MethodData foundMethod = classInfo.getFoundMethod(2);
        assertNull(foundMethod);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetFoundMethod() throws Throwable  {
        // Given the following scenario:
        // - A Java class "ClassInfo" is created with a constructor that takes in a string parameter.
        // - The method "getFoundMethod()" is called on an instance of "ClassInfo" with the argument "1".
        // When the method "getFoundMethod()" is called with the argument "1"
        // Then the returned value should be null.
        
        ClassInfo classInfo = new ClassInfo("[J");
        MethodData foundMethod = classInfo.getFoundMethod(1);
        assertNull(foundMethod);
        
        // Explanation:
        // The method "getFoundMethod()" is called on an instance of "ClassInfo" with the argument "1".
        // Since there is no method with the ID "1" in the input string, the returned value should be null.
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSrchMethodsTaking2ArgumentsWithNull() throws Throwable  {
        // rollbacked to evosuite
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        String[] srchMethods = classInfo.srchMethods((String) null, (String[]) null);
        assertNull(srchMethods);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSrchMethodsTaking2ArgumentsReturningNull() throws Throwable  {
        // Arrange
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        
        // Act
        String[] srchMethods = classInfo.srchMethods("com.jstevh.viewer.ClassInfo", (String[]) null);
        
        // Assert
        assertNull(srchMethods);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSrchMethodsTakingStringReturningNonEmptyArray() throws Throwable  {
        // Test that searching for a method by its fully qualified name returns the expected results
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        String[] srchMethods = classInfo.srchMethods("java.lang.reflect.Method@0000000001");
        assertEquals(1, srchMethods.length); // Assert that the length of the search results is 1
        assertNotNull(srchMethods); // Assert that the search results are not null
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSrchMethodsTakingStringWithNull() throws Throwable  {
        // Given
        String className = "com.jstevh.viewer.ClassInfo";
        
        // When
        ClassInfo classInfo = new ClassInfo(className);
        String[] srchMethods = classInfo.srchMethods((String) null);
        
        // Then
        assertNull(srchMethods);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSrchMethodsTakingString() throws Throwable  {
        // No Comments were added
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        String[] srchMethods = classInfo.srchMethods("com.jstevh.viewer.ClassInfo");
        assertNull(srchMethods);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesClassInfoTakingStringAndPrintInterfacesAndPrintInterfacesReturningNonEmptyArray() throws Throwable  {
        // This test is checking that the method printInterfaces() returns an array of 7 elements,
        // which are the names of interfaces implemented by the class JFrame.
        ClassInfo classInfo = new ClassInfo("javax.swing.JFrame");
        String[] printInterfaces = classInfo.printInterfaces();
        assertNotNull(printInterfaces);
        assertEquals(7, printInterfaces.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesClassInfoTaking2ArgumentsAndCallsPrintInterfaces() throws Throwable  {
        // Given a class with interfaces to be printed
        String[] arg0 = new String[6];
        arg0[0] = "com.jstevh.viewer.ClassInfo";
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.SAXDirParser", new DirManager(false));
        
        // When the method to print interfaces is called
        String[] printInterfaces = classInfo.printInterfaces();
        
        // Then the output should not be null and contain four elements
        assertNotNull(printInterfaces);
        assertEquals(4, printInterfaces.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesClassInfoTakingStringAndCallsPrintInterfaces1() throws Throwable  {
        // Arrange
        ClassInfo classInfo = new ClassInfo("org.xml.sax.ContentHandler");
        
        // Act
        String[] printedInterfaces = classInfo.printInterfaces();
        
        // Assert
        assertNull(printedInterfaces);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesClassInfoTakingStringAndCallsPrintInterfaces2() throws Throwable  {
        // Given
        ClassInfo classInfo = new ClassInfo("java.lang.Object");
        
        // When
        String[] printInterfaces = classInfo.printInterfaces();
        
        // Then
        assertNull(printInterfaces);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesClassInfoTakingStringAndCallsPrintConstructors() throws Throwable  {
        // No Comments were added
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        String[] printConstructors = classInfo.printConstructors();
        assertEquals(2, printConstructors.length);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testPrintMethodsTakingInt() throws Throwable  {
        // Given a class with a main method
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        
        // When the main method is called with an empty argument list
        String[] arg0 = new String[0];
        ClassInfo.main(arg0);
        
        // Then the debug mode should be enabled
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testPrintMethodsTakingIntWithPositive() throws Throwable  {
        // Given: A class with no print methods
        ClassInfo classInfo = new ClassInfo("java.io.Serializable");
        
        // When: The method is called with a limit of 24 print methods
        String[] printMethods = classInfo.printMethods(24);
        
        // Then: The result should be null
        assertNull(printMethods);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testPrintFields() throws Throwable  {
        // rollbacked to evosuite
        ClassInfo classInfo = new ClassInfo("org.xml.sax.helpers.DefaultHandler");
        String[] arg0 = new String[8];
        arg0[0] = "org.xml.sax.helpers.DefaultHandler";
        ClassInfo.main(arg0);
        classInfo.printFields();
        assertTrue(ClassInfo.debug);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetFoundMethodThrowsStringIndexOutOfBoundsException() throws Throwable  {
        // rollbacked to evosuite
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        String[] arg1 = classInfo.printFields();
        classInfo.srchMethods("com.jstevh.viewer.ClassInfo", arg1);
        // Undeclared exception!
        try { 
          classInfo.getFoundMethod(2);
          fail("Expecting exception: StringIndexOutOfBoundsException");
        
        } catch(StringIndexOutOfBoundsException e) {
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesClassInfoTakingStringAndCallsPrintFields() throws Throwable  {
        // rollbacked to evosuite
        ClassInfo classInfo = new ClassInfo("org.xml.sax.helpers.DefaultHandler");
        String[] printFields = classInfo.printFields();
        assertNull(printFields);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesClassInfoTaking2Arguments0() throws Throwable  {
        // Given: A DirManager instance with flag set to false
        DirManager dirManager = new DirManager(false);
        
        // When: Creating a ClassInfo object for the "java.lang.Object" class
        ClassInfo classInfo = new ClassInfo("java.lang.Object", dirManager);
        
        // Then: The number of inherited methods should be 2
        assertEquals(2, classInfo.NO_INHERITED_METHODS);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesClassInfoTaking2Arguments1() throws Throwable  {
        // rollbacked to evosuite
        DirManager arg1 = new DirManager(false);
        ClassInfo classInfo = new ClassInfo("java.io.Serializable", arg1);
        assertEquals(2, ClassInfo.NO_INHERITED_METHODS);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFailsToCreateClassInfoTaking2ArgumentsThrowsClassNotFoundException() throws Throwable  {
        // No Comments were added
        DirManager arg1 = new DirManager(false);
        ClassInfo classInfo = null;
        try {
          classInfo = new ClassInfo("<?xml version='1.0' encoding='ISO-8859-1' standalone='yes'?><Base><Documentation><Group><Description>Java SDK 6.0</Description><Owner>Sun Microsystems</Owner><Location><Web>http://java.sun.com/javase/6/docs/api/</Web><Local></Local></Location><Names><pkg>java.lang.</pkg><pkg>java.io.</pkg><pkg>java.lang.reflect.</pkg><pkg>java.util.</pkg><pkg>java.awt.event.</pkg><pkg>java.awt.datatransfer.</pkg><pkg>java.awt.</pkg><pkg>java.net.</pkg><pkg>java.applet.</pkg><pkg></pkg><pkg></pkg><pkg></pkg><pkg></pkg></Names></Group><Group><Description>Java Enterprise</Description><Owner>Sun Microsystems</Owner><Location><Web>http://java.sun.com/j2se/1.4.2/docs/api/</Web></Location><Names><pkg>javax.swing.border.</pkg><pkg></pkg><pkg></pkg><pkg></pkg><pkg></pkg></Names></Group></Documentation></Base>", arg1);
          fail("Expecting exception: ClassNotFoundException");
        
        } catch(Throwable e) {
           //
           // no message in exception (getMessage() returned null)
           //
           verifyException("com.jstevh.viewer.ClassInfo", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testPrintMethodsTakingNoArgumentsReturningNull() throws Throwable  {
        // Test that the printMethods method returns null for a class that does not implement Serializable interface
        ClassInfo classInfo = new ClassInfo("java.io.Serializable");
        String[] printMethods = classInfo.printMethods();
        assertNull(printMethods);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesClassInfoTaking2ArgumentsAndCallsGetSuperClassName() throws Throwable  {
        DirManager arg1 = new DirManager(false);
        ClassInfo classInfo = new ClassInfo("org.xml.sax.ContentHandler", arg1);
        
        // When we call getSuperClassName on the ClassInfo object
        String superClassName = classInfo.getSuperClassName();
        
        // Then the method should return null, since ContentHandler does not have a superclass
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSuperClassNameReturningNonEmptyString() throws Throwable  {
        // Arrange
        ClassInfo classInfo = new ClassInfo("[J");
        
        // Act
        String superClassName = classInfo.getSuperClassName();
        
        // Assert
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesClassInfoTakingStringAndCallsGetSuperClassName() throws Throwable  {
        // Given: A Java class "java.lang.Object" is being tested.
        ClassInfo classInfo = new ClassInfo("java.lang.Object");
        
        // When: The superclass of the class is obtained using getSuperClassName().
        String superClassName = classInfo.getSuperClassName();
        
        // Then: The obtained superclassName should be null, since Object does not have a superclass.
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetClassPackageReturningNonEmptyString() throws Throwable  {
        // Arrange
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        
        // Act
        String classPackage = classInfo.getClassPackage();
        
        // Assert
        assertEquals("com.jstevh.viewer", classPackage);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetClassPackageReturningNull() throws Throwable  {
        // Arrange
        ClassInfo classInfo = new ClassInfo("[J");
        
        // Act
        String classPackage = classInfo.getClassPackage();
        
        // Assert
        assertNull(classPackage);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesClassInfoTakingStringAndCallsPrintMethodsTakingInt() throws Throwable  {
        // No Comments were added
        ClassInfo classInfo = new ClassInfo("com.jstevh.viewer.ClassInfo");
        String[] printMethods = classInfo.printMethods(0);
        assertNull(printMethods);
    }
  }
  