content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Mon Mar 18 01:59:08 GMT 2024
   */
  
  package com.yahoo.platform.yui.compressor;
  
  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.yahoo.platform.yui.compressor.JavaScriptCompressor;
  import java.io.StringReader;
  import java.io.Writer;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.junit.runner.RunWith;
  import org.mozilla.javascript.Context;
  import org.mozilla.javascript.ContextFactory;
  import org.mozilla.javascript.ErrorReporter;
  import org.mozilla.javascript.tools.ToolErrorReporter;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class JavaScriptCompressor_ESTest extends JavaScriptCompressor_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCompressThrowsNullPointerException0() throws Throwable  {
        // Given: The JavaScriptCompressor class is used to compress JavaScript code.
        //        The compress method takes a Writer as an argument, which represents the output stream.
        //        The StringReader class is used to read in a string of JavaScript code.
        
        ToolErrorReporter arg1 = new ToolErrorReporter(false);
        StringReader arg0 = new StringReader(" Yl79vN;N$K,Ni");
        JavaScriptCompressor javaScriptCompressor = new JavaScriptCompressor(arg0, arg1);
        
        // When: The compress method is called with a null Writer argument.
        
        try {
        javaScriptCompressor.compress((Writer) null, 8, false, false, false, false);
        fail("Expecting exception: NullPointerException");
        
        } catch(NullPointerException e) {
        //
        // no message in exception (getMessage() returned null)
        //
        verifyException("com.yahoo.platform.yui.compressor.JavaScriptCompressor", e);
        }
        
        // Then: A NullPointerException is thrown, as the compress method requires a non-null Writer argument.
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCompressWithTrue() throws Throwable  {
        // Given
        StringReader input = new StringReader("eval");
        ContextFactory global = ContextFactory.getGlobal();
        Context context = global.enterContext();
        ErrorReporter errorReporter = context.getErrorReporter();
        JavaScriptCompressor compressor = new JavaScriptCompressor(input, errorReporter);
        
        // When
        try {
        compressor.compress((Writer) null, 10, false, true, false, false);
        fail("Expecting exception: NullPointerException");
        } catch (NullPointerException e) {
        // Then
        verifyException("com.yahoo.platform.yui.compressor.JavaScriptCompressor", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCompressThrowsNullPointerException1() throws Throwable  {
        StringReader arg0 = new StringReader("ev+I");
        ToolErrorReporter arg1 = new ToolErrorReporter(false);
        JavaScriptCompressor javaScriptCompressor = new JavaScriptCompressor(arg0, arg1);
        
        // Check if the compress method throws a NullPointerException when called with a null writer
        try {
        javaScriptCompressor.compress((Writer) null, 100, false, false, false, false);
        fail("Expecting exception: NullPointerException");
        } catch(NullPointerException e) {
        // Verify that the exception message is empty (getMessage() returned null)
        verifyException("com.yahoo.platform.yui.compressor.JavaScriptCompressor", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCompressWithTrueAndTrue() throws Throwable  {
        // rollbacked to evosuite
        ToolErrorReporter arg1 = new ToolErrorReporter(false);
        StringReader arg0 = new StringReader("top");
        JavaScriptCompressor javaScriptCompressor = new JavaScriptCompressor(arg0, arg1);
        // Undeclared exception!
        try { 
          javaScriptCompressor.compress((Writer) null, 2, true, true, true, true);
          fail("Expecting exception: NullPointerException");
        
        } catch(NullPointerException e) {
           //
           // no message in exception (getMessage() returned null)
           //
           verifyException("com.yahoo.platform.yui.compressor.JavaScriptCompressor", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreatesJavaScriptCompressor() throws Throwable  {
        // rollbacked to evosuite
        ToolErrorReporter arg1 = new ToolErrorReporter(false);
        StringReader arg0 = new StringReader("\"debugger\";");
        JavaScriptCompressor javaScriptCompressor = new JavaScriptCompressor(arg0, arg1);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCompressThrowsNullPointerException2() throws Throwable  {
        // Given: A StringReader containing JavaScript code to compress
        StringReader input = new StringReader("0^Q3J");
        
        // And: A ToolErrorReporter instance for handling errors during compression
        ToolErrorReporter errorReporter = new ToolErrorReporter(false);
        
        // When: Creating a JavaScriptCompressor instance with the input and error reporter
        JavaScriptCompressor compressor = new JavaScriptCompressor(input, errorReporter);
        
        // And: Trying to compress the code with a null writer
        try {
        compressor.compress((Writer) null, 120, false, false, false, false);
        fail("Expecting exception: NullPointerException");
        } catch(NullPointerException e) {
        // Then: Verifying that the correct exception is thrown
        verifyException("com.yahoo.platform.yui.compressor.JavaScriptCompressor", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCompressWithNegative() throws Throwable  {
        StringReader input = new StringReader("!c9g;O");
        ToolErrorReporter errorReporter = new ToolErrorReporter(false);
        JavaScriptCompressor compressor = new JavaScriptCompressor(input, errorReporter);
        // Undeclared exception!
        try {
        compressor.compress((Writer) null, (-1293), true, false, false, false);
        fail("Expecting exception: NullPointerException");
        } catch (NullPointerException e) {
        // Verify that the correct exception was thrown
        verifyException("com.yahoo.platform.yui.compressor.JavaScriptCompressor", e);}
    }
  }
  