content: /*
   * This file was automatically generated by EvoSuite
   */
  
  package com.lts.swing.filefield;
  
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.evosuite.junit.EvoSuiteRunner;
  import static org.junit.Assert.*;
  import com.lts.swing.filefield.FileField;
  import java.io.File;
  import java.util.concurrent.ExecutorService;
  import java.util.concurrent.Executors;
  import java.util.concurrent.Future;
  import java.util.concurrent.TimeUnit;
  import javax.swing.JButton;
  import javax.swing.JFileChooser;
  import org.evosuite.Properties.SandboxMode;
  import org.evosuite.sandbox.Sandbox;
  import org.junit.After;
  import org.junit.AfterClass;
  import org.junit.Before;
  import org.junit.BeforeClass;
  
  @RunWith(EvoSuiteRunner.class)
  public class FileFieldEvoSuiteTest {
  
    private static ExecutorService executor; 
  
    @BeforeClass 
    public static void initEvoSuiteFramework(){ 
      org.evosuite.Properties.REPLACE_CALLS = true; 
      org.evosuite.Properties.SANDBOX_MODE = SandboxMode.RECOMMENDED; 
      Sandbox.initializeSecurityManagerForSUT(); 
      executor = Executors.newCachedThreadPool(); 
    } 
  
    @AfterClass 
    public static void clearEvoSuiteFramework(){ 
      executor.shutdownNow(); 
      Sandbox.resetDefaultSecurityManager(); 
    } 
  
    @Before 
    public void initTestCase(){ 
      Sandbox.goingToExecuteSUTCode(); 
    } 
  
    @After 
    public void doneWithTestCase(){ 
      Sandbox.doneWithExecutingSUTCode(); 
    } 
  
  
    @Test
    public void test0()  throws Throwable  {
        FileField fileField0 = new FileField();
        File file0 = new File("jYXkpK[.>qR\"~|CvI", "jYXkpK[.>qR\"~|CvI");
        fileField0.setFile(file0);
        assertEquals(2, fileField0.countComponents());
        assertEquals(2, fileField0.getComponentCount());
    }
  
    @Test
    public void test1()  throws Throwable  {
        FileField fileField0 = new FileField();
        int int0 = fileField0.getBrowseMode();
        assertEquals(2, fileField0.getGridx());
        assertEquals(0, int0);
    }
  
    @Test
    public void test2()  throws Throwable  {
        FileField fileField0 = new FileField();
        fileField0.setFileChooser((JFileChooser) null);
        assertEquals(2, fileField0.getComponentCount());
        assertEquals(2, fileField0.countComponents());
    }
  
    @Test
    public void test3()  throws Throwable  {
        FileField fileField0 = new FileField();
        File file0 = fileField0.getFile();
        assertNotNull(file0);
        assertEquals("", file0.toString());
        assertEquals(2, fileField0.getComponentCount());
    }
  
    @Test
    public void test4()  throws Throwable  {
        FileField fileField0 = new FileField();
        JButton jButton0 = fileField0.getButton();
        assertNotNull(jButton0);
        assertEquals(2, fileField0.countComponents());
        assertEquals("...", jButton0.getText());
    }
  
    @Test
    public void test5()  throws Throwable  {
        FileField fileField0 = new FileField();
        fileField0.setBrowseMode((-29));
        assertEquals(-29, fileField0.getBrowseMode());
    }
  
    @Test
    public void test6()  throws Throwable  {
      Future<?> future = executor.submit(new Runnable(){ 
              public void run() { 
            FileField fileField0 = new FileField();
            // Undeclared exception!
            try {
              fileField0.browseForFile();
              fail("Expecting exception: SecurityException");
            } catch(SecurityException e) {
              /*
               * Security manager blocks (java.io.FilePermission /home/ac1gf write)
               * java.lang.Thread.getStackTrace(Thread.java:1479)
               * org.evosuite.sandbox.MSecurityManager.checkPermission(MSecurityManager.java:303)
               * java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
               * java.io.File.canWrite(File.java:711)
               * sun.awt.shell.ShellFolder.canWrite(ShellFolder.java:284)
               * sun.swing.FilePane.canWrite(FilePane.java:1817)
               * sun.swing.FilePane.doDirectoryChanged(FilePane.java:1470)
               * sun.swing.FilePane.propertyChange(FilePane.java:1516)
               * java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
               * java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
               * java.awt.Component.firePropertyChange(Component.java:8154)
               * javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:568)
               * javax.swing.JFileChooser.<init>(JFileChooser.java:334)
               * javax.swing.JFileChooser.<init>(JFileChooser.java:286)
               * com.lts.swing.filefield.FileField.getFileChooser(FileField.java:73)
               * com.lts.swing.filefield.FileField.browseForFile(FileField.java:101)
               * sun.reflect.GeneratedMethodAccessor496.invoke(Unknown Source)
               * sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               * java.lang.reflect.Method.invoke(Method.java:597)
               * org.evosuite.testcase.MethodStatement$1.execute(MethodStatement.java:262)
               * org.evosuite.testcase.AbstractStatement.exceptionHandler(AbstractStatement.java:142)
               * org.evosuite.testcase.MethodStatement.execute(MethodStatement.java:217)
               * org.evosuite.testcase.TestRunnable.call(TestRunnable.java:291)
               * org.evosuite.testcase.TestRunnable.call(TestRunnable.java:44)
               * java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
               * java.util.concurrent.FutureTask.run(FutureTask.java:138)
               * java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
               * java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
               * java.lang.Thread.run(Thread.java:662)
               */
            }
        } 
      }); 
      future.get(6000, TimeUnit.MILLISECONDS); 
    }
  }
  