content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Mon Mar 18 05:24:07 GMT 2024
   */
  
  package fi.vtt.noen.testgen.observations.formatter;
  
  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 fi.vtt.noen.testgen.observations.data.ProgramRun;
  import fi.vtt.noen.testgen.observations.formatter.DaikonFormatter;
  import java.util.Collection;
  import java.util.LinkedList;
  import java.util.Locale;
  import java.util.Set;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.evosuite.runtime.testdata.EvoSuiteFile;
  import org.evosuite.runtime.testdata.FileSystemHandling;
  import org.junit.runner.RunWith;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class DaikonFormatter_ESTest extends DaikonFormatter_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testOutputs() throws Throwable  {
        // Given: A file named "testgen.properties" and an empty byte array.
        EvoSuiteFile arg0 = new EvoSuiteFile("testgen.properties");
        byte[] arg1 = new byte[0];
        
        // When: The appendDataToFile method is called with these arguments.
        FileSystemHandling.appendDataToFile(arg0, arg1);
        
        // Then: The outputs of the DaikonFormatter should not be null.
        Collection<Class> outputs = (Collection<Class>)DaikonFormatter.outputs();
        assertNotNull(outputs);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testInputs() throws Throwable  {
        // Given: We have a test input file named "testgen.properties" and we want to append a new line to it containing the value "ppt-type exit".
        EvoSuiteFile arg0 = new EvoSuiteFile("testgen.properties");
        FileSystemHandling.appendLineToFile(arg0, "ppt-type exit");
        
        // When: We call the DaikonFormatter.inputs() method to retrieve a collection of input classes.
        Collection<Class> inputs = (Collection<Class>)DaikonFormatter.inputs();
        
        // Then: The returned collection should not be null and should contain at least one element.
        assertNotNull(inputs);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFileNameExtension() throws Throwable  {
        // Given a locale object representing Japanese language
        Locale japaneseLocale = Locale.JAPANESE;
        
        // When we get the set of Unicode locale keys for the Japanese locale
        Set<String> unicodeLocaleKeys = japaneseLocale.getUnicodeLocaleKeys();
        
        // And we create a new DaikonFormatter object with an empty string and the set of Unicode locale keys
        DaikonFormatter daikonFormatter = new DaikonFormatter("", unicodeLocaleKeys);
        
        // Then we expect that the fileNameExtension method returns "dtrace"
        assertEquals("dtrace", daikonFormatter.fileNameExtension());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesDaikonFormatterTaking2Arguments0() throws Throwable  {
        // Given: A LinkedList of strings and a ProgramRun object
        LinkedList<String> arg1 = new LinkedList<>();
        ProgramRun arg0 = new ProgramRun("Init");
        
        // When: Creating a DaikonFormatter with a custom format string and the linked list
        DaikonFormatter daikonFormatter = new DaikonFormatter(",hP3GiL-W@i{=", arg1);
        
        // Then: The fileNameExtension method should return "dtrace"
        assertEquals("dtrace", daikonFormatter.fileNameExtension());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testObservations() throws Throwable  {
        // Given: A DaikonFormatter instance with a file name extension "C" and a flag indicating that it should generate output files in the current directory
        DaikonFormatter daikonFormatter = new DaikonFormatter("C", true);
        
        // When: The observations method is called on the DaikonFormatter instance, passing in a ProgramRun object as an argument
        daikonFormatter.observations(new ProgramRun("C"));
        
        // Then: The fileNameExtension method should return "dtrace"
        assertEquals("dtrace", daikonFormatter.fileNameExtension());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesDaikonFormatterTaking2Arguments1() throws Throwable  {
        // Given: A EvoSuiteFile object called "testgen.properties" is created
        EvoSuiteFile arg0 = new EvoSuiteFile("testgen.properties");
        
        // When: The file is appended with a line containing the string "ppt-type exit"
        FileSystemHandling.appendLineToFile(arg0, "ppt-type exit");
        
        // Then: A DaikonFormatter object is created using the file name and the boolean flag for the var-kind array option is set to false
        DaikonFormatter daikonFormatter = new DaikonFormatter("    var-kind array", false);
        
        // And: The fileNameExtension method of the DaikonFormatter object is called to get the file name extension
        String actualResult = daikonFormatter.fileNameExtension();
        
        // Then: The expected result is "dtrace"
        String expectedResult = "dtrace";
        
        // Assert: That the actual and expected results are equal
        assertEquals(expectedResult, actualResult);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testHeader() throws Throwable  {
        // Create a new DaikonFormatter instance with null as the file name and true as the parameter for generating header.
        DaikonFormatter daikonFormatter = new DaikonFormatter((String) null, true);
        
        // Assert that the fileNameExtension method returns "dtrace"
        assertEquals("dtrace", daikonFormatter.fileNameExtension());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFooter() throws Throwable  {
        // Create a new LinkedList of Strings
        LinkedList<String> arg1 = new LinkedList<>();
        
        // Create a new instance of DaikonFormatter with null as the file name and the LinkedList of Strings as the argument for the method
        DaikonFormatter daikonFormatter = new DaikonFormatter((String) null, arg1);
        
        // Call the footer() method on the DaikonFormatter object
        daikonFormatter.footer();
        
        // Assert that the file name extension returned by the fileNameExtension() method is "dtrace"
        assertEquals("dtrace", daikonFormatter.fileNameExtension());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testObservationsThrowsRuntimeException() throws Throwable  {
        // No Comments were added
        LinkedList<String> arg1 = new LinkedList<String>();
        ProgramRun arg0 = new ProgramRun("Init");
        DaikonFormatter daikonFormatter = new DaikonFormatter(",hP3GiL-W@i{=", arg1);
        arg1.addLast("Init");
        // Undeclared exception!
        try { 
          daikonFormatter.observations(arg0);
          fail("Expecting exception: RuntimeException");
        
        } catch(RuntimeException e) {
           //
           // Error while writing to file named ',hP3GiL-W@i{='):Error in writing to file
           //
           verifyException("fi.vtt.noen.testgen.observations.formatter.BasicFormatter$OutputBuffer", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testFailsToCreateDaikonFormatterTaking2ArgumentsThrowsRuntimeException() throws Throwable  {
        // Given: A Daikon formatter with an invalid input and output interface definitions
        DaikonFormatter daikonFormatter = null;
        
        try {
        // When: Trying to create a new Daikon formatter instance with an invalid input and output interface definitions
        daikonFormatter = new DaikonFormatter("var-kind array", false);
        
        // Then: An exception should be thrown
        fail("Expecting exception: RuntimeException");
        } catch(RuntimeException e) {
        // Verify that the exception is as expected
        verifyException("fi.vtt.noen.testgen.observations.formatter.DaikonFormatter", e);}
    }
  }
  