package org.jenkinsci.plugins.visualworks_store;

import hudson.util.ArgumentListBuilder;
import org.junit.Test;

import java.util.Arrays;
import java.util.List;

import static org.junit.Assert.assertEquals;

public class StoreSCMTest {
    @Test
    public void preparesPollingCommandForSinglePundle() {
        List<PundleSpec> pundles = Arrays.asList(new PundleSpec("Package"));
        StoreSCM scm = new StoreSCM("Repo", pundles, "\\d+", "Development", false, "");

        ArgumentListBuilder builder = scm.preparePollingCommand("storeScript");

        assertEquals("storeScript -repository Repo -packages Package -versionRegex \\d+ -blessedAtLeast Development",
                builder.toStringWithQuote());

    }
}

@@ -200,16 +200,59 @@
 tEquals;
+%0Aimport static org.junit.Assert.assertTrue;
 %0A%0Apublic
@@ -758,11 +758,655 @@
 ;%0A%0A    %7D
+%0A%0A    @Test%0A    public void preparesPollingCommandForMultiplePundles() %7B%0A        List%3CPundleSpec%3E pundles = Arrays.asList(new PundleSpec(%22Package%22), new PundleSpec(%22OtherPackage%22), new PundleSpec(%22Package with Spaces%22));%0A        StoreSCM scm = new StoreSCM(%22Repo%22, pundles, %22%5C%5Cd+%22, %22Development%22, false, %22%22);%0A%0A        ArgumentListBuilder builder = scm.preparePollingCommand(%22storeScript%22);%0A%0A        final String commandLine = builder.toStringWithQuote();%0A        assertTrue(%22Command line (%22 + commandLine + %22) doesn't contain expected text%22,%0A                commandLine.contains(%22-packages Package OtherPackage %5C%22Package with Spaces%5C%22%22));%0A    %7D
 %0A%7D%0A

Add another polling command test.