// Path: src/main/java/org/rundeck/plugin/salt/output/SaltApiResponseOutput.java
// public class SaltApiResponseOutput {
//     protected String jid;
//     protected List<String> minions;
// 
//     public String getJid() {
//         return jid;
//     }
// 
//     public List<String> getMinions() {
//         return minions == null ? Collections.<String>emptyList() : Collections.unmodifiableList(minions);
//     }
// }


import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.rundeck.plugin.salt.output.SaltApiResponseOutput;
import org.rundeck.plugin.salt.version.SaltInteractionHandler;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.util.List;
import java.util.Set;
import org.apache.http.HttpException;
        setupResponseCode(post, HttpStatus.SC_ACCEPTED);

        String arg1 = "sdf%33&";
        String arg2 = "adsf asdf";
        plugin.function = String.format("%s \"%s\" \"%s\"", PARAM_FUNCTION, arg1, arg2);

        Assert.assertEquals("Expected mocked jid after submitting job", OUTPUT_JID,
                            plugin.submitJob(latestCapability, client, AUTH_TOKEN, PARAM_MINION_NAME, ImmutableSet.<String> of()));

        assertThatSubmitSaltJobAttemptedSuccessfully("fun=%s&tgt=%s&arg=%s&arg=%s", PARAM_FUNCTION, PARAM_MINION_NAME,
                                                     arg1, arg2);
    }

    @Test
    public void testSubmitJobResponseCodeError() throws Exception {
        setupResponseCode(post, HttpStatus.SC_TEMPORARY_REDIRECT);

        try {
            plugin.submitJob(latestCapability, client, AUTH_TOKEN, PARAM_MINION_NAME, ImmutableSet.<String> of());
            Assert.fail("Expected http exception due to bad response code.");
        }
        catch (HttpException e) {
            // expected
        }

        assertThatSubmitSaltJobAttemptedSuccessfully();
    }

    @Test
    public void testSubmitJobNoMinionsMatched() throws Exception {
// Path: src/main/java/org/rundeck/plugin/salt/output/SaltApiResponseOutput.java
// public class SaltApiResponseOutput {
//     protected String jid;
//     protected List<String> minions;
// 
//     public String getJid() {
//         return jid;
//     }
// 
//     public List<String> getMinions() {
//         return minions == null ? Collections.<String>emptyList() : Collections.unmodifiableList(minions);
//     }
// }


// Path: src/test/java/org/rundeck/plugin/salt/SaltApiNodeStepPlugin_SubmitSaltJobTest.java
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.rundeck.plugin.salt.output.SaltApiResponseOutput;
import org.rundeck.plugin.salt.version.SaltInteractionHandler;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.util.List;
import java.util.Set;
import org.apache.http.HttpException;

        setupResponseCode(post, HttpStatus.SC_ACCEPTED);

        String arg1 = "sdf%33&";
        String arg2 = "adsf asdf";
        plugin.function = String.format("%s \"%s\" \"%s\"", PARAM_FUNCTION, arg1, arg2);

        Assert.assertEquals("Expected mocked jid after submitting job", OUTPUT_JID,
                            plugin.submitJob(latestCapability, client, AUTH_TOKEN, PARAM_MINION_NAME, ImmutableSet.<String> of()));

        assertThatSubmitSaltJobAttemptedSuccessfully("fun=%s&tgt=%s&arg=%s&arg=%s", PARAM_FUNCTION, PARAM_MINION_NAME,
                                                     arg1, arg2);
    }

    @Test
    public void testSubmitJobResponseCodeError() throws Exception {
        setupResponseCode(post, HttpStatus.SC_TEMPORARY_REDIRECT);

        try {
            plugin.submitJob(latestCapability, client, AUTH_TOKEN, PARAM_MINION_NAME, ImmutableSet.<String> of());
            Assert.fail("Expected http exception due to bad response code.");
        }
        catch (HttpException e) {
            // expected
        }

        assertThatSubmitSaltJobAttemptedSuccessfully();
    }

    @Test
    public void testSubmitJobNoMinionsMatched() throws Exception {
        SaltApiResponseOutput response = new SaltApiResponseOutput();