// Path: src/main/java/org/tyrannyofheaven/bukkit/util/permissions/PermissionException.java
// public class PermissionException extends RuntimeException {
// 
//     private static final long serialVersionUID = 4064063141792654633L;
// 
//     private final List<String> permissions;
//     
//     private final boolean all;
// 
//     private final boolean checkNegations;
// 
//     /**
//      * Create a PermissionException for a single permission.
//      * 
//      * @param permission name of the permission
//      */
//     public PermissionException(String permission) {
//         this.permissions = Collections.singletonList(permission);
//         this.all = true;
//         this.checkNegations = false;
//     }
// 
//     /**
//      * Create a PermissionException for multiple permissions.
//      *  
//      * @param all true if all permissions are required
//      * @param permissions name of permissions
//      */
//     public PermissionException(boolean all, boolean checkNegations, String... permissions) {
//         this.permissions = Collections.unmodifiableList(new ArrayList<>(Arrays.asList(permissions)));
//         this.all = all;
//         this.checkNegations = checkNegations;
//     }
// 
//     /**
//      * Retrieve the associated permissions.
//      * 
//      * @return the permissions
//      */
//     public List<String> getPermissions() {
//         return permissions;
//     }
// 
//     /**
//      * Retrieve whether or not all permissions are required.
//      * 
//      * @return true if all permissions are required
//      */
//     public boolean isAll() {
//         return all;
//     }
// 
//     /**
//      * Retrieve whether or not negations were checked.
//      * 
//      * @return true if negations were checked
//      */
//     public boolean isCheckNegations() {
//         return checkNegations;
//     }
// 
// }


import org.bukkit.util.StringUtil;
import org.junit.Before;
import org.junit.Test;
import org.tyrannyofheaven.bukkit.util.permissions.PermissionException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import junit.framework.Assert;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;

        // Positional argument that starts with -
        he.execute(dummySender, "greet", "greet", new String[] { "--", "-garply" });
        Assert.assertEquals("Hello, -garply\n", out.toString()); out.delete(0, out.length());

        // String[] parameter
        he.execute(dummySender, "say", "say", new String[] { "Hello", "there" });
        Assert.assertEquals("Hello there\n", out.toString()); out.delete(0, out.length());
        
        // No flags, so should not parse -Hello as one.
        he.execute(dummySender, "say", "say", new String[] { "-Hello", "there" });
        Assert.assertEquals("-Hello there\n", out.toString()); out.delete(0, out.length());

        // Sub-command
        good = false;
        try { he.execute(dummySender, "foo", "foo", new String[0]); } catch (ParseException e) { good = true; }
        Assert.assertTrue(good);

        he.execute(dummySender, "foo", "foo", new String[] { "hello" });
        Assert.assertEquals("Hello from the foo sub-command!\n", out.toString()); out.delete(0, out.length());
        
        good = false;
        try { he.execute(dummySender, "foo", "foo", new String[] { "hello", "extra" }); } catch (ParseException e) { good = true; }
        Assert.assertTrue(good);

        good = false;
        permissions.clear();
        try {
            he.execute(dummySender, "secret", "secret", new String[0]);
        }
// Path: src/main/java/org/tyrannyofheaven/bukkit/util/permissions/PermissionException.java
// public class PermissionException extends RuntimeException {
// 
//     private static final long serialVersionUID = 4064063141792654633L;
// 
//     private final List<String> permissions;
//     
//     private final boolean all;
// 
//     private final boolean checkNegations;
// 
//     /**
//      * Create a PermissionException for a single permission.
//      * 
//      * @param permission name of the permission
//      */
//     public PermissionException(String permission) {
//         this.permissions = Collections.singletonList(permission);
//         this.all = true;
//         this.checkNegations = false;
//     }
// 
//     /**
//      * Create a PermissionException for multiple permissions.
//      *  
//      * @param all true if all permissions are required
//      * @param permissions name of permissions
//      */
//     public PermissionException(boolean all, boolean checkNegations, String... permissions) {
//         this.permissions = Collections.unmodifiableList(new ArrayList<>(Arrays.asList(permissions)));
//         this.all = all;
//         this.checkNegations = checkNegations;
//     }
// 
//     /**
//      * Retrieve the associated permissions.
//      * 
//      * @return the permissions
//      */
//     public List<String> getPermissions() {
//         return permissions;
//     }
// 
//     /**
//      * Retrieve whether or not all permissions are required.
//      * 
//      * @return true if all permissions are required
//      */
//     public boolean isAll() {
//         return all;
//     }
// 
//     /**
//      * Retrieve whether or not negations were checked.
//      * 
//      * @return true if negations were checked
//      */
//     public boolean isCheckNegations() {
//         return checkNegations;
//     }
// 
// }


// Path: src/test/java/org/tyrannyofheaven/bukkit/util/command/CommandTest.java
import org.bukkit.util.StringUtil;
import org.junit.Before;
import org.junit.Test;
import org.tyrannyofheaven.bukkit.util.permissions.PermissionException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import junit.framework.Assert;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;


        // Positional argument that starts with -
        he.execute(dummySender, "greet", "greet", new String[] { "--", "-garply" });
        Assert.assertEquals("Hello, -garply\n", out.toString()); out.delete(0, out.length());

        // String[] parameter
        he.execute(dummySender, "say", "say", new String[] { "Hello", "there" });
        Assert.assertEquals("Hello there\n", out.toString()); out.delete(0, out.length());
        
        // No flags, so should not parse -Hello as one.
        he.execute(dummySender, "say", "say", new String[] { "-Hello", "there" });
        Assert.assertEquals("-Hello there\n", out.toString()); out.delete(0, out.length());

        // Sub-command
        good = false;
        try { he.execute(dummySender, "foo", "foo", new String[0]); } catch (ParseException e) { good = true; }
        Assert.assertTrue(good);

        he.execute(dummySender, "foo", "foo", new String[] { "hello" });
        Assert.assertEquals("Hello from the foo sub-command!\n", out.toString()); out.delete(0, out.length());
        
        good = false;
        try { he.execute(dummySender, "foo", "foo", new String[] { "hello", "extra" }); } catch (ParseException e) { good = true; }
        Assert.assertTrue(good);

        good = false;
        permissions.clear();
        try {
            he.execute(dummySender, "secret", "secret", new String[0]);
        }
        catch (PermissionException e) {