import junit.framework.TestCase;
import org.jvnet.winp.WinProcess;
import org.jvnet.winp.WinpException;

/**
 * @author Kohsuke Kawaguchi
 */
public class TheTest extends TestCase {
    public void testEnumProcesses() {
        for (WinProcess p : WinProcess.all()) {
            System.out.print(p.getPid());
            System.out.print(' ');
        }
        System.out.println();
    }

    public void testGetCommandLine() {
        for (WinProcess p : WinProcess.all()) {
            if(p.getPid()<10)   continue;
            System.out.println(p.getCommandLine());
        }
    }

    public void testErrorHandling() {
        try {
            new WinProcess(0).getEnvironmentVariables();
            fail();
        } catch (WinpException e) {
            // exception expected
            e.printStackTrace();
        }
    }

    public void testKill() throws Exception {
        Process p = Runtime.getRuntime().exec("notepad");
        WinProcess wp = new WinProcess(p);
        System.out.println(wp.getCommandLine());
        assertTrue(wp.getCommandLine().contains("notepad"));
        System.out.println(wp.getEnvironmentVariables());
        Thread.sleep(3000);
        new WinProcess(p).killRecursively();
    }

    static {
        WinProcess.enableDebugPrivilege();
    }
}

@@ -967,24 +967,43 @@
 notepad%22);%0D%0A
+        try %7B%0D%0A    
         WinP
@@ -1034,32 +1034,36 @@
 ss(p);%0D%0A        
+ 
+   
 System.out.print
@@ -1080,32 +1080,36 @@
 ommandLine());%0D%0A
+    
         assertTr
@@ -1154,32 +1154,36 @@
 ad%22));%0D%0A        
+   
+ 
 System.out.print
@@ -1213,24 +1213,83 @@
 iables());%0D%0A
+%0D%0A            System.out.println(%22pid=%22+wp.getPid());%0D%0A    
         Thre
@@ -1301,16 +1301,19 @@
 eep(
-30
+1
 00);%0D%0A
+    
     
@@ -1350,24 +1350,82 @@
 rsively();%0D%0A
+        %7D finally %7B%0D%0A            p.destroy();%0D%0A        %7D%0D%0A
     %7D%0D%0A%0D%0A   

improve the robustness of the test