package org.jenkinsci.plugins.pretestedintegration.unit;

import hudson.Launcher;
import hudson.model.AbstractBuild;
import hudson.model.BuildListener;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;

import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.plugins.git.GitSCM;
import hudson.plugins.git.Revision;
import org.eclipse.jgit.lib.PersonIdent;
import org.jenkinsci.plugins.gitclient.GitClient;
import org.jenkinsci.plugins.pretestedintegration.AbstractSCMBridge;
import org.jenkinsci.plugins.pretestedintegration.exceptions.IntegrationFailedException;
import org.jenkinsci.plugins.pretestedintegration.exceptions.NothingToDoException;
import org.jenkinsci.plugins.pretestedintegration.exceptions.UnsupportedConfigurationException;
import org.jenkinsci.plugins.pretestedintegration.scm.git.GitBridge;
import org.jenkinsci.plugins.pretestedintegration.scm.git.GitIntegrationStrategy;
import org.junit.Test;

public class GitIntegrationStrategyTest {
    @Test
    public void getPersonIdentTest() throws Exception{
        GitIntegrationStrategy strategy = getDummyStrategy();
        PersonIdent identity = strategy.getPersonIdent("john Doe <Joh@praqma.net> 1442321765 +0200");
        assertNotNull("Shouldn't be null.", identity);
        assertEquals("Identity name mismatch", "john Doe", identity.getName());
        assertEquals("Identity mail mismatch", "Joh@praqma.net", identity.getEmailAddress());
    }

    private GitIntegrationStrategy getDummyStrategy() {
        return new GitIntegrationStrategy() {
            @Override
            public void integrate(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener, AbstractSCMBridge bridge) throws IntegrationFailedException, NothingToDoException, UnsupportedConfigurationException {
                throw new UnsupportedOperationException("Dummies can't integrate.");
            }
            @Override
            public void integrateAsGitPluginExt(GitSCM scm, Run<?, ?> build, GitClient git, TaskListener listener, Revision marked, Revision rev, GitBridge bridge) throws NothingToDoException, IntegrationFailedException {
                throw new UnsupportedOperationException("Dummies can't integrate.");
            }
        };
    }
}

@@ -308,24 +308,58 @@
 skListener;%0A
+import hudson.plugins.git.Branch;%0A
 import hudso
@@ -380,16 +380,16 @@
 GitSCM;%0A
-
 import h
@@ -1019,16 +1019,45 @@
 .Test;%0A%0A
+import java.io.IOException;%0A%0A
 public c
@@ -1716,90 +1716,134 @@
 rate
-(AbstractBuild%3C?, ?%3E build, Launcher launcher, BuildListener listener, AbstractSCM
+AsGitPluginExt(GitSCM scm, Run%3C?, ?%3E build, GitClient git, TaskListener listener, Revision marked, Branch triggeredBranch, Git
 Brid
@@ -1935,32 +1935,67 @@
 urationException
+, IOException, InterruptedException
  %7B%0A             
@@ -2072,32 +2072,33 @@
 ;%0A            %7D%0A
+%0A
             @Ove
@@ -2140,185 +2140,186 @@
 rate
-AsGitPluginExt(GitSCM scm, Run%3C?, ?%3E build, GitClient git, TaskListener listener, Revision marked, Revision rev, GitBridge bridge) throws NothingToDoException, IntegrationFailed
+(AbstractBuild%3C?, ?%3E build, Launcher launcher, BuildListener listener, AbstractSCMBridge bridge) throws IntegrationFailedException, NothingToDoException, UnsupportedConfiguration
 Exce

Update to GH-125: Test should now work correctly